summaryrefslogtreecommitdiff
path: root/odoo/fields.py
diff options
context:
space:
mode:
Diffstat (limited to 'odoo/fields.py')
-rw-r--r--odoo/fields.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/odoo/fields.py b/odoo/fields.py
index 64f2cb01edd..e1bf6331df8 100644
--- a/odoo/fields.py
+++ b/odoo/fields.py
@@ -2650,7 +2650,10 @@ class Many2one(_Relational):
# value is either a pair (id, name), or a tuple of ids
id_ = value[0] if value else None
elif isinstance(value, dict):
- id_ = record.env[self.comodel_name].new(value).id
+ # return a new record (with the given field 'id' as origin)
+ comodel = record.env[self.comodel_name]
+ origin = comodel.browse(value.get('id'))
+ id_ = comodel.new(value, origin=origin).id
else:
id_ = None