From fe13a01ae9809a0f2c9297a079d5ba00d7d2b2ce Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Wed, 3 Sep 2008 11:47:31 +0200 Subject: [PATCH] views: id's with a dot must refer a installed module bzr revid: christophe@tinyerp.com-20080903094731-5j3mgzsvmzzabeay --- bin/tools/convert.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bin/tools/convert.py b/bin/tools/convert.py index 7588ca2f1cc..d62648f4830 100644 --- a/bin/tools/convert.py +++ b/bin/tools/convert.py @@ -226,12 +226,16 @@ class xml_import(object): def _test_xml_id(self, xml_id): id = xml_id if '.' in xml_id: - assert len(id.split('.'))==2, """The ID reference '"%s" must contains + module, id = xml_id.split('.', 1) + assert '.' not in id, """The ID reference "%s" must contains maximum one dot. They are used to refer to other modules ID, in the form: module.record_id""" % (xml_id,) - base, id = xml_id.split('.') + if module != self.module: + modcnt = self.pool.get('ir.module.module').search_count(self.cr, self.uid, ['&', ('name', '=', module), ('state', 'in', ['installed'])]) + assert modcnt == 1, """The ID "%s" refer to an uninstalled module""" % (xml_id,) + if len(id) > 64: - self.logger.notifyChannel('init', netsvc.LOG_ERROR, 'id: %s is to long (max: 64)'%xml_id) + self.logger.notifyChannel('init', netsvc.LOG_ERROR, 'id: %s is to long (max: 64)'% (id,)) def _tag_delete(self, cr, rec, data_node=None): d_model = rec.getAttribute("model")