Skip to content

Commit 5096799

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 82341ac commit 5096799

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/util/records.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -902,11 +902,20 @@ def force_noupdate(cr, xmlid, noupdate=True, warn=False):
902902
WHERE module = %s
903903
AND name = %s
904904
AND noupdate != %s
905+
RETURNING model
905906
""",
906907
[noupdate, module, name, noupdate],
907908
)
908-
if noupdate is False and cr.rowcount and warn:
909-
_logger.warning("Customizations on `%s` might be lost!", xmlid)
909+
if cr.rowcount:
910+
if noupdate is False and warn:
911+
_logger.warning("Customizations on `%s` might be lost!", xmlid)
912+
913+
[model] = cr.fetchone()
914+
for parent_model, inh in direct_inherit_parents(cr, model):
915+
if inh.via:
916+
parent = parent_model.replace(".", "_")
917+
force_noupdate(cr, "{}_{}".format(xmlid, parent), noupdate=noupdate, warn=warn)
918+
910919
return cr.rowcount
911920

912921

0 commit comments

Comments
 (0)