[FIX] util/orm: don't mark inherited field manual for custom#418
[FIX] util/orm: don't mark inherited field manual for custom#418sagu-odoo wants to merge 1 commit into
Conversation
0f12608 to
bd59ab3
Compare
|
The |
|
Besides what @KangOl mentioned I want to point out that the description in the PR is quite ambiguous. Please clarify what you meant. The query you modified mark all fields that weren't loaded as manual, this is important to avoid other errors. It doesn't make sense to disable this without a clear description of the setup such that we know if it is really safe to do so. Regarding the linked patch. If you need something to "get applied" maybe there are other ways to achieve that. Hence, once more, a detailed setup is important. |
The issue related to computation being triggered on inherited fields, which caused blocking especially for non-stored fields Many2Many fields linked with The intention of the fix is to ensure that inherited fields are not marked as manual fields. Only fields created via the UI or explicitly through There is no issue with stored field computation; the problem specifically occurs with inherited (non-stored) fields. This has been addressed in the following PR, which resolves the blocking of upgrade requests for almost: Related fixes to address the traceback but not for 19.0 version |
|
this isssue mostly limited to custom module fields only as of now. |
|
upgradeci retry with always only crm |
|
for mentioned traceback, I think we can backport something like this fix not exact to 19.0 odoo/odoo#246333 . So, group by feature on |
bd59ab3 to
f678dce
Compare
f678dce to
a4bc288
Compare
|
Hello @aj-fuentes and @KangOl , can i get your opinion on this ?. Thanks in advance |
|
Hello @aj-fuentes and @KangOl ,Gentle reminder! can i get your opinion on this ?. Thanks in advance |
|
Hllo @aj-fuentes , Gentle reminder!, can i get review on this ?. Thanks in advance. |
During the upgrade process, inherited fields were incorrectly marked as `manual`, while they should retain their original state (`base`). Fields created via Studio are expected to have `state = manual`, whereas inherited fields must remain `base` according to ORM behavior [1]. Overriding this state leads to unintended side effects. In particular, marking inherited fields as `manual` triggers unnecessary computations, especially for non-stored fields and Many2many fields linked to `ir.attachment`. This can lead to tracebacks and block upgrade requests This change ensures that: - inherited fields are not marked as `manual` - only fields explicitly created via Studio or `ir.model.fields` are considered `manual` This aligns the upgrade behavior with the ORM logic and prevents unwanted computations on inherited fields. [1]: https://github.com/odoo/odoo/blob/d58f4ed332af35f6de26a93f07adf05368731e20/odoo/orm/model_classes.py#L493-L508 ``` ('account.product_product_menu_sellable', 122, 'Accounting > Customers > Products', 254): Traceback (most recent call last): File "/tmp/tmpqgivh7_j/migrations/base/tests/test_mock_crawl.py", line 335, in crawl_menu self.mock_action(action_vals) File "/tmp/tmpqgivh7_j/migrations/base/tests/test_mock_crawl.py", line 348, in mock_action return self.mock_act_window(action) File "/tmp/tmpqgivh7_j/migrations/base/tests/test_mock_crawl.py", line 432, in mock_act_window views = get_views( File "/home/odoo/src/odoo/19.0/addons/mail/models/mail_thread.py", line 471, in get_views res = super().get_views(views, options) File "/home/odoo/src/enterprise/19.0/web_studio/models/models.py", line 10, in get_views result = super().get_views(views, options=options) File "/home/odoo/src/enterprise/19.0/web_studio/models/ir_ui_view.py", line 52, in get_views return super().get_views(views, options) File "/home/odoo/src/odoo/19.0/odoo/addons/base/models/ir_ui_view.py", line 2946, in get_views result['models'][model] = {"fields": self.env[model].fields_get( File "/home/odoo/src/enterprise/19.0/web_studio/models/ir_model.py", line 76, in fields_get return super().fields_get(allfields, attributes=attributes) File "/home/odoo/src/enterprise/19.0/ai_fields/models/models.py", line 47, in fields_get res = super().fields_get(allfields, attributes) File "/home/odoo/src/odoo/19.0/odoo/orm/models.py", line 3361, in fields_get description = field.get_description(self.env, attributes=attributes) File "/home/odoo/src/odoo/19.0/odoo/orm/fields.py", line 884, in get_description value = value(env) File "/home/odoo/src/odoo/19.0/odoo/orm/fields.py", line 937, in _description_groupable model._read_group_groupby(model._table, groupby, query) File "/home/odoo/src/odoo/19.0/addons/mail/models/mail_activity_mixin.py", line 257, in _read_group_groupby return super()._read_group_groupby(alias, groupby_spec, query) File "/home/odoo/src/odoo/19.0/odoo/orm/models.py", line 2064, in _read_group_groupby coquery = comodel._search(codomain, bypass_access=field.bypass_search_access) File "/home/odoo/src/odoo/19.0/odoo/addons/base/models/ir_attachment.py", line 677, in _search records = self.sudo().with_context(active_test=False).search_fetch( File "/home/odoo/src/odoo/19.0/odoo/orm/models.py", line 1418, in search_fetch return self._fetch_query(query, fields_to_fetch) File "/home/odoo/src/odoo/19.0/odoo/orm/models.py", line 3917, in _fetch_query rows = self.env.execute_query(query.select(*sql_terms)) File "/home/odoo/src/odoo/19.0/odoo/orm/environments.py", line 534, in execute_query self.cr.execute(query) File "/home/odoo/src/odoo/19.0/odoo/tests/test_cursor.py", line 79, in execute return self._cursor.execute(*args, **kwargs) File "/home/odoo/src/odoo/19.0/odoo/sql_db.py", line 433, in execute self._obj.execute(query, params) psycopg2.DatabaseError: out of memory for query result ``` upg-4179716 opw-6101425
a4bc288 to
cf89594
Compare

During the upgrade process, inherited fields were incorrectly marked as
manual, while they should retain their originalstate (
base).Fields created via Studio are expected to have
state = manual, whereas inherited fields must remainbaseaccording to ORM behavior 1.In particular, marking inherited fields as
manualtriggers unnecessary computations, especially for non-stored fields andMany2many fields linked to
ir.attachment.This change ensures that:
manualir.model.fieldsare considered
manualThis aligns the upgrade behavior with the ORM logic and prevents
unwanted computations on inherited fields.
upg-4179716
opw-6101425