odoo/upgrade-util#418

Created by Sanchit Gupta (sagu)

Blocked

label
odoo-dev:master-fix-custom-field-manaul-sagu
head
cf895949b004197a5e64253bbcb2272cd6c51eb8
odoo/upgrade-util
master #418 missing r+

[FIX] util/orm: don't mark inherited field manual for custom

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.

In particular, marking inherited fields as manual triggers unnecessary computations, especially for non-stored fields and
Many2many fields linked to ir.attachment.

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.

('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