[FIX] ir.model.data#_update() should honor the noupdate flag
In `init` mode, a record can still be filled with multiple record nodes with the first node being in a data@noupdate="1" and the other nodes without @noupdate attribute but this won't be the case anymore in `update` mode bzr revid: fme@openerp.com-20131216144304-2e8b9xvoks2fvlj9
This commit is contained in:
parent
f6a5800d59
commit
a859a53e72
|
@ -934,12 +934,15 @@ class ir_model_data(osv.osv):
|
|||
return False
|
||||
action_id = False
|
||||
if xml_id:
|
||||
cr.execute('''SELECT imd.id, imd.res_id, md.id, imd.model
|
||||
cr.execute('''SELECT imd.id, imd.res_id, md.id, imd.model, imd.noupdate
|
||||
FROM ir_model_data imd LEFT JOIN %s md ON (imd.res_id = md.id)
|
||||
WHERE imd.module=%%s AND imd.name=%%s''' % model_obj._table,
|
||||
(module, xml_id))
|
||||
results = cr.fetchall()
|
||||
for imd_id2,res_id2,real_id2,real_model in results:
|
||||
for imd_id2,res_id2,real_id2,real_model,noupdate_imd in results:
|
||||
# In update mode, do not update a record if it's ir.model.data is flagged as noupdate
|
||||
if mode == 'update' and noupdate_imd:
|
||||
return res_id2
|
||||
if not real_id2:
|
||||
self._get_id.clear_cache(self)
|
||||
self.get_object_reference.clear_cache(self)
|
||||
|
|
|
@ -773,6 +773,9 @@ form: module.record_id""" % (xml_id,)
|
|||
if rec_context:
|
||||
rec_context = unsafe_eval(rec_context)
|
||||
self._test_xml_id(rec_id)
|
||||
# in update mode, the record won't be updated if the data node explicitely
|
||||
# opt-out using @noupdate="1". A second check will be performed in
|
||||
# ir.model.data#_update() using the record's ir.model.data `noupdate` field.
|
||||
if self.isnoupdate(data_node) and self.mode != 'init':
|
||||
# check if the xml record has an id string
|
||||
if rec_id:
|
||||
|
|
Loading…
Reference in New Issue