web icon indicating copy to clipboard operation
web copied to clipboard

[16.0][IMP] web_chatter_position: implement feature on controller and add switch button

Open trisdoan opened this issue 1 year ago • 10 comments

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

  1. No Attachment present

web_chatter_result.webm

  1. Attachment present web_chatter_result-(2).webm

trisdoan avatar Dec 26 '24 04:12 trisdoan

Hello @ivantodorovich, would you mind taking a look at this

trisdoan avatar Dec 26 '24 04:12 trisdoan

~~DRAFT: event listeners are lost when chatter is at the bottom~~

trisdoan avatar Dec 27 '24 09:12 trisdoan

nice

fanha99 avatar Dec 30 '24 04:12 fanha99

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

ivantodorovich avatar Jan 07 '25 12:01 ivantodorovich

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-block to hide the switch dynamically whenever the screen is too small

trisdoan avatar Jan 08 '25 05:01 trisdoan

Is there a plan to merge this?

diggy128 avatar Jan 31 '25 21:01 diggy128

Is there a plan to merge this?

Hello, an approval will move up the process faster :wink:

trisdoan avatar Feb 11 '25 10:02 trisdoan

It seems runboat is stuck. Can someone rerun the build?

diggy128 avatar Mar 28 '25 06:03 diggy128

Functional review, LGTM!

diggy128 avatar May 03 '25 14:05 diggy128

Hello @ivantodorovich, how does it look to you?

trisdoan avatar May 06 '25 03:05 trisdoan

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.

diggy128 avatar May 16 '25 13:05 diggy128

Hello @diggy128, thanks for testing. I just pushed a fixup

  1. My assumption is that this.rootRef.el is somehow lost when referring in _moveChatter, although it was checked in moveChatter. Could you help to test it again?
  2. I replaced hasAttachmentViewerinArch with func hasAttachmentViewer() as it did not change position, when module account is installed. Did you get that bug too?

trisdoan avatar May 23 '25 09:05 trisdoan

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.

diggy128 avatar May 23 '25 10:05 diggy128

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

diggy128 avatar Jun 04 '25 06:06 diggy128

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?

trisdoan avatar Jun 11 '25 10:06 trisdoan

Hi @trisdoan, happy to help. I've patched my dev installation and I'll get back to you in a few days.

diggy128 avatar Jun 11 '25 12:06 diggy128

I would like to test this, but runboat is stuck, could someone please rerun the build?

ArnauCForgeFlow avatar Aug 19 '25 16:08 ArnauCForgeFlow

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'])

trisdoan avatar Aug 20 '25 05:08 trisdoan

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

trisdoan avatar Aug 20 '25 09:08 trisdoan

Functional testing on dev machine looks good. No more errors whatsoever.

Once merged, please forward-port this to v18.

diggy128 avatar Aug 20 '25 18:08 diggy128

Thanks @diggy128, took your comment as approval

trisdoan avatar Aug 21 '25 02:08 trisdoan

/ocabot merge patch

trisdoan avatar Aug 21 '25 02:08 trisdoan

This PR looks fantastic, let's merge it! Prepared branch 16.0-ocabot-merge-pr-3040-by-trisdoan-bump-patch, awaiting test results.

OCA-git-bot avatar Aug 21 '25 02:08 OCA-git-bot

@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.

OCA-git-bot avatar Aug 21 '25 02:08 OCA-git-bot

/ocabot merge patch

trisdoan avatar Aug 25 '25 07:08 trisdoan

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.

OCA-git-bot avatar Aug 25 '25 07:08 OCA-git-bot

Congratulations, your PR was merged at 294d323f6eb3c6d5ce1e62d28203a2c76d6b858f. Thanks a lot for contributing to OCA. ❤️

OCA-git-bot avatar Aug 25 '25 07:08 OCA-git-bot

Hi @trisdoan could you please fwport this to v18?

ArnauCForgeFlow avatar Aug 25 '25 14:08 ArnauCForgeFlow

Hi @ArnauCForgeFlow, it's wip, will ping you when it's ready

trisdoan avatar Aug 26 '25 03:08 trisdoan

Hello @trisdoan , just discovered this fix, not knowing before the switch button on form This is SO GREAT ! Just thank you :)

arnaudlayec avatar Oct 03 '25 09:10 arnaudlayec