zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    Python第一周作业
    turtle库的学习笔记
    绘制五角星
    绘制六角形
    绘制同心圆
    绘制叠加三角形
    Slash And Black Slash/正斜杠和反斜杠
    OpenCv中avi视频的读取问题,以及内部格式要求
    OpenCv和matlab对图像的读取
    个人项目进度
  • 原文地址:https://www.cnblogs.com/chjbbs/p/4437437.html
Copyright © 2011-2022 走看看