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 ...
随机推荐
- spring quartz job autowired 出错 null pointer
什么情况下才能用autowired? 当当前类属于spring IOC容器管时候就可以,比如在applicationContext.xml里有定义 就是说在spring上下文里能够找到 但是比如qua ...
- AC日记——逆序对 洛谷 P1908
逆序对 思路: 线段树水过: 代码: #include <cstdio> #include <cstring> #include <iostream> #inclu ...
- AC日记——Is it rated? codeforces 807a
Is it rated? 思路: 水题: 代码: #include <cstdio> #include <cstring> using namespace std; ],b[] ...
- 17、Django实战第17天:机构详情展示
1.进入xadmin添加测试数据(教师.课程) 2.把以下4个前端页面复制到templates中 先打开这几个页面分析,它们和之前的课程机构列表页是不一样的机构,且没有共同的部分,但是这4个页面却是类 ...
- ASP.NET Core 2.2 基础知识(十五) Swagger
安装 Nuget 包 注册 Swagger public void ConfigureServices(IServiceCollection services) { services.AddMvc() ...
- CentOS 7.1 中文正式版下载 - 最流行的免费开源企业级 Linux 服务器操作系统
如果说 Ubuntu 是现今最受桌面用户欢迎的 Linux 操作系统,那么 CentOS 就是最受公司.企业.IDC 喜爱的 Linux 发行版了.得益于极为出色的稳定性,全球范围内无数著名网站均选用 ...
- 【分块】bzoj3196 Tyvj 1730 二逼平衡树
分块 或 树套树. 在每个块中维护一个有序表,查询时各种二分,全都是分块的经典操作,就不详细说了. 块的大小定为sqrt(n*log2(n))比较快. #include<cstdio> # ...
- 【莫队算法】【权值分块】poj2104 K-th Number / poj2761 Feed the dogs
先用莫队算法保证在询问之间转移的复杂度,每次转移都需要进行O(sqrt(m))次插入和删除,权值分块的插入/删除是O(1)的. 然后询问的时候用权值分块查询区间k小值,每次是O(sqrt(n))的. ...
- python基础-文件处理与函数
1. 文件处理 1.1 文件处理流程 1.打开文件,得到文件句柄并赋值给一个变量 2.通过句柄对文件进行操作 3.关闭文件 1.2 文件读取模式r r文本模式的读,在文件不存在,不会创建新文件 f = ...
- Linux虚拟机小问题解决方法系列
1)使用虚拟机的过程中,会碰到虚拟机占用的空间越来越大的情况,即使删除了虚拟机里的文件,磁盘空间还是似乎还是没有释放,使用“vmware-vdiskmanager”工具解决.解决方法在这里:参考.合并 ...