How to get the url of a page in OpenERP?

User is using OpenERP. I have a button on one web page. The button's action function is action_go() (code provided). When I click on a button, the code opens a new web page in a new tab in browser. Now, I want, in the button action handler function, action_go(), to read current IP address so I can make the new url to launch it with the button (code for that url provided)

Here is the code that uses url:

class mrp_bom_line(osv.osv):
_inherit = 'mrp.bom.line' def action_go(self, cr, uid, ids, context=None):
bom_obj = self.pool.get('mrp.bom')
ip_address = '127.0.0.1:8069'
url = 'http://' + ip_address + '/web#id=%s&view_type=form&model=mrp.bom&menu_id=448&action=565'
for bom_line in self.browse(cr, uid, ids, context=context):
if bom_line.product_id.default_code > '300':
bom_ids = bom_obj.search(cr, uid, [('product_id', '=', bom_line.product_id.id)], context=context)
if bom_ids:
return {'type': 'ir.actions.act_url',
'res_model': 'ir.actions.act_url',
# 'url':'http://127.0.0.1:8069/web#id=%s&view_type=form&model=mrp.bom&action=452' % bom_ids[0] ,
'url':url % bom_ids[0] ,
'nodestroy': True,
'target': 'new_tab'} return True

How to get the url of a page in OpenERP?的更多相关文章

  1. URL重写 urlrouting

    在global文件中添加以下的代码 <%@ Import Namespace="System.Web.Routing" %> <script RunAt=&quo ...

  2. Page Object Model (Selenium, Python)

    时间 2015-06-15 00:11:56  Qxf2 blog 原文  http://qxf2.com/blog/page-object-model-selenium-python/ 主题 Sel ...

  3. Net4.0---AspNet中URL重写的改进(转载)

    转载地址:http://www.cnblogs.com/oec2003/archive/2010/07/27/1785862.html URL重写有很多的好处,如有利于SEO.便于记忆.隐藏真实路径使 ...

  4. Python脚本控制的WebDriver 常用操作 <六> 打印当前页面的title及url

    下面将使用WebDriver来答应浏览器页面的title和访问的地址信息 测试用例场景 测试中,访问1个页面然后判断其title是否符合预期是很常见的1个用例: 假设1个页面的title应该是'hel ...

  5. 避免url传值字符串sjstr过长,使用from表单【隐藏域】post提交

    1.普通的url传值<html--------------- <!-- 隐藏域post提交url --> <form id="urlPost" action ...

  6. python下载文件(图片)源码,包含爬网内容(爬url),可保存cookie

    #coding=utf-8 ''' Created on 2013-7-17 @author: zinan.zhang ''' import re import time import httplib ...

  7. django url调度

    Django的url配置相同遵循着DRY(dont repeat yourself)的规则.下面都是官方文档的样例: 首先介绍的是Django怎样处理http的请求: 1.在setting里定义ROO ...

  8. Django的URL路由

    URL配置(URLconf)就像Django 所支撑网站的目录.它的本质是URL模式以及要为该URL模式调用的视图函数之间的映射表:你就是以这种方式告诉Django,对于这个URL调用这段代码,对于那 ...

  9. Django的url使用方法

    利用Django开发站点.能够设计出很优美的url规则,假设url的匹配规则(包括正則表達式)组织得比較好,view的结构就会比較清晰.比較easy维护. 最简单的形式 from django.con ...

随机推荐

  1. 网关协议:CGI、FastCGI、WSGI

    CGI就像是一座桥,把网页和WEB服务器中的执行程序连接起来,它把HTML接收的指令传递给服务器的执行程序,再把服务器执行程序的结果返还给HTML页. CGI CGI即通用网关接口(Common Ga ...

  2. hdu 1147(线段相交)

    Pick-up sticks Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)To ...

  3. redis的持久化(RDB&AOF的区别)

    RDB 是什么? 在指定的时间间隔内将内存中的数据集快照写入磁盘, 也就是行话讲的Snapshot快照,它恢复时是将快照文件直接读到内存里. Redis会单独创建(fork)一个子进程来进行持久化,会 ...

  4. 分分钟搞定 JSP 技术

    一.JSP的语法    1.模版元素        写在JSP中的html内容        在翻译后的Servlet中, 直接被out.write原样输出 2.JSP脚本表达式        格式: ...

  5. VisualStudio 2013开发Office插件

    在VS中选择创建新项目,选择App for Office 选择mail出现的位置 Task pane The app appears in the task pane of a Microsift O ...

  6. docker 与 yarn

    有时我们的项目是使用yarn去发布的,当需要使用docker发布这个项目时,安装yarn是必须的,但是平时使用的npm install -g yarn此时却不可用 从网站上找到解决的方法 地址:htt ...

  7. BZOJ 3223: Tyvj 1729 文艺平衡树-Splay树(区间翻转)模板题

    3223: Tyvj 1729 文艺平衡树 Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 6881  Solved: 4213[Submit][Sta ...

  8. python——入门系列(一)索引与切片

    1.索引和切片:python当中数组的索引和其他语言一样,从0~n-1,使用索引的方法也是中括号,但是python中的切片的使用简化了代码 索引:取出数组s中第3个元素:x=s[2] 切片:用极少的代 ...

  9. LCA+差分【p4427】[BJOI2018]求和

    Description master 对树上的求和非常感兴趣.他生成了一棵有根树,并且希望多次询问这棵树上一段路径上所有节点深度的\(k\) 次方和,而且每次的\(k\) 可能是不同的.此处节点深度的 ...

  10. SQL*Loader-605: Non-data dependent ORACLE error occurred — load discontinued

    It seems the tablespace is full.