[FIX] Model.create: trigger stored field recalculation for implicit parent_id fields during create

The create() method implicitly creates parent records on objects of the _inherits.
Therefore, in order to make the trigger on the linked field works, we should
include all the _inherits values (fields that make the link to the parent
record) because they are created implicitly.
The write() method does not need this change, as any update of the parent
fields has to be explicit.

bzr revid: odo@openerp.com-20131209184718-wczdefzo9evc0cgc
This commit is contained in:
Cecile Tonglet 2013-12-09 19:47:18 +01:00 committed by Olivier Dony
commit 86776035ba
1 changed files with 3 additions and 1 deletions

View File

@ -4487,7 +4487,9 @@ class BaseModel(object):
self._validate(cr, user, [id_new], context)
if not context.get('no_store_function', False):
result += self._store_get_values(cr, user, [id_new], vals.keys(), context)
result += self._store_get_values(cr, user, [id_new],
list(set(vals.keys() + self._inherits.values())),
context)
result.sort()
done = []
for order, object, ids, fields2 in result: