Skip to content

Commit ec96b48

Browse files
committed
[FIX] util.rename_xmlid: also rename _inherits xmlids
xmlids for inherits records are also generated and should also be renamed. closes #22 Related: odoo/upgrade#5433 Signed-off-by: Christophe Simonis (chs) <[email protected]>
1 parent 096a4ba commit ec96b48

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/util/records.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from .exceptions import MigrationError
2323
from .helpers import _get_theme_models, _ir_values_value, _validate_model, model_of_table, table_of_model
2424
from .indirect_references import indirect_references
25-
from .inherit import for_each_inherit
25+
from .inherit import direct_inherit_parents, for_each_inherit
2626
from .misc import parse_version, version_gte
2727
from .orm import env
2828
from .pg import (
@@ -597,6 +597,17 @@ def rename_xmlid(cr, old, new, noupdate=None, on_collision="fail"):
597597
# iif the key has been updated for this view, also update it for all other cowed views.
598598
# Don't change the view keys inconditionally to avoid changing unrelated views.
599599
cr.execute("UPDATE ir_ui_view SET key = %s WHERE key = %s", [new, old])
600+
601+
for parent_model, inh in direct_inherit_parents(cr, model):
602+
if inh.via:
603+
parent = parent_model.replace(".", "_")
604+
rename_xmlid(
605+
cr,
606+
"{}_{}".format(old, parent),
607+
"{}_{}".format(new, parent),
608+
noupdate=noupdate,
609+
on_collision=on_collision,
610+
)
600611
return new_id
601612
return None
602613

0 commit comments

Comments
 (0)