diff options
| author | Raphael Collet <rco@odoo.com> | 2017-08-09 15:38:29 +0200 |
|---|---|---|
| committer | Christophe Matthieu <chm@odoo.com> | 2017-08-30 14:38:29 +0200 |
| commit | 6cf98c4c87d644928897a76b9985947ab2ebc607 (patch) | |
| tree | fed1b52989b4b6731926ba080b790d0c222050ac /odoo/fields.py | |
| parent | 7e3f8f2140fb174c7dcd3b970862966690de4252 (diff) | |
[IMP] models: in `onchange`, keep track of virtual ids of new records
The x2many "create" command is now like: `(0, ref, vals)`, where `ref` is an
arbitrary reference that may be used to identify a new line in the relation.
The reference is returned in a similar command by the method `onchange`.
`onchange` now supports self-modifying x2many fields.
Diffstat (limited to 'odoo/fields.py')
| -rw-r--r-- | odoo/fields.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/odoo/fields.py b/odoo/fields.py index 43ee8edbad1..d5638541b48 100644 --- a/odoo/fields.py +++ b/odoo/fields.py @@ -2028,7 +2028,7 @@ class _RelationalMulti(_Relational): for command in value: if isinstance(command, (tuple, list)): if command[0] == 0: - ids.add(comodel.new(command[2]).id) + ids.add(comodel.new(command[2], command[1]).id) elif command[0] == 1: comodel.browse(command[1]).update(command[2]) ids.add(command[1]) @@ -2085,7 +2085,7 @@ class _RelationalMulti(_Relational): for record in value: vals = {name: convert(record[name], record) for name, convert in converters} if not record.id: - result.append((0, 0, vals)) + result.append((0, record.id.ref or 0, vals)) elif vals: result.append((1, record.id, vals)) else: |
