Odoo Help


Multi level view inheritance

on 10/18/14, 7:33 AM 1,932 views

Is multi level inheritance of views possible in odoo. e.g.

I have inherited the product template to add "my product type" to all products

class my_products(osv.osv):
    _name = "product.template"
    _columns = {
        'my_product_type': fields.char('My Product Type', size=50, required=True),

I have also inherited the view as follows 

        <record model="ir.ui.view" id="product_template_form_view">
            <field name="name">My Products</field>
            <field name="model">product.template</field>
            <field name="inherit_id" ref="product.product_template_form_view"/>
            <field name="arch" type="xml">
          <notebook position="inside">
        <page string="My Product Details">
            <field name="my_product_type"/>

This works if i go to product create forms. 

However if now i go to create the next level of inheritance by creating a book

class book(osv.osv):
    _name = "book"
    _columns = {
        'isbn': fields.char('ISBN', size=30),

and then try to inherit from the form added already for my products

        <record model="ir.ui.view" id="view_books_form">
            <field name="name">Books</field>
            <field name="model">book</field>
            <field name="inherit_id" ref="my_products.product_template_form_view"/>
            <field name="arch" type="xml">
          <notebook position="inside">
        <page string="Book Details">
            <field name="isbn"/>


It does not work. None of the two tabs are displayed. If however i do not inherit from my_products.template form but directly from product.template form. The book details tab is added but not the product details. Does multi level inheritance work in this way




Techno-Functional Associate with 7+ years of experience in Odoo (formerly known as OpenERP).

On 10/22/14, 1:59 AM

Tel me something, when you inherited product_template in "book" module, for which you given "name" signifying it as an new object.. So the model "book" is a derived object from product_template, and will be treated as a new model...

Hence you need to create new XML views for the object "book", in this case you cannot inherit from its super object view..

Your second case of inherting [book] is obsolutely wrong, You got to understand the behaviour of inheritance... only then you will have a better insight of it...

In Openerp: there are 2 kinds of Inheritance:
  1. Object Inheritance - _inherit
  2. Inheritance by Delegation - _inherits

Do Refer those docs for better info...



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

1 follower(s)


Asked: 10/18/14, 7:33 AM
Seen: 1932 times
Last updated: 3/16/15, 8:10 AM