Use stored value for One2Many changed without initial value

If the client does not send the value for the One2Many (it happens when it is
not modified), we must assume that it has the stored value unchanged. Otherwise
the current records are considered as to be added but with only their changed
values.

issue8605
review265901016
This commit is contained in:
Cédric Krier committed 2019-09-07 23:34:20 +02:00
1 parent dd1626e5cf
commit d2bc591d18
1 file changed
+1 -1
+1 -1
View File
@@ -775,7 +775,7 @@ class ModelView(Model):
value = value.id
elif field._type == 'one2many':
targets = value
init_targets = list(init_values.get(fname, []))
init_targets = list(init_values.get(fname, targets))
value = collections.defaultdict(list)
value['remove'] = [t.id for t in init_targets if t.id]
for i, target in enumerate(targets):