Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
5 Antwoorden
42456 Weergaven

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

Avatar
Annuleer
Beste antwoord

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


Avatar
Annuleer

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.

Beste antwoord

from openerp.http import request

print request.httprequest.url_root


Or: 

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


Avatar
Annuleer
Beste antwoord

from odoo.http import request

check out/print:

request.httprequest.url

request.httprequest.base_url

request.httprequest.host_url

Avatar
Annuleer
Beste antwoord

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.

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
1
apr. 25
3912
3
dec. 22
11835
6
apr. 24
39374
3
mrt. 24
10876
2
jul. 19
765