summaryrefslogtreecommitdiff
path: root/odoo/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'odoo/models.py')
-rw-r--r--odoo/models.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/odoo/models.py b/odoo/models.py
index 3fa61eb728d..6834dca5b6a 100644
--- a/odoo/models.py
+++ b/odoo/models.py
@@ -4919,15 +4919,16 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})):
done = set()
# dummy assignment: trigger invalidations on the record
- for name in todo:
- if name == 'id':
- continue
- value = record[name]
- field = self._fields[name]
- if field.type == 'many2one' and field.delegate and not value:
- # do not nullify all fields of parent record for new records
- continue
- record[name] = value
+ with env.do_in_onchange():
+ for name in todo:
+ if name == 'id':
+ continue
+ value = record[name]
+ field = self._fields[name]
+ if field.type == 'many2one' and field.delegate and not value:
+ # do not nullify all fields of parent record for new records
+ continue
+ record[name] = value
result = {}
dirty = set()