[FIX] base: renaming of x2many fields

This commit is contained in:
Raphael Collet
2018-10-18 12:04:45 +02:00
parent 80fd5abd90
commit e91b16b734
+8 -4
View File
@@ -697,11 +697,15 @@ class IrModelFields(models.Model):
field = getattr(obj, '_fields', {}).get(item.name)
if vals.get('name', item.name) != item.name:
# We need to rename the column
# We need to rename the field
item._prepare_update()
if column_rename:
raise UserError(_('Can only rename one field at a time!'))
column_rename = (obj._table, item.name, vals['name'], item.index)
if item.ttype in ('one2many', 'many2many'):
# those field names are not explicit in the database!
pass
else:
if column_rename:
raise UserError(_('Can only rename one field at a time!'))
column_rename = (obj._table, item.name, vals['name'], item.index)
# We don't check the 'state', because it might come from the context
# (thus be set for multiple fields) and will be ignored anyway.