[FIX] ir.model.data: verify record exists in _update_dummy
When a stale XML ID exists in the database, `_update_dummy()` must consider it as missing entirely, and the next call to `_update()` will take care of cleaning up the old XML ID. Failing to do so for `noupdate` records means the `_update` will never happen, and as soon as another record is created or updated with a relationship to that stale XML ID, it will plainly crash the installation/update.
This commit is contained in:
parent
a3c369f53f
commit
740bf28907
|
@ -985,11 +985,15 @@ class ir_model_data(osv.osv):
|
||||||
def _update_dummy(self,cr, uid, model, module, xml_id=False, store=True):
|
def _update_dummy(self,cr, uid, model, module, xml_id=False, store=True):
|
||||||
if not xml_id:
|
if not xml_id:
|
||||||
return False
|
return False
|
||||||
try:
|
|
||||||
id = self.read(cr, uid, [self._get_id(cr, uid, module, xml_id)], ['res_id'])[0]['res_id']
|
|
||||||
self.loads[(module,xml_id)] = (model,id)
|
|
||||||
except:
|
|
||||||
id = False
|
id = False
|
||||||
|
try:
|
||||||
|
# One step to check the ID is defined and the record actually exists
|
||||||
|
record = self.get_object(cr, uid, module, xml_id)
|
||||||
|
if record:
|
||||||
|
id = record.id
|
||||||
|
self.loads[(module,xml_id)] = (model,id)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
return id
|
return id
|
||||||
|
|
||||||
def clear_caches(self):
|
def clear_caches(self):
|
||||||
|
|
Loading…
Reference in New Issue