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

Reg - _inherits OpenERP

Subscriure's

Get notified when there's activity on this post

This question has been flagged
_inherits
1 Respondre
7842 Vistes
Avatar
omprakash

Hai Friends ,

  I am new for OpenERP , I have doubt regards _inherits delegation in OpnenERP .

Can anyone explain _inherits delegation with examples .

Thanks & Regards OMPRAKASH.A

2
Avatar
Descartar
Avatar
klacus
Best Answer

Hi. The inherit methode has a lot of documentation around the net.: You can inherit: - xml for the views, and actions, wizzards, workflows - python codes for the deeper functionality, tables...etc

You can't inherit: - reports The first question is what do you want?

[Edited]

  1. Check the module what you want to inherit, thisi is you find out under addons dir.
  2. You must create a new module, according the followings:
    • create a folder same name what is your new module name.
    • put an __init__.py
    • put an __openerp__.py
    • put mymodule.py
    • put myview.xml inside the folder. All of that should be empty.

Put the following codes inside the __init__.py

import mymodule

this is a relation between the module and your main python code

Put the followings codes into the __openerp__.py

{
    "name" : "mymodule", # the name of the module
    "version" : "0.2", # the version of the module
    "author" : "your name", # your name :-)
    "website" : "", 
    "category" : "Generic Modules/Others", 
    "depends" : ["base","product"], #important points, as you see here must write the name of the inheritted modul name in our example product
    "description" : "your module description", 
    "init_xml" : ["myview.xml"], # important point your xml file what is definie the modified view points.
    "demo_xml" : [], 
    "update_xml" : [], #
    "active": False,
    "installable": True
}

put the following codes into the mymodule.py

class product_product(osv.osv):     
    _name = 'product.product'  # name of the inherited object, in sql you can find the table what name is product_product
    _inherit = 'product.product'
    _columns = { 
    'inheritted_recordname' : fields.char('shape',size=40, required = False, help='Some text what you want see...'),        # the inherited object column properties >> this meaning you create a new column in product_product table, what is char...and so on 
            }
product_product() # end of object def.

put the following code into the myview.xml

<record model="ir.ui.view" id="product_new_form_view_inherit"> 
    <field name="name">product.form.inherit</field>
    <field name="type">form</field>
    <field name="model">product.product</field>
    <field name="inherit_id" ref="product.product_normal_form_view"/>
    <field name="arch" type="xml">
            <field name="name" position="after">                    
    <field name="inheritted_recordname"/>                    

    </field>
    </record>

about view inherit you can find out the docs at: http://doc.openerp.com/v6.0/developer/2_6_views_events/views/view_inheritence.html

  1. Save all.
  2. Refresh the module list
  3. Install your new module.

In this case, if everithing as well, you have a new record in product object. Please watching and understanding the code.

[EDITED 2]

class test(osv.osv): 
_name = "test" 
_inherits = {"notebook.notebook" : "notebook_id" , 
"bpc.bpc" : "bpc_id"} 
_table = "test" 
_description = "Simple bpc" 
_columns = { 
'test' : fields.text('test'), 
'notebook_id' : fields.test('notebook_id'),
'bpc_id' : fields.test('bpc_id'), }

test()

In this case is usable if you want to inherit the data table values. If just the structure, may be you have a clear situation, if you make it all, one by one... "This inheritance mechanism is usually called ” instance inheritance ” or ” value inheritance ”. A resource (instance) has the VALUES of its parents."

2
Avatar
Descartar
omprakash
Autor

Hi Klacus , Thanks for your reply . Actually i have question regards ( _inherits delegation ) OpenERP 1. It is possible for multiple inheritance in OpenERP , If it is possible can you please explain it with sample code . ? 2. Right now i building custom module and exploring the inheritance features in OpenERP (_inherit & _inherits delegation ) I have idea about _inherit but i have no idea about _inherits delegation . Can you please explain friend . And once again thank you klacus for your reply .

klacus

Hi. Ok. We are a bit closer. :-) Please post out your code, and we can see what we can do. You can write down what is your target, and may be I can explain to you how it's work. Please newer forget you need a lot of trial before your code will be good enough for the general use. I waiting for your codes. Regards.

omprakash
Autor

Hi klacus , Thanks for your reply . I will just share with you what is my need & please clear my doubt . Basically i am java developer , For my client i need to move for python (OpenERP ) . I started learning OpenERP and i realized the excellent features . Actually my role will be for my client (To create a new custom module & customize the existing module ) . After i learn OpenERP technical document & i tried to implement . Klacus still i have no idea about _inherits delegation . http://doc.openerp.com/trunk/developers/server/03_module_dev_02/#inheritance-by-delegation-inherits

omprakash
Autor

I used this link for my technical training . This is my sample code.... from osv import fields, osv import time

class test(osv.osv): _name = "test" _inherits = {"notebook.notebook" : "notebook_id" , "bpc.bpc" : "bpc_id"} _table = "test" _description = "Simple bpc" _columns = { 'test' : fields.text('test'), 'notebook_id' : fields.test('notebook_id'), 'bpc_id' : fields.test('bpc_id'), }

test()

klacus

Ok. I post you some basic features... :-)

omprakash
Autor

klacus , whether the sample code for _inherits is correct or not .. please clarify my doubt . And once again thanks for your reply

klacus

If you have a problem/ question, just put here. If I can I will help you.

omprakash
Autor

Hi Klacus , Thanks for your immediate reply . I can understand the point what you shared with me . Further i have doubt in Topics (Inheritance by Delegation - _inherits Syntax ::

class tiny_object(osv.osv) _name = 'tiny.object' _table = 'tiny_object' _inherits = { 'tiny.object_a': 'object_a_id', 'tiny.object_b': 'object_b_id', ... , 'tiny.object_n': 'object_n_id' } (...) Which was in the link http://doc.openerp.com/trunk/developers/server/03_module_dev_02/#inheritance-by-delegation-inherits

klacus

Yeah, the "delegation" key is a bit..... :-) So in the upside sample you can see all of the things what is there.: http://doc.openerp.com/trunk/developers/server/03_module_dev_02/#inheritance-by-delegation-inherits If you think, you question is answered please close the topic... Bye.

omprakash
Autor

Hi klacus , thanks for reply . I will make use of it .

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
Related Posts Respostes Vistes Activitat
unable to add column in res.users table Solved
_inherits
Avatar
Avatar
Avatar
Avatar
Avatar
17
de des. 21
25834
how to change default digits of precision?
_inherits
Avatar
Avatar
1
de des. 18
20460
TypeError: The model "fleet.vehicle" specifies an unexisting parent class "fleet.vehicle"
_inherits
Avatar
Avatar
Avatar
2
de març 15
9690
inherited view from base_calendar view
_inherits
Avatar
Avatar
2
de març 15
11507
aading a new menuitem in fleet module
_inherits
Avatar
Avatar
2
de març 15
6202
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