summaryrefslogtreecommitdiff
path: root/odoo/fields.py
diff options
context:
space:
mode:
authorRaphael Collet <rco@odoo.com>2021-02-05 10:32:49 +0000
committerRaphael Collet <rco@odoo.com>2021-02-05 17:28:22 +0000
commit4e444568df68c0e36c1ab7f2668270002e30747e (patch)
treeee8bf9751728363ad7c6dc0d7c32765329dcf3d5 /odoo/fields.py
parentd8eaa852fa1fc154303f71554ee4411c6454426d (diff)
[FIX] core: writing on one2many field on new record
When using command "6" (SET), the one2many field's inverse was not assigned on the lines. closes odoo/odoo#65656 X-original-commit: 330b885c4fd8570429d1cc4b59db1be00c26507b Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Diffstat (limited to 'odoo/fields.py')
-rw-r--r--odoo/fields.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/odoo/fields.py b/odoo/fields.py
index f541ea008cd..126108fc12b 100644
--- a/odoo/fields.py
+++ b/odoo/fields.py
@@ -3303,11 +3303,14 @@ class One2many(_RelationalMulti):
browse([command[1]])[inverse] = False
elif command[0] == 4:
browse([command[1]])[inverse] = recs[-1]
- elif command[0] in (5, 6):
+ elif command[0] == 5:
+ cache.update(recs, self, itertools.repeat(()))
+ elif command[0] == 6:
# assign the given lines to the last record only
- cache.update(recs, self, [()] * len(recs))
- lines = comodel.browse(command[2] if command[0] == 6 else [])
- cache.set(recs[-1], self, lines._ids)
+ cache.update(recs, self, itertools.repeat(()))
+ last, lines = recs[-1], browse(command[2])
+ cache.set(last, self, lines._ids)
+ cache.update(lines, inverse_field, itertools.repeat(last.id))
else:
def link(record, lines):