Skip to content

Commit ebbf944

Browse files
committed
[FIX] util.rename_xmlid
Use the new `inherits_parents` function to get the inherits models.
1 parent ed49e8a commit ebbf944

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/util/records.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
)
3434
from .inconsistencies import break_recursive_loops
3535
from .indirect_references import indirect_references
36-
from .inherit import direct_inherit_parents, for_each_inherit
36+
from .inherit import for_each_inherit, inherits_parents
3737
from .misc import Sentinel, chunks, parse_version, version_gte
3838
from .orm import env, flush
3939
from .pg import (
@@ -841,16 +841,15 @@ def rename_xmlid(cr, old, new, noupdate=None, on_collision="fail"):
841841
"""
842842
cr.execute(query, {"old": r"\y{}\y".format(re.escape(old)), "new": new})
843843

844-
for parent_model, inh in direct_inherit_parents(cr, model):
845-
if inh.via:
846-
parent = parent_model.replace(".", "_")
847-
rename_xmlid(
848-
cr,
849-
"{}_{}".format(old, parent),
850-
"{}_{}".format(new, parent),
851-
noupdate=noupdate,
852-
on_collision=on_collision,
853-
)
844+
for parent_model, _ in inherits_parents(cr, model):
845+
parent = parent_model.replace(".", "_")
846+
rename_xmlid(
847+
cr,
848+
"{}_{}".format(old, parent),
849+
"{}_{}".format(new, parent),
850+
noupdate=noupdate,
851+
on_collision=on_collision,
852+
)
854853
return new_id
855854
return None
856855

0 commit comments

Comments
 (0)