[FIX] fields: *2many convert_to_cache for new records

When interpreting commands, the initial value for new records is an empty list.
This regression was introduced by 0939738479.

Fixes #11239.
This commit is contained in:
Raphael Collet
2016-03-15 10:40:38 +01:00
parent 3fe01ef3c3
commit ce217acf18
+2 -1
View File
@@ -1744,7 +1744,8 @@ class _RelationalMulti(_Relational):
elif isinstance(value, list):
# value is a list of record ids or commands
comodel = record.env[self.comodel_name]
ids = OrderedSet(record[self.name].ids)
# determine the value ids; by convention empty on new records
ids = OrderedSet(record[self.name].ids if record.id else ())
# modify ids with the commands
for command in value:
if isinstance(command, (tuple, list)):