[FIX] orm: unlink: when unlinking a record, trigger the computing of

function fields for other records in the same model. Previously all function fields in the
current model were not computed for some reason not provided by the history.

We therefore compute effective store_ids on which the various trigerred
function fields will be computed again. Those ids are the ids given
in the store_get storage variable minus the deleted ones.
This commit is contained in:
Thibault Delavallée 2014-05-19 18:12:41 +02:00
parent d5ca324cd5
commit 066fb14326
1 changed files with 6 additions and 2 deletions

View File

@ -4067,9 +4067,13 @@ class BaseModel(object):
ir_values_obj.unlink(cr, uid, ir_value_ids, context=context)
for order, object, store_ids, fields in result_store:
if object != self._name:
if object == self._name:
effective_store_ids = list(set(store_ids) - set(ids))
else:
effective_store_ids = store_ids
if effective_store_ids:
obj = self.pool.get(object)
cr.execute('select id from '+obj._table+' where id IN %s', (tuple(store_ids),))
cr.execute('select id from '+obj._table+' where id IN %s', (tuple(effective_store_ids),))
rids = map(lambda x: x[0], cr.fetchall())
if rids:
obj._store_set_values(cr, uid, rids, fields, context)