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