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

Multiple inheritance of same method

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
3 Antwoorden
1673 Weergaven
Avatar
Jay Patel

I am developing a custom module and facing an issue like inheriting the Method without super call , and the flow of super breaks.


while in other module i have done the same and override without super some other method but it called the method from other modules that have extended the same 


So can anyone explain the sequence of method calling in odoo , i dont understand if i inherit a method without super , in one case it does not call any super method and in other case it calls , why ?????

0
Avatar
Annuleer
Avatar
Theresia Weissnat
Beste antwoord

I hope your idea will work. Although, I don't understand what custom module you are referring to.

0
Avatar
Annuleer
Theresia Weissnat

Perform the following steps to call the action_confirm method of the education.application model:
Create file application_method.py. You can put this file anywhere you want because the RPC program will work independently.
Add the following code to the file:
from xmlrpc import client
server_url = 'http://localhost:8069'
db_name = 'viin_education'
username = 'admin'
password = 'admin'
common = client.ServerProxy('%s/xmlrpc/2/common' % server_url)
user_id = common.authenticate(db_name, username, password, {})
models = client.ServerProxy('%s/xmlrpc/2/object' % server_url)
if user_id:
# Create application with state draft
application_id = models.execute_kw(db_name, user_id, password,
'education.application', 'create',
[{'name': 'New application', 'application_date': '2022-01-18', 'admission_date': '2022-01-18', 'state': 'draft'}])
# Call action_confirm method on new application
models.execute_kw(db_name, user_id, password,
'education.application', 'action_confirm', [[application_id]])
# check application status after method call
application_data = models.execute_kw(db_name, user_id, password,
'education.application', 'read', [[application_id], ['name', 'state']])
print('Student state after method call:', application_data[0]['state'])
else:
print('Wrong credentials')
3.Run the Python script from Terminal with the following command:
python3 application_method.py
The program will create an enrollment profile with draft status and then we will change the status of the enrollment profile by calling action_confirm method. We will then read the admissions profile data to check the status of the admissions application, which will produce the following output:
application_id= 10
I hope it is information which you mention
https://hill-climbracing.com

Avatar
Jay Patel
Auteur Beste antwoord

Yes , but i need to know that other methods that are extending the same method , with super are getting called in some case , and not in others !! why ?


0
Avatar
Annuleer
Avatar
shubham shiroya
Beste antwoord

Inheritance using super(): When you inherit a method and call super() within the overridden method, it allows you to extend or modify the behavior of the original method while still executing the code of the overridden method in the parent class. This ensures that the original functionality is preserved while adding your custom logic.

For example:

class MyModule(models.Model):
_inherit = 'some.other.module'

def my_method(self):
# Custom code before the super call
res = super(MyModule, self).my_method()
# Custom code after the super call
return res

  1. In this case, calling super() invokes the method in the parent class (the original method), and you can modify its behavior as needed.

  2. Inheritance without super(): If you inherit a method but do not include a super() call within the overridden method, the original method in the parent class will not be executed automatically. Instead, only the code within the overridden method will be executed.

    For example:


class MyModule(models.Model):
_inherit = 'some.other.module'

def my_method(self):
# Custom code without calling super()
return # No call to super()

In this case, the original method in the parent class will not be executed unless explicitly called within the overridden method.


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
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