[FIX] nuke ir.model.data caches before starting imports
Otherwise a previous validation (or 2) will poison the cache and the import itself will fail even though the validation succeeeded (and importing with no validation would have succeeded), as the orm cache doesn't take DB rollbacks in account. bzr revid: xmo@openerp.com-20121109113951-p3qgg6m5g7poay5e
This commit is contained in:
parent
d3b22ccb36
commit
4a4fc38d5e
|
@ -878,11 +878,18 @@ class ir_model_data(osv.osv):
|
|||
id = False
|
||||
return id
|
||||
|
||||
def clear_caches(self):
|
||||
""" Clears all orm caches on the object's methods
|
||||
|
||||
:returns: itself
|
||||
"""
|
||||
self._get_id.clear_cache(self)
|
||||
self.get_object_reference.clear_cache(self)
|
||||
return self
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
""" Regular unlink method, but make sure to clear the caches. """
|
||||
self._get_id.clear_cache(self)
|
||||
self.get_object_reference.clear_cache(self)
|
||||
self.clear_caches()
|
||||
return super(ir_model_data,self).unlink(cr, uid, ids, context=context)
|
||||
|
||||
def _update(self,cr, uid, model, module, values, xml_id=False, store=True, noupdate=False, mode='init', res_id=False, context=None):
|
||||
|
|
|
@ -1325,7 +1325,8 @@ class BaseModel(object):
|
|||
messages = []
|
||||
|
||||
fields = map(fix_import_export_id_paths, fields)
|
||||
ModelData = self.pool['ir.model.data']
|
||||
ModelData = self.pool['ir.model.data'].clear_caches()
|
||||
|
||||
fg = self.fields_get(cr, uid, context=context)
|
||||
|
||||
mode = 'init'
|
||||
|
|
Loading…
Reference in New Issue