Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Social media Marketing
    • E-mailmarketing
    • SMS Marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

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

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

How to get current url in odoo 9?

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
urlodoo9
3 Antwoorden
30134 Weergaven
Avatar
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
Avatar
Annuleer
Avatar
Deepa Venkatesh
Beste antwoord

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
Avatar
Annuleer
Prince Caspion
Auteur

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

Avatar
Shameem Babu
Beste antwoord

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
Avatar
Annuleer
Prince Caspion
Auteur

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
Auteur

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

Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
Get menu_id of page opened odoo 9
menu url odoo9
Avatar
0
jan. 20
3541
System redirect to a wrong url Opgelost
url
Avatar
1
mei 25
1680
Chane screen's URL in odoo 17
url
Avatar
0
nov. 24
2410
Change meta tag to domain name
url
Avatar
0
mrt. 24
2122
How to get data n view using custom widget in odoo 9
odoo9
Avatar
0
sep. 23
2736
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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