跳至內容
選單
此問題已被標幟
5 回覆
42142 瀏覽次數

I need to get current active url in the browser and extract model from it. Is that possible?
Please Help

頭像
捨棄
最佳答案

In Python

from openerp import http
print http.request.env['ir.config_parameter'].get_param('web.base.url') # BASE URL

print http.request.httprequest

print http.request.httprequest.full_path

In Javascript

window.location.href


頭像
捨棄

In js, it will return the previous menu item url, In Python it does not return full url.

I need a menu id from current url.

最佳答案

from openerp.http import request

print request.httprequest.url_root


Or: 

base_url = self.env['ir.config_parameter'].get_param('web.base.url')


頭像
捨棄
最佳答案

from odoo.http import request

check out/print:

request.httprequest.url

request.httprequest.base_url

request.httprequest.host_url

頭像
捨棄
最佳答案

Hello Tessnim

you can try 

1 . 

from openerp.http import request

print(request.httprequest.__dict__)


or

2.  refer link

\ https://www.odoo.com/forum/help-1/question/how-to-get-url-of-current-page-29394


Thanx.

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
4月 25
3668
3
12月 22
11583
6
4月 24
38993
3
3月 24
10596
2
7月 19
765