i want to get current url from javascript and i keep current url in session on controller and call the session in my model but i got nothing and no error:
controller.py:
@http.route(['/action_set_current_url/<string:url>'], type='json', auth="public")
def set_current_url(self, url, **post):
request.session['my_current_url'] = url
return {"my_current_url":my_current_url}
mymodel.py to get session:
current_url = http.request.session.get('my_current_url')
javascript code:
$(window).on('hashchange', function(e){
var url=window.location.href
openerp.jsonRpc("/action_set_current_url/", 'call',url)
});
in the js, console the url and check whether there is value inside it
how to check the value inside when i'm working in remote server??
you can check the in console of the browser
i had something like this in console of browser:
POST
XHR
http://10.10.20.1:8069/web/dataset/call_kw/stock.picking/search_read [HTTP/1.0 200 OK 6180 ms]
POST
XHR
http://10.10.20.1:8069/web/menu/load_needaction [HTTP/1.0 200 OK 2573 ms]
POST
XHR
http://10.10.20.1:8069/web/dataset/call_kw/stock.picking/read_followers_data [HTTP/1.0 200 OK 2054 ms]
POST
XHR
http://10.10.20.1:8069/web/dataset/call_kw/mail.message/message_read [HTTP/1.0 200 OK 4765 ms]
POST
XHR
http://10.10.20.1:8069/web/dataset/call_kw/stock.move/read [HTTP/1.0 200 OK 4611 ms]
POST
XHR
http://10.10.20.1:8069/web/dataset/call_kw/stock.picking/message_get_subscription_data [HTTP/1.0 200 OK 2438 ms]
POST
XHR
http://10.10.20.1:8069/web/dataset/call_kw/mail.message/set_message_read [HTTP/1.0 200 OK 272 ms]
POST
XHR
http://10.10.20.1:8069/web/dataset/search_read [HTTP/1.0 200 OK 127 ms]
POST
XHR
http://10.10.20.1:8069/longpolling/poll
but i want to have current and complete url like this:
http://10.10.20.1:8069/web#id=51&view_type=form&model=stock.picking&action=181&active_id=3
how can i do have this