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