[FIX] xml importation: all tags handle the 'noupdate' attribute

lp bug: https://launchpad.net/bugs/302646 fixed

bzr revid: christophe@tinyerp.com-20081127124450-n8lj6uq2xqv87n6u
This commit is contained in:
Christophe Simonis 2008-11-27 13:44:50 +01:00
parent 1f6fbb3671
commit 95e0019e09
1 changed files with 11 additions and 11 deletions

View File

@ -282,7 +282,7 @@ form: module.record_id""" % (xml_id,)
groups_value.append((4, group_id))
res['groups_id'] = groups_value
id = self.pool.get('ir.model.data')._update(cr, self.uid, "ir.actions.report.xml", self.module, res, xml_id, mode=self.mode)
id = self.pool.get('ir.model.data')._update(cr, self.uid, "ir.actions.report.xml", self.module, res, xml_id, noupdate=self.isnoupdate(data_node), mode=self.mode)
self.idref[xml_id] = int(id)
if not rec.hasAttribute('menu') or eval(rec.getAttribute('menu')):
keyword = str(rec.getAttribute('keyword') or 'client_print_multi')
@ -322,7 +322,7 @@ form: module.record_id""" % (xml_id,)
groups_value.append((4, group_id))
res['groups_id'] = groups_value
id = self.pool.get('ir.model.data')._update(cr, self.uid, "ir.actions.wizard", self.module, res, xml_id, mode=self.mode)
id = self.pool.get('ir.model.data')._update(cr, self.uid, "ir.actions.wizard", self.module, res, xml_id, noupdate=self.isnoupdate(data_node), mode=self.mode)
self.idref[xml_id] = int(id)
# ir_set
if (not rec.hasAttribute('menu') or eval(rec.getAttribute('menu'))) and id:
@ -343,7 +343,7 @@ form: module.record_id""" % (xml_id,)
res = {'name': name, 'url': url, 'target':target}
id = self.pool.get('ir.model.data')._update(cr, self.uid, "ir.actions.url", self.module, res, xml_id, mode=self.mode)
id = self.pool.get('ir.model.data')._update(cr, self.uid, "ir.actions.url", self.module, res, xml_id, noupdate=self.isnoupdate(data_node), mode=self.mode)
self.idref[xml_id] = int(id)
# ir_set
if (not rec.hasAttribute('menu') or eval(rec.getAttribute('menu'))) and id:
@ -414,7 +414,7 @@ form: module.record_id""" % (xml_id,)
if rec.hasAttribute('target'):
res['target'] = rec.getAttribute('target')
id = self.pool.get('ir.model.data')._update(cr, self.uid, 'ir.actions.act_window', self.module, res, xml_id, mode=self.mode)
id = self.pool.get('ir.model.data')._update(cr, self.uid, 'ir.actions.act_window', self.module, res, xml_id, noupdate=self.isnoupdate(data_node), mode=self.mode)
self.idref[xml_id] = int(id)
if src_model:
@ -562,7 +562,7 @@ form: module.record_id""" % (xml_id,)
xml_id = rec.getAttribute('id').encode('utf8')
self._test_xml_id(xml_id)
pid = self.pool.get('ir.model.data')._update(cr, self.uid, 'ir.ui.menu', self.module, values, xml_id, True, mode=self.mode, res_id=res and res[0] or False)
pid = self.pool.get('ir.model.data')._update(cr, self.uid, 'ir.ui.menu', self.module, values, xml_id, noupdate=self.isnoupdate(data_node), mode=self.mode, res_id=res and res[0] or False)
if rec_id and pid:
self.idref[rec_id] = int(pid)
@ -752,15 +752,17 @@ form: module.record_id""" % (xml_id,)
raise
return True
def __init__(self, cr, module, idref, mode, report=assertion_report(), noupdate = False):
def __init__(self, cr, module, idref, mode, report=None, noupdate=False):
self.logger = netsvc.Logger()
self.mode = mode
self.module = module
self.cr = cr
self.idref = idref
self.pool = pooler.get_pool(cr.dbname)
# self.pool = osv.osv.FakePool(module)
self.uid = 1
if report is None:
report = assertion_report()
self.assert_report = report
self.noupdate = noupdate
self._tags = {
@ -830,7 +832,7 @@ def convert_csv_import(cr, module, fname, csvcontent, idref=None, mode='init',
#
# xml import/export
#
def convert_xml_import(cr, module, xmlfile, idref=None, mode='init', noupdate = False, report=None):
def convert_xml_import(cr, module, xmlfile, idref=None, mode='init', noupdate=False, report=None):
xmlstr = xmlfile.read()
xmlfile.seek(0)
relaxng_doc = etree.parse(file(os.path.join( config['root_path'], 'import_xml.rng' )))
@ -847,9 +849,7 @@ def convert_xml_import(cr, module, xmlfile, idref=None, mode='init', noupdate =
if idref is None:
idref={}
if report is None:
report=assertion_report()
obj = xml_import(cr, module, idref, mode, report=report, noupdate = noupdate)
obj = xml_import(cr, module, idref, mode, report=report, noupdate=noupdate)
obj.parse(xmlstr)
del obj
return True