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. 《锋利的JQuery》读书要点笔记2——DOM操作

    第三章 jQuery中的DOM操作 3.1 DOM(Document Object Model)操作的分类 1. DOM Core    例如:document.getElementsByTagNam ...

  2. 通过docker info命令,可以了解很多信息

    来个输出吧. Containers: 1 Running: 1 Paused: 0 Stopped: 0 Images: 1 Server Version: 17.03.1-ce Storage Dr ...

  3. Codeforces 810 A.Straight «A»

    A. Straight «A»   time limit per test 1 second memory limit per test 256 megabytes input standard in ...

  4. E - A strange lift 【数值型BFS+上下方向】

    There is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(0 ...

  5. 训练指南 UVALive - 3989(稳定婚姻问题)

    ayout: post title: 训练指南 UVALive - 3989(稳定婚姻问题) author: "luowentaoaa" catalog: true mathjax ...

  6. date conversion

    SELECT to_char(sysdate,'yyyymmdd hh:mi:ss'), to_char(sysdate ,'yyyymmdd hh:mi:ss'), to_char(sysdate ...

  7. RPD Volume 172 Issue 1-3 December 2016 评论01

    Evaluation of Imaging Dose From Different Image Guided Systems During Head and Neck Radiotherapy: A ...

  8. [Codeforces 8D] Two Friends

    Brief Introduction: 有两人a.b,他们都在A点,a经过B点到C点,而b直接到C点.a走过的距离不超过la,b走过距离不超过lb,询问他们可能经过最长的公共距离. Algorithm ...

  9. POJ 3532 Resistance(高斯消元+基尔霍夫定理)

    [题目链接] http://poj.org/problem?id=3532 [题目大意] 给出n个点,一些点之间有电阻相连,求1~n的等效电阻 [题解] 有基尔霍夫定理:任何一个点(除起点和终点)发出 ...

  10. 【费用流】bzoj2661 [BeiJing wc2012]连连看

    将每个数拆点,互相连边,然后满足条件的数对之间互相连边,跑最大费用流,答案是流量和费用分别除以2. 一定要i->j.j->i都连上,否则可能会出现一个数在一边被选择了,在另一边的另一个匹配 ...