Skip to content

Commit 0d5f106

Browse files
committed
[IMP] util.update_record_from_xml
Set the record in noupdate=False using the `force_noupdate` function, taking adventage of its new behavior of also updating the parent records.
1 parent d327c12 commit 0d5f106

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/util/records.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,20 +1096,18 @@ def __update_record_from_xml(
10961096

10971097
cr.execute(
10981098
"""
1099-
UPDATE ir_model_data d
1100-
SET noupdate = false
1101-
FROM ir_model_data o
1102-
WHERE o.id = d.id
1103-
AND d.module = %s
1104-
AND d.name = %s
1105-
RETURNING d.model, d.res_id, o.noupdate
1099+
SELECT model, res_id, noupdate
1100+
FROM ir_model_data
1101+
WHERE module = %s
1102+
AND name = %s
11061103
""",
11071104
[module, name],
11081105
)
11091106
if cr.rowcount:
11101107
model, res_id, noupdate = cr.fetchone()
11111108
if model == "ir.model":
11121109
return
1110+
force_noupdate(cr, xmlid, noupdate=False)
11131111
elif not force_create:
11141112
_logger.warning("Record %r not found in database. Skip update.", xmlid)
11151113
return

0 commit comments

Comments
 (0)