Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Multiple inheritance of same method

Subscriure's

Get notified when there's activity on this post

This question has been flagged
3 Respostes
1664 Vistes
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
Descartar
Avatar
Theresia Weissnat
Best Answer

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

0
Avatar
Descartar
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
Autor Best Answer

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
Descartar
Avatar
shubham shiroya
Best Answer

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
Descartar
Enjoying the discussion? Don't just read, join in!

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

Registrar-se
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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