Odoo Help


What is Inheritance by delegation? Can you share an example?

Karthik Arumugam
on 7/3/15, 3:19 AM 782 views

Hi, I am new to the openerp concepts can any explain me the concept behind the "Inheritance by delegation" with an example.


Axel Mendoza

--Axel Mendoza--
| 7 8 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full-time employee trying to understand what to do and how

Reach me at aekroft@gmail.com

Axel Mendoza
On 7/10/15, 4:38 AM

Inheritance by delegation can be described as a composition model joining the fields and functions of the related model as one(but separated) in a new model using always a field many2one for expressing the relation. Take a simple example to show the syntax:

#product.product and product.template

class product_template(osv.osv): 
_name = "product.template"


class product_product(osv.osv):

_name = "product.product"

_description = "Product"

_inherits = {'product.template': 'product_tmpl_id'}


_columns = {

'product_tmpl_id': fields.many2one('product.template', 'Product Template', required=True, ondelete="cascade", select=True, auto_join=True),




As you see product.product has a many2one with product.template and inherits from product.template using the relation field with that model. As results product.product forms/tree/objects values in general could use fields from product.template as declared local in the product.product model, but the field values of product.template will be stored in product.template where they belongs. Its a way of simple manage the other model from here.

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


Asked: 7/3/15, 3:19 AM
Seen: 782 times
Last updated: 8/14/15, 1:52 AM