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
    • Sociale 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 inherit the /web/login controller such that the method return should not return control to another module who has been also inherit

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
inheritanceinheritcontrollerscontroller
2 Antwoorden
12020 Weergaven
Avatar
Sah Vinay Mahabir

I want to inherit the '/web/login' controller but the problem is when my function return, the control goes to the method who has also inherit and then it return their functionality instead of my functionality.
Let me give example what is happening in my case when 'website' module is also installed.

# my custome module code
class myClass(Home):
    @http.route() def web_login(self, redirect=None, *args, **kw):
    _logger.info('1')
    response = super(myClass, self).web_login(redirect=redirect, *args, **kw)
    _logger.info('2')
    return request.render('myModule.myTemplate', data)

# Odoo file located at ../odoo/addons/website/controllers/main.py
class Website(Home):
    @http.route(website=True, auth="public") def web_login(self, redirect=None, *args, **kw): logger.debug('3') response = super(Website, self).web_login(redirect=redirect, *args, **kw) if not redirect and request.params['login_success']: if request.env['res.users'].browse(request.uid).has_group('base.group_user'): redirect = '/web?' + request.httprequest.query_string else: redirect = '/' logger.debug('4') return http.redirect_with_hash(redirect) logger.debug('5') return response

The output is:

1
2
3
4
So basically instead of rendering myModule.myTemplate template which is after logger label as '2', the control goes to website module and it return http.redirect_with_hash(redirect) which is after logger label as '4'.
How to achieve this so that no matter whoever the method is last but it should always return my code which is myModule.myTemplate.

It will be very helpful which you share example code to solve this issue. If anything which need some more clarification then let me know. I will try to explain more.

PS: My custom module can only depend on web module, so I can't add dependency to website module to overcome the solution. However, we can install website module later, Just saying considering this issue can only solve by understanding this solution: \https://www.odoo.com/forum/help-1/question/v8-general-question-about-method-inheritance-multiple-override-in-different-modules-100032

0
Avatar
Annuleer
Sehrish

Try this: https://learnopenerp.blogspot.com/2020/08/inherit-web-login-controller-in-odoo.html

Avatar
Jainesh Shah(Aktiv Software)
Beste antwoord

Hello @Vinay,


What you are doing here is that you are calling super method of the parent controller that you have inherited, here in ODOO's method you can see that return is not a data (JSON) but a redirection.


here's the solution:


Copy the whole method of ODOO base and override it by adding your code where required and don't call super now. This way it will have its original functionality + your customised flow.


Hope it helps.

Regards,




Email:     odoo@aktivsoftware.com  

Skype: kalpeshmaheshwari

   

0
Avatar
Annuleer
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
How to extend an existing class and include social newtork features in the sub class
inheritance inherit
Avatar
Avatar
3
jul. 18
4787
Inheritance web/login but make 400 bad request
inheritance controller loginpage
Avatar
0
sep. 22
4120
Inheritance in discuss module (mail)
inheritance inherit discuss
Avatar
0
jan. 22
3494
How to inherit web controllers Opgelost
function inherit controllers
Avatar
Avatar
1
mei 24
5389
Properly inherit web controller and overwrite web_login method Opgelost
inheritance login controllers
Avatar
Avatar
Avatar
3
mei 21
14971
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