ilyas bahri Dudak
ilyas bahri Dudak

Reputation: 39

Odoo how to get current action and menu_id

I want to get action and menu_id in this url

http:// localhost: 8069/web &debug=#id=1&view_type=form&model=res.partner.task&menu_id=126&action=162

I get active_id and active_model but dont get action and menu_id

please help me :((

Upvotes: 2

Views: 5582

Answers (2)

Nazar
Nazar

Reputation: 101

Try below code:

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

Upvotes: -1

Danila Ganchar
Danila Ganchar

Reputation: 11223

Hope this help you:

from openerp.http import request
# you can find here: Request, OpenERPSession, id of action and other parameters
print(request.__dict__)

Upvotes: 3

Related Questions