我想在此网址中获取操作和menu_id
http:// localhost:8069 / web& debug =#id = 1& view_type = form& model = res.partner.task& menu_id = 126& action = 162
我得到active_id和active_model但是没有得到动作和menu_id
请帮帮我:((
答案 0 :(得分:3)
希望这能帮到你:
from openerp.http import request
# you can find here: Request, OpenERPSession, id of action and other parameters
print(request.__dict__)
答案 1 :(得分:-1)
尝试以下代码:
from openerp import http
from openerp.http import request
result = ''
menu = self.env['ir.model.data'].get_object_reference('MODULE NAME', 'MENU ID')
result += request.httprequest.environ['HTTP_REFERER']
result += '#id=' + str(self.id) + '&view_type=form&model=' + request.params["model"] + '&menu_id=' + str(menu[1]) + '&action=' + str(request.params['kwargs']['context']['params']['action'])
return result