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
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。