diff --git a/openupgradelib/openupgrade.py b/openupgradelib/openupgrade.py index 0b2ca9e5..9c7ff907 100644 --- a/openupgradelib/openupgrade.py +++ b/openupgradelib/openupgrade.py @@ -825,6 +825,16 @@ def rename_models(cr, model_spec): "UPDATE ir_filters SET model_id = %s " "WHERE model_id = %s", (new, old,), ) + logged_query( + cr, """ + UPDATE ir_property + SET res_id = replace(res_id, %(old_string)s, %(new_string)s) + WHERE res_id like %(old_pattern)s""", { + "old_pattern": "%s,%%" % old, + "old_string": "%s," % old, + "new_string": "%s," % new, + }, + ) # Handle properties that reference to this model logged_query( cr, @@ -841,14 +851,12 @@ def rename_models(cr, model_spec): logged_query( cr, """ UPDATE ir_property - SET value_reference = regexp_replace( - value_reference, %(old_pattern)s, %(new_pattern)s - ) - WHERE fields_id IN %(field_ids)s - AND value_reference ~ %(old_pattern)s""", { - 'field_ids': tuple(field_ids), - 'old_pattern': r"^%s,[ ]*([0-9]*)" % old, - 'new_pattern': r"%s,\1" % new, + SET value_reference = replace( + value_reference, %(old_string)s, %(new_string)s) + WHERE value_reference like %(old_pattern)s""", { + "old_pattern": "%s,%%" % old, + "old_string": "%s," % old, + "new_string": "%s," % new, }, ) # Update export profiles references