get_object_reference是 ir.model.data 模块中下的一个函数

该函数通过调用ir.model.data 模块中另外一个函数 xmlid_lookup 返回结果


def get_object_reference(self, cr, uid, module, xml_id):
"""Returns (model, res_id) corresponding to a given module and xml_id (cached) or raise ValueError if not found"""
return self.xmlid_lookup(cr, uid, "%s.%s" % (module, xml_id))[1:3]
# NEW V8 API
@tools.ormcache(skiparg=3)
def xmlid_lookup(self, cr, uid, xmlid):
"""Low level xmlid lookup
Return (id, res_model, res_id) or raise ValueError if not found
"""
module, name = xmlid.split('.', 1)
ids = self.search(cr, uid, [('module','=',module), ('name','=', name)])
if not ids:
raise ValueError('External ID not found in the system: %s' % (xmlid))
# the sql constraints ensure us we have only one result
res = self.read(cr, uid, ids[0], ['model', 'res_id'])
if not res['res_id']:
raise ValueError('External ID not found in the system: %s' % (xmlid))
return ids[0], res['model'], res['res_id']

返回的是  xml  视图id   model  res_id

实例:

@api.multi
def popup_wizard( self ):
if self._context is None:
self._context = {}
ir_model_data = self.env['ir.model.data']
try:
compose_form_id = ir_model_data.get_object_reference( 'ir_export_extended_ept', 'export_wizard_view_ept' )[1]
except ValueError:
compose_form_id = False
return {
'name': _( 'Export File' ),
'res_model': 'export.wizard.ept',
'type': 'ir.actions.act_window',
'view_id': compose_form_id,
'view_mode': 'form',
'view_type': 'form',
'target': 'new',
}

在odoo里有很多类似例子,用它来返回一个form视图

odoo 下 get_object_reference 函数的更多相关文章

  1. linux和window下mkdir函数问题(转-锦曦月)

    通过WIN32宏进行判断   window下mkdir函数   #include<direct.h> int _mkdir( const char *dirname );   linux下 ...

  2. linux下syscall函数,SYS_gettid,SYS_tgkill

    出处:http://blog.chinaunix.net/uid-28458801-id-4630215.html     linux下syscall函数,SYS_gettid,SYS_tgkill  ...

  3. hdwiki model目录下的函数类

    model目录下的函数类    actions.class.php(站内地图相关) getHTML:获得页面菜单和相关信息 getMap:生成站内地图 adv.class.php 对wiki_adve ...

  4. 对于linux下system()函数的深度理解(整理)

    原谅: http://blog.sina.com.cn/s/blog_8043547601017qk0.html 这几天调程序(嵌入式linux),发现程序有时就莫名其妙的死掉,每次都定位在程序中不同 ...

  5. windows 下实现函数打桩:拦截API方式

    windows 下实现函数打桩:拦截API方式            近期由于工作须要,開始研究函数打桩的方法. 由于不想对project做过多的改动,于是放弃了使用Google gmock的想法. ...

  6. Linux下c函数dlopen实现加载动态库so文件代码举例

    dlopen()是一个强大的库函数.该函数将打开一个新库,并把它装入内存.该函数主要用来加载库中的符号,这些符号在编译的时候是不知道的.这种机制使得在系统中添加或者删除一个模块时,都不需要重新编译了. ...

  7. linux和window下mkdir函数

    通过WIN32宏进行判断   window下mkdir函数   #include<direct.h> int _mkdir( const char *dirname );   linux下 ...

  8. 转:对于linux下system()函数的深度理解(整理)

    这几天调程序(嵌入式linux),发现程序有时就莫名其妙的死掉,每次都定位在程序中不同的system()函数,直接在shell下输入system()函数中调用的命令也都一切正常.就没理这个bug,以为 ...

  9. 【C/C++】Linux下system()函数引发的错误

    http://my.oschina.net/renhc/blog/54582 [C/C++]Linux下system()函数引发的错误 恋恋美食  恋恋美食 发布时间: 2012/04/21 11:3 ...

随机推荐

  1. PAT_A1094#The Largest Generation

    Source: PAT A1094 The Largest Generation (25 分) Description: A family hierarchy is usually presented ...

  2. iBATIS结果映射

    resultMap的元素是在iBATIS的最重要和最强大的元素.您可以通过使用iBATIS的结果映射减少高达90%的JDBC编码,在某些情况下,可以让你做JDBC不支持的事情. ResultMaps的 ...

  3. Lucene 搜索方式

    Lucene 的搜索方式包括:词项查询(TermQuery) / 布尔查询(BooleanQuery) / 短语查询(PhraseQuery) / 范围查询(RangeQuery) / 百搭查询(Wi ...

  4. identityserver4 对接钉钉

    参考了https://www.cnblogs.com/sheldon-lou/p/10643267.html

  5. docker集群管理之kubernetes

    一.简介 kubernetes又叫做k8s,是Google开发的一款开源的docker集群管理工具,在这里对它的“发家史”,我不做过多的阐述,有时间大家可以自己去百度一下: 下面我要讲的就是容易混淆的 ...

  6. java 一维数组的输出方式

    1.使用传统的for()循环输出: //定义一个数组 int []array = {1,2,3,4,5}; for(int i=0;i<array.length;i++) { System.ou ...

  7. Rsync 参数

    # rsync -v, --verbose 详细模式输出 -q, --quiet 精简输出模式 -c, --checksum 打开校验开关,强制对文件传输进行校验 -a, --archive 归档模式 ...

  8. Spring Boot环境搭建。

    1.环境准备. jdk1.8 idea(如果不会激活可以看另外一篇:https://www.cnblogs.com/joeking/p/11119123.html) 2.打开idea 如果是idea的 ...

  9. ac与ap同步分析

    1 ApStatusRequest : ap把自己的状态发过来做请求  就相当于自我介绍 网关上抓包 : tcpdump -ni br-lan tcp port 8090   -Avv / -w po ...

  10. Nlog 日志框架简单教程

    安装 Nuget获取 配置寻找 会自动寻找在应用程序目录下的NLog.config(大小写敏感) 如何配置config <?xml version="1.0" encodin ...