odoo8 or openerp 通过xml id获取数据库id
发布时间:2020-12-16 08:11:25 所属栏目:百科 来源:网络整理
导读:How to get the Database Id from an XML Id The ir.model.data model also has a get_object() method returning a browsable record given a model name and an xml_id. So,another solution could be: m = self.pool.get('ir.model.data')id = m.get_obje
How to get the Database Id from an XML Id
The ir.model.data model also has a get_object() method returning a browsable record given a model name and an xml_id.
So,another solution could be:
m = self.pool.get('ir.model.data') id = m.get_object(cr,uid,'base','user_root').id get_object(cr,module,xml_id) module是路径名字,xml_id就是 xml文件中<record id='xxxx'/>中的id (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |