I want to fetch the current url like this :http://localhost:8069/web?debug=#id=10&view_type=form&model=crm.lead&action=251
How can we do that? i've tried with several ways but didn't work for me. I can get the base url using config parameter but not ful URL.
Hi Prince, You try my way
refer : https://www.odoo.com/forum/help-1/question/odoo-9-website-js-help-109603#answer-109604
Pass the current url in that function
ajax.jsonRpc("/action_set_current_url/", 'call', window.location.href)
Step2: In python function, Set the current url to session.
from openerp import http
from openerp.http import request
@http.route(['/action_set_current_url/<string:url>'], type='json', auth="public")
def set_current_url(self, url,**post):
# CODE TO SET COOKIES
request.session['my_current_url'] = url
Call the current url from your function
# CODE TO GET URL
current_url = request.session.get('my_current_url')
Note : my code is not tested
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 10/30/16, 10:58 AM|
|Seen: 312 times|
|Last updated: 11/1/16, 9:30 PM|