From 066fb143260858ca49091c41d3b0062a12f8e55a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Mon, 19 May 2014 18:12:41 +0200 Subject: [PATCH] [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. --- openerp/osv/orm.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py index ac9e67b7876..2341b92e169 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -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)