How to get the url of a page in OpenERP?
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?的更多相关文章
- URL重写 urlrouting
在global文件中添加以下的代码 <%@ Import Namespace="System.Web.Routing" %> <script RunAt=&quo ...
- Page Object Model (Selenium, Python)
时间 2015-06-15 00:11:56 Qxf2 blog 原文 http://qxf2.com/blog/page-object-model-selenium-python/ 主题 Sel ...
- Net4.0---AspNet中URL重写的改进(转载)
转载地址:http://www.cnblogs.com/oec2003/archive/2010/07/27/1785862.html URL重写有很多的好处,如有利于SEO.便于记忆.隐藏真实路径使 ...
- Python脚本控制的WebDriver 常用操作 <六> 打印当前页面的title及url
下面将使用WebDriver来答应浏览器页面的title和访问的地址信息 测试用例场景 测试中,访问1个页面然后判断其title是否符合预期是很常见的1个用例: 假设1个页面的title应该是'hel ...
- 避免url传值字符串sjstr过长,使用from表单【隐藏域】post提交
1.普通的url传值<html--------------- <!-- 隐藏域post提交url --> <form id="urlPost" action ...
- python下载文件(图片)源码,包含爬网内容(爬url),可保存cookie
#coding=utf-8 ''' Created on 2013-7-17 @author: zinan.zhang ''' import re import time import httplib ...
- django url调度
Django的url配置相同遵循着DRY(dont repeat yourself)的规则.下面都是官方文档的样例: 首先介绍的是Django怎样处理http的请求: 1.在setting里定义ROO ...
- Django的URL路由
URL配置(URLconf)就像Django 所支撑网站的目录.它的本质是URL模式以及要为该URL模式调用的视图函数之间的映射表:你就是以这种方式告诉Django,对于这个URL调用这段代码,对于那 ...
- Django的url使用方法
利用Django开发站点.能够设计出很优美的url规则,假设url的匹配规则(包括正則表達式)组织得比較好,view的结构就会比較清晰.比較easy维护. 最简单的形式 from django.con ...
随机推荐
- Mysql快速导出导入数据的实验
一.创建测试数据库 CREATE database example; use example; create TABLE `user` ( `id` ) NOT NULL, `last_name` v ...
- IE67下去掉input边框
除了 border:none;之外 需要 border-color:#fff; overflow:hidden;
- Hydra--密码破解的神器
原来不止burpsuit.sqlmap是神器,还有Hydra. 虽久闻大名,却未曾使用,今天偶然用到,发现支持的服务那真是多,ftp.ssh.smtp.imap.http...,而且支持ssl 可以想 ...
- ActiveMQ学习总结
一.消息中间件的产生的背景 1.在网络通讯中,Http请求默认采用同步请求方式,基于请求与响应模式 2.在客户端与服务器进行通讯时,客户端调用服务端接口后,必须等待服务端完成处理后返回结果给客户端才能 ...
- 使用selenium模拟知网登录
之前都是用phantomjs和selenium模拟浏览器动作的,后来phantomjs不再更新,就转用chrome了 本次模拟登录的网站是中国知网http://login.cnki.net/login ...
- [Contest20180316]Game
这题有一个结论:如果他是最强的(⑨),那么线段树最优,如果他是最弱的,那么链状树最优 严格证明可能挺困难,感性理解就是公平赛制让强的人容易赢,极度不公平的赛制能让弱的人有机会反杀 所以我们只改他的能力 ...
- 【整体二分+莫比乌斯函数+容斥原理】BZOJ2440
[题目大意] 求第k个不是完全平方数或完全平方数整数倍的数. [思路] 由于μ(i)*(n/i^2)=n,可以直接从1开始,得出非完全平方数/完全平方数倍数的数的个数 注意一下二分的写法,这里用的是我 ...
- iOS开发——异常:[__NSCFNumber length]: unrecognized selector sent to instance
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumbe ...
- Maven多模块项目单独编译子模块项目时报错:Failed to execute goal on project/Could not resolve dependencies for project
背景:常规的父子项目搭建的工程,参考:http://www.cnblogs.com/EasonJim/p/6863987.html 解决方法: 1.需要把parent工程,也就是package是pom ...
- Instant Run 的操作影响到了代码,导致Android App启动闪退的问题
转自yuhc163原文android启动应用java.lang.NoClassDefFoundError: Class not found using the boot class loader; n ...