From 1896ef488b387b399228578bbab3c0f3c836e662 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Mon, 17 Jan 2011 19:44:53 +0100 Subject: [PATCH] [FIX] ir.model.data: ensure cache of known "model data reference ids" is not lost after osv inheritance By storing this cache in the pool and only referencing it in the instance we ensure that it is not lost when the osv instance is replaced in the pool, e.g. as soon as on osv object inherits from ir.model.data. This is now needed, as the module data cleanup is now done globally at the end of all module installation, while it was done on a smaller scale before (leading to other kinds of issues). lp bug: https://launchpad.net/bugs/704051 fixed lp bug: https://launchpad.net/bugs/701644 fixed bzr revid: odo@openerp.com-20110117184453-kxvbuzmuge6u1mh4 --- bin/addons/base/ir/ir_model.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/addons/base/ir/ir_model.py b/bin/addons/base/ir/ir_model.py index abbcec9130a..b054fd0e0db 100644 --- a/bin/addons/base/ir/ir_model.py +++ b/bin/addons/base/ir/ir_model.py @@ -554,10 +554,14 @@ class ir_model_data(osv.osv): def __init__(self, pool, cr): osv.osv.__init__(self, pool, cr) - self.loads = {} self.doinit = True self.unlink_mark = {} + # also stored in pool to avoid being discarded along with this osv instance + if getattr(pool, 'model_data_reference_ids', None) is None: + self.pool.model_data_reference_ids = {} + self.loads = self.pool.model_data_reference_ids + def _auto_init(self, cr, context=None): super(ir_model_data, self)._auto_init(cr, context) cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'ir_model_data_module_name_index\'')