码迷,mamicode.com
首页 > Web开发 > 详细

How to get the url of a page in OpenERP?

时间:2015-04-18 16:06:09      阅读:200      评论:0      收藏:0      [点我收藏+]

标签:

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?

标签:

原文地址:http://www.cnblogs.com/chjbbs/p/4437437.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!