diff options
Diffstat (limited to 'odoo/fields.py')
| -rw-r--r-- | odoo/fields.py | 11 |
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): |
