Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • eLearning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Información
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Alimentación y hostelería
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Empresa contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y asistencia informática
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Browse all Industries
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Services for Partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyecto
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

Reg - _inherits OpenERP

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
_inherits
1 Responder
7810 Vistas
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
Mejor respuesta

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 .

¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
unable to add column in res.users table Resuelto
_inherits
Avatar
Avatar
Avatar
Avatar
Avatar
17
dic 21
25758
how to change default digits of precision?
_inherits
Avatar
Avatar
1
dic 18
20411
TypeError: The model "fleet.vehicle" specifies an unexisting parent class "fleet.vehicle"
_inherits
Avatar
Avatar
Avatar
2
mar 15
9654
inherited view from base_calendar view
_inherits
Avatar
Avatar
2
mar 15
11477
aading a new menuitem in fleet module
_inherits
Avatar
Avatar
2
mar 15
6179
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y totalmente integrado.

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