[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
This commit is contained in:
Olivier Dony 2011-01-17 19:44:53 +01:00
parent 3d4d87b718
commit 1896ef488b
1 changed files with 5 additions and 1 deletions

View File

@ -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\'')