Skip to content

Commit d327c12

Browse files
committed
[IMP] util.force_noupdate: change the flag on parent records
For models with `_inherits`, an xmlid is created for the parent record. We also need to update those xmlids. As example, when called on a `product.product` record, we now also set the flag on the xmlid of the `product.template` record.
1 parent e05a55f commit d327c12

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/util/records.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -901,11 +901,19 @@ def force_noupdate(cr, xmlid, noupdate=True, warn=False):
901901
WHERE module = %s
902902
AND name = %s
903903
AND noupdate != %s
904+
RETURNING model
904905
""",
905906
[noupdate, module, name, noupdate],
906907
)
907-
if noupdate is False and cr.rowcount and warn:
908-
_logger.warning("Customizations on `%s` might be lost!", xmlid)
908+
if cr.rowcount:
909+
if noupdate is False and warn:
910+
_logger.warning("Customizations on `%s` might be lost!", xmlid)
911+
912+
[model] = cr.fetchone()
913+
for parent_model, _ in inherits_parents(cr, model):
914+
parent = parent_model.replace(".", "_")
915+
force_noupdate(cr, "{}_{}".format(xmlid, parent), noupdate=noupdate, warn=warn)
916+
909917
return cr.rowcount
910918

911919

0 commit comments

Comments
 (0)