odoo/odoo#121745
Created by Discuss, Rahul Prajapati (rapr)
Merged
at 0e182dddc869f1f6b0dc894360dff0c9f5c3463a
Statuses:
- legal/cla: Contributor License Agreement check
- ci/runbot: Odoo Test Suite
- ci/upgrade_enterprise: Test upgrades for enterprise master
- ci/template: Contact runbot team for help in case of failure.
- ci/style: Optional style check. Ignore it only if strictly necessary.
- ci/security: Required security check. Can only be ignored by security team.
- label
- odoo-dev:saas-16.2-sentry-3979435039-fix-studio-fields-depends-validation-rapr
- head
- e5dd73ad7bf7efe07e1230299ce3fd07ee25a8e9
- merged
- 2 years ago by Framework (ORM), Xavier Morel (xmo)
odoo/odoo | |
---|---|
14.0 | #121745 |
15.0 | #123125 |
saas-15.2 | #123460 |
16.0 | #123470 |
saas-16.1 | #123558 |
saas-16.2 | #124636 |
saas-16.3 | #124648 |
17.0 | |
18.0 | |
saas-18.1 | |
saas-18.2 | |
saas-18.3 | |
master | #124660 |
[FIX] base: validation for studio fields compute dependencies
Current behavior before PR:
id
cannot be set as the dependency for a field's compute method.
So, when a user configures id
as a dependency for a studio field's compute,
there is no error shown to the user, and
the field is saved with id
as a dependency.
NotImplementedError: Compute method cannot depend on field 'id'.
File "odoo/addons/base/models/ir_model.py", line 1165, in _add_manual_fields
field = self._instanciate(field_data)
File "odoo/addons/base/models/ir_model.py", line 1155, in _instanciate
attrs = self._instanciate_attrs(field_data)
File "addons/mail/models/ir_model_fields.py", line 29, in _instanciate_attrs
attrs = super(IrModelField, self)._instanciate_attrs(field_data)
File "odoo/addons/base/models/ir_model.py", line 1150, in _instanciate_attrs
attrs['compute'] = make_compute(field_data['compute'], field_data['depends'])
File "odoo/addons/base/models/ir_model.py", line 39, in make_compute
return api.depends(*deps)(func)
File "odoo/api.py", line 264, in depends
raise NotImplementedError("Compute method cannot depend on field 'id'.")
Desired behavior after PR is merged:
It will throw a UserError
to the user.
sentry-3979435039
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr