[FIX] models: stored func fields computation on one2many write
On one2many fields writing in an existing record (not when creating new record), the computed stored fields of the one2many were not re-computed correctly Computed stored fields were marked as modified only if no_store_function was not set to True in the context. no_store_function is set when writing one2many records on an existing record. Now, these computed stored fields are marked as to be recomputed, but are recomputed later, at the end of the existing record write
This commit is contained in:
parent
3eaa2f8371
commit
d0a2b6b3da
|
@ -4109,6 +4109,12 @@ class BaseModel(object):
|
|||
# check Python constraints
|
||||
recs._validate_fields(vals)
|
||||
|
||||
# Mark new-style fields to recompute
|
||||
modified_fields = list(vals)
|
||||
if self._log_access:
|
||||
modified_fields += ['create_uid', 'create_date', 'write_uid', 'write_date']
|
||||
recs.modified(modified_fields)
|
||||
|
||||
if not context.get('no_store_function', False):
|
||||
result += self._store_get_values(cr, user, [id_new],
|
||||
list(set(vals.keys() + self._inherits.values())),
|
||||
|
@ -4119,12 +4125,7 @@ class BaseModel(object):
|
|||
if not (model_name, ids, fields2) in done:
|
||||
self.pool[model_name]._store_set_values(cr, user, ids, fields2, context)
|
||||
done.append((model_name, ids, fields2))
|
||||
|
||||
# recompute new-style fields
|
||||
modified_fields = list(vals)
|
||||
if self._log_access:
|
||||
modified_fields += ['create_uid', 'create_date', 'write_uid', 'write_date']
|
||||
recs.modified(modified_fields)
|
||||
recs.recompute()
|
||||
|
||||
if self._log_create and not (context and context.get('no_store_function', False)):
|
||||
|
|
Loading…
Reference in New Issue