Delegation inheritance is similar to prototype inheritance but with a different approach. In delegation inheritance, you create a new object that delegates some of its functionality to an existing object.
2. Delegation inheritance is similar to prototype inheritance
but with a different approach. In delegation inheritance, you
create a new object that delegates some of its functionality
to an existing object. This type of inheritance is useful
when you want to add new functionality to an object
without modifying its original behavior.We use the _inherits
attribute for this type of inheritance.
3. • To get the same view of the product template form view and all fields to a custom model. First,
we have to create a model and add the delegation inheritance to the model. For example, here
a model named product.product and adding the model product template as delegation
inheritance
4. • Here _inherits is the syntax for the delegation inheritance
_inherits = {'product.template': 'product_template_id'}
Product.template is the model which is going to be can use in delegation
inheritance, and product_template_id is a Many2one field that is linked with our
custom model.
• In this case, all fields in the model product_template are now available in the
custom model product.kit.So now we need to add the XML to get the proper view
and also add the custom field view.
• Here we add the XML form view
<field name="inherit_id" ref="product.product_template_form_view"/>
5. Check our company website
for related blogs and Odoo book.
https://www.youtube.com/watch?v=sqkMIpdy7V0