Skip to content

Commit

Permalink
[FIX] models: add xmlid for inherited selection values
Browse files Browse the repository at this point in the history
If model A has a selection field, and is inherited by 2 modules
B and C, B adds selection values to the field, and C inherits model
A under a different module and model names.
Based on the order of installation of B and C, we may end up with
different xmlids.
If B is installed before C, then B will add xmlids for the new
selection values added for model C. But if C is installed before
B, then C will have the selection values from B without xmlids.
The change here ensures that the selection values introduced by B
will always have correct xmlids.

closes odoo#128833

X-original-commit: c673d9d
Signed-off-by: Raphael Collet <rco@odoo.com>
  • Loading branch information
jjmaksoud committed Jul 19, 2023
1 parent d319b90 commit 9c409d5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions odoo/addons/base/models/ir_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1270,8 +1270,8 @@ def _reflect_selections(self, model_names):
for field in fields:
model = self.env[field.model_name]
for value, modules in field._selection_modules(model).items():
if module in modules:
xml_id = selection_xmlid(module, field.model_name, field.name, value)
for m in modules:
xml_id = selection_xmlid(m, field.model_name, field.name, value)
record = self.browse(selection_ids[field.model_name, field.name, value])
data_list.append({'xml_id': xml_id, 'record': record})
self.env['ir.model.data']._update_xmlids(data_list)
Expand Down

0 comments on commit 9c409d5

Please sign in to comment.