OCA / web

Odoo web client UI related addons
GNU Affero General Public License v3.0
927 stars 1.87k forks source link

[17.0][FIX] web_m2x_options: Error when installing employee module #2921

Closed CRogos closed 2 weeks ago

CRogos commented 1 month ago

When web_m2x_options is installed, and you install the employee module, you cannot open the employee app and get this error message (development mode needs to be active):

image

The components Many2OneAvatarUserField and KanbanMany2OneAvatarUserField causing this error.

I am not sure if this is the best solution, because it also changes the dependency from "web" to "mail". Review feedback highly welcome.

CarlosRoca13 commented 1 month ago

Are you sure the problem is with this module? I've installed it with hr locally and haven't had any issue (all without including your changes).

Do you have any extra module installed on your instance?

CRogos commented 1 month ago

I could reproduced the issue in runbot, by installing the hr module.

But I just realized this issue only occurs in the development mode! (?debug=1)

http://oca-web-17-0-f4885276a6e4.runboat.odoo-community.org/web?debug=1#menu_id=106&action=160&model=res.partner&view_type=form

pedrobaeza commented 1 month ago

It seems that we will have the same problem with any other custom m2o widget, isn't it? Can't we do anything that don't force to declare that extra options on each widget?

CarlosRoca13 commented 1 month ago

I think it's not possible to make it more abstract... I have tried different options to avoid that extensions but nothing works... @chienandalu do you have any ideas to avoid them?

CarlosRoca13 commented 1 month ago

Yes, I tried changing the order of asset loading, but I wasn't able to make the error go away.

chienandalu commented 1 month ago

What about using patch(): https://github.com/odoo/documentation/blob/17.0/content/developer/reference/frontend/javascript_reference.rst?plain=1#L168-L169

chienandalu commented 1 month ago

What about using patch(): https://github.com/odoo/documentation/blob/17.0/content/developer/reference/frontend/javascript_reference.rst?plain=1#L168-L169

An example: https://github.com/OCA/OCB/blob/5eb4c06a5d26476cd47cfff0df23d5e05f5318b6/addons/sms/static/src/components/phone_field/phone_field.js#L8-L21

CarlosRoca13 commented 1 month ago

Ups :sweat_smile:

CarlosRoca13 commented 1 month ago

I will try it, I have tried with patch but patching the props directly

CRogos commented 1 month ago

Any idea why this only occur in developer mode?

CarlosRoca13 commented 1 month ago

Any idea why this only occur in developer

Sometimes non-blocking errors are hidden to users, so they are only visible to developers. However, this doesn't mean they shouldn't be fixed.

CarlosRoca13 commented 1 month ago

What about using patch(): https://github.com/odoo/documentation/blob/17.0/content/developer/reference/frontend/javascript_reference.rst?plain=1#L168-L169

It does not work either

CRogos commented 1 month ago

@CarlosRoca13 @chienandalu can we go with this solution as long we do not have any better way?

CarlosRoca13 commented 1 month ago

What do you think @chienandalu?

CRogos commented 3 weeks ago

@CarlosRoca13 shall we continue without @chienandalu ? Maybe this solution is not the best, but it fixes the js error in developer mode.

pedrobaeza commented 2 weeks ago

/ocabot merge patch

OCA-git-bot commented 2 weeks ago

On my way to merge this fine PR! Prepared branch 17.0-ocabot-merge-pr-2921-by-pedrobaeza-bump-patch, awaiting test results.

OCA-git-bot commented 2 weeks ago

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