[16.0][IMP] web_chatter_position: implement feature on controller and add switch button
Context
- The Switch Button was dropped during migration to 16.0, which I assumed it was due to the approach taken at that time.
- In Odoo 15, the position was patched in Controller and Renderer and adjusted by DOM
- In Odoo 16, it was chosen to do it via Compiler, which the component (Form) needs to be destroyed to re-trigger the Compiler.
- There was a comment about it but probably missed.
This changes
- Revert to the approach implemented on Odoo 15.0: by taking advantage of OWL cycles
- Re-introduce the switch button
Result
- No Attachment present
- Attachment present web_chatter_result-(2).webm
Hello @ivantodorovich, would you mind taking a look at this
~~DRAFT: event listeners are lost when chatter is at the bottom~~
nice
Hello!
Thanks for your contribution!
I remember this was an intentional compromise to keep it simple. Hopefully you find a way to achieve it, though.
Did a few functional tests, and unfortunately it doesn't seem to work properly. The side panel show on smaller screens.
https://github.com/user-attachments/assets/432ddd97-96b3-4c18-915a-94d8f73e9532
Hello @ivantodorovich, I updated the code, how does it look to you?
Why it happened
- When option is sided and the screen is small (particularly smaller than XXL), the chatter is hidden.
Solution
- Add a check (if the screen is big enough) before patching the position of the chatter. If it's too small, let the chatter handled by standard
- Add class:
d-none d-xxl-inline-blockto hide the switch dynamically whenever the screen is too small
Is there a plan to merge this?
Is there a plan to merge this?
Hello, an approval will move up the process faster :wink:
It seems runboat is stuck. Can someone rerun the build?
Functional review, LGTM!
Hello @ivantodorovich, how does it look to you?
Functional review, LGTM!
It seems there are issues...
I randomly get:
UncaughtClientError > TypeError Uncaught Javascript Error > Cannot read properties of null (reading 'querySelector') TypeError: Cannot read properties of null (reading 'querySelector') at AccountMoveController._moveChatter (https://www.xxx.gr/web/assets/139442-2307463/web.assets_backend.min.js:25546:290) at https://www.xxx.gr/web/assets/139442-2307463/web.assets_backend.min.js:25544:768
It seems it has to do with resizing the window somehow, because it happened once on this occasion, but so far I haven't pinpointed what raises the error, and could not raise it in debug assets mode.
Hello @diggy128, thanks for testing. I just pushed a fixup
- My assumption is that
this.rootRef.elis somehow lost when referring in_moveChatter, although it was checked inmoveChatter. Could you help to test it again? - I replaced
hasAttachmentViewerinArchwith funchasAttachmentViewer()as it did not change position, when moduleaccountis installed. Did you get that bug too?
OK, I've merged the patch in my dev machine. Just give me a few days to check if it comes up again.
As for point 2 I can't tell as I didn't keep the error logs. I'll check though if it happens and will let you know.
Still getting an error (less often, still not repeatable). One occasion I've noticed is when detaching a tab to a new window.
The error is:
UncaughtClientError > TypeError Uncaught Javascript Error > this.rootRef.el is null TypeError: this.rootRef.el is null setup/<@https://www.xxx.gr/web/assets/140234-8a2f3d1/web.assets_backend.min.js:25544:798
Hello @diggy128, so much thanks to your testing! I just pushed a patch to use Odoo built-in function to handle the eventlistner and some defensive checks.
Could you please try again?
Hi @trisdoan, happy to help. I've patched my dev installation and I'll get back to you in a few days.
I would like to test this, but runboat is stuck, could someone please rerun the build?
Checking failed test
2025-08-20 04:36:59,335 461 ERROR odoo odoo.addons.web_systray_button_init_action.tests.test_web_systray_button_init_action: FAIL: TestUI.test_ui Traceback (most recent call last): File "/__w/web/web/web_systray_button_init_action/tests/test_web_systray_button_init_action.py", line 20, in test_ui self.start_tour( File "/opt/odoo/odoo/tests/common.py", line 2048, in start_tour return self.browser_js(url_path=url_path, code=code, ready=ready, **kwargs) File "/opt/odoo/odoo/tests/common.py", line 2024, in browser_js self.fail('%s\n\n%s' % (message, error)) AssertionError: The test code "odoo.startTour('web_systray_button_init_action_set_tour', 100)" failed
Tour web_systray_button_init_action_set_tour failed at step Click here to go to the next step. (trigger: a[data-menu-xmlid='base.menu_administration'])
Hi @ArnauCForgeFlow, I reproduced the failed test case locally, and it still passes.
I believe this change has nothing to do with the failed case. You can test functionality of the module, thanks
Functional testing on dev machine looks good. No more errors whatsoever.
Once merged, please forward-port this to v18.
Thanks @diggy128, took your comment as approval
/ocabot merge patch
This PR looks fantastic, let's merge it! Prepared branch 16.0-ocabot-merge-pr-3040-by-trisdoan-bump-patch, awaiting test results.
@trisdoan your merge command was aborted due to failed check(s), which you can inspect on this commit of 16.0-ocabot-merge-pr-3040-by-trisdoan-bump-patch.
After fixing the problem, you can re-issue a merge command. Please refrain from merging manually as it will most probably make the target branch red.
/ocabot merge patch
Hey, thanks for contributing! Proceeding to merge this for you. Prepared branch 16.0-ocabot-merge-pr-3040-by-trisdoan-bump-patch, awaiting test results.
Congratulations, your PR was merged at 294d323f6eb3c6d5ce1e62d28203a2c76d6b858f. Thanks a lot for contributing to OCA. ❤️
Hi @trisdoan could you please fwport this to v18?
Hi @ArnauCForgeFlow, it's wip, will ping you when it's ready
Hello @trisdoan , just discovered this fix, not knowing before the switch button on form This is SO GREAT ! Just thank you :)