Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Nekilnojamasis turtas
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Konsultavimas
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Maistas
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Saulės energijos sistemos
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Kiti
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

How to get current url in odoo 9?

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
urlodoo9
3 Replies
30131 Rodiniai
Portretas
Prince Caspion

Hello all,

I want to fetch the current url like  this :http://localhost:8069/web?debug=#id=10&view_type=form&model=crm.lead&action=251

in method.

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.

Regards,

Prince.


 


3
Portretas
Atmesti
Portretas
Deepa Venkatesh
Best Answer

You can get the current url from Prams object as follows

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


or you can fetch the details from self.environment



3
Portretas
Atmesti
Prince Caspion
Autorius

I've already tried this one but it just gives base url not complete url. i need complete url.

Deepa Venkatesh

Then fetch the details from self.environment or http/request

Portretas
Shameem Babu
Best Answer

Hi Prince, You try my way


Step1 : Create a javascript file and call a python function when URL changes

refer : https://www.odoo.com/forum/help-1/question/odoo-9-website-js-help-109603#answer-109604

Pass the current url in that function

Example

$(window).on('hashchange', function(e){
    ajax.jsonRpc("/action_set_current_url/", 'call', window.location.href)
});


Step2: In python function, Set the current url to session.

Example

from openerp import http
from openerp.http import request
class YourModel(http.Controller):
    @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


Step3:

 Call the current url from your function

 Example

def your_function(self):
    # CODE TO GET URL
    current_url = request.session.get('my_current_url')


Note : my code is not tested

0
Portretas
Atmesti
Prince Caspion
Autorius

thanks for your answer and quick response. but the problem is my function is called in back end it is not dealing with any web/js action. I am not sure, can i get the current full path in the method which is called in button click.

Shameem Babu

I have tried many times

https://www.odoo.com/forum/help-1/question/how-to-get-current-url-from-bowser-101333#answer-108714

I found this is only one solution

It is possible in backend

Link JS like this

<template id="assets_backend" name="im assets" inherit_id="web.assets_backend">

<xpath expr="." position="inside">

<script type="text/javascript" src="/path /to/file.js"></script>

</xpath>

</template>

Prince Caspion
Autorius

thanks, i will check it.

Shameem Babu

A small change in my answer. I told to write script when document is ready.

But you need to write when url changes

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registracija
Related Posts Replies Rodiniai Veikla
Get menu_id of page opened odoo 9
menu url odoo9
Portretas
0
saus. 20
3540
System redirect to a wrong url Solved
url
Portretas
1
geg. 25
1680
Chane screen's URL in odoo 17
url
Portretas
0
lapkr. 24
2410
Change meta tag to domain name
url
Portretas
0
kov. 24
2121
How to get data n view using custom widget in odoo 9
odoo9
Portretas
0
rugs. 23
2735
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now