[FIX] models: avoid wild prefetching when serializing onchange results

We fell on a strange situation in method `onchange`, where some data was
missing from cache when serializing the result. In that case, the
prefetching
overwrites so many stuff in cache that the results of the onchanges are
lost.
Don't let that happen.
This commit is contained in:
rco-odoo
2018-01-29 17:16:27 +01:00
committed by jem-odoo
parent 2f7593761c
commit 5f660cdb28
+5 -4
View File
@@ -5031,10 +5031,11 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})):
subtree = subtree[name]
# collect values from dirty fields
result['value'] = {
name: self._fields[name].convert_to_onchange(record[name], record, subnames[name])
for name in dirty
}
with env.do_in_onchange():
result['value'] = {
name: self._fields[name].convert_to_onchange(record[name], record, subnames[name])
for name in dirty
}
return result