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
时间: 2024-10-17 17:10:08

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

JSP(Java Server Page) JSP指令与动作元素

1. include动作 / include指令 include指令语法:<%@ include file="URL"%> include动作语法:<jsp:include page="URL" flush="true | false" ></jsp:include> include动作和include指令的区别:   include指令 include动作 语法格式 <%@ include file=&

django url调度

Django的url配置同样遵循着DRY(dont repeat yourself)的规则.以下都是官方文档的例子: 首先介绍的是Django如何处理http的请求: 1.在setting里定义ROOT_URLCONF ,这个值就是url的根配置,但若被request processing中间件定义了HttpRequest的urlconf属性,会替换掉ROOT_URLCONF 2.Django 加载模块,寻找 urlpatterns,它是pattern函数的返回值,是url的list 3.寻找每

Django的URL路由

URL配置(URLconf)就像Django 所支撑网站的目录.它的本质是URL模式以及要为该URL模式调用的视图函数之间的映射表:你就是以这种方式告诉Django,对于这个URL调用这段代码,对于那个URL调用那段代码 URL模式 urlpatterns = [ url(正则表达式, view函数, 参数, 别名), ] 参数说明 一个正则表达式字符串 一个可调用对象,通常为一个视图函数或一个指定视图函数路径的字符串 可选的要传递给视图函数的默认参数(字典形式) 一个可选的name参数,接合模

Page Object Model (Selenium, Python)

时间 2015-06-15 00:11:56  Qxf2 blog 原文  http://qxf2.com/blog/page-object-model-selenium-python/ 主题 SeleniumPython We have come a long way since our post on implementing the Page Object Model - Implementing the Page Object Model (Selenium + Python) Whil

URL地址编码和解码

0. 参考 [整理]关于http(GET或POST)请求中的url地址的编码(encode)和解码(decode) python3中的urlopen对于中文url是如何处理的? 中文URL的编码问题 1. rfc1738 2.1. The main parts of URLs A full BNF description of the URL syntax is given in Section 5. In general, URLs are written as follows: <schem

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

1.普通的url传值<html--------------- <!-- 隐藏域post提交url --> <form id="urlPost" action="${pageContext.request.contextPath}/iwell.disposition.sgt_1.0/newallsgtData.action" method="post"> <input type="hidden"

使用libcurl,根据url下载对应html页面

1. [图片] Capture.JPG ?2. [代码]GetPageByURL //static member variable definestring GetPageByURL::m_curPage = "";//当前保存的网页源码CURL* GetPageByURL::m_curl = NULL; /************************************************************************//* 函数名:Initialize

django的url匹配

学习网站:官方 以下是个人摘录: 1.基本匹配 urlpatterns = patterns('', url(r'^articles/2003/$', 'news.views.special_case_2003'), url(r'^articles/(\d{4})/$', 'news.views.year_archive'), url(r'^articles/(\d{4})/(\d{2})/$', 'news.views.month_archive'), url(r'^articles/(\d{

Django的url用法

利用Django开发网站,可以设计出非常优美的url规则,如果url的匹配规则(包含正则表达式)组织得比较好,view的结构就会比较清晰,比较容易维护. 最简单的形式 from django.conf.urls import patterns, url urlpatterns = patterns('', url(r'^articles/2003/$', 'news.views.special_case_2003'), url(r'^articles/(\d{4})/$', 'news.view