changeset 6ec348fc2771 in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset;node=6ec348fc2771
description:
        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
diffstat:

 trytond/model/modelview.py |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 5fb043503a9d -r 6ec348fc2771 trytond/model/modelview.py
--- a/trytond/model/modelview.py        Mon Sep 02 18:34:55 2019 +0200
+++ b/trytond/model/modelview.py        Sat Sep 07 23:34:20 2019 +0200
@@ -775,7 +775,7 @@
                         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):

Reply via email to