Commit bb32e24a authored by Pedro M. Baeza's avatar Pedro M. Baeza

[IMP] rename_fields: Include mail_alias defaults

parent cc2f612a
......@@ -462,6 +462,21 @@ def rename_fields(env, field_spec, no_deep=False):
WHERE model_id = %%s
""" % (old_field, new_field), (model, ),
)
if table_exists(env.cr, 'mail_alias'):
# Rename appearances on mail alias
cr.execute("""
UPDATE mail_alias ma
SET alias_defaults =
replace(alias_defaults, %(old_pattern)s, %(new_pattern)s)
FROM ir_model im
WHERE ma.alias_model_id = im.id
AND im.model = %%s
AND ma.alias_defaults ~ %(old_pattern)s
""" % {
'old_pattern': "$$'%s'$$" % old_field,
'new_pattern': "$$'%s'$$" % new_field,
}, (model, ),
)
def rename_tables(cr, table_spec):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment