Odoo Help


Form View with 4 models

Pedro Leite
on 4/21/16, 5:48 AM 796 views


 I have a form view with 3 pages in the notebook. I need to have 3 models in the same form, but the ODOO only allows one. Is there any way around this?

Best regards


Jignesh Mehta

--Jignesh Mehta--
| 6 5 8
Surat, India
--Jignesh Mehta--

- I have 3+ years of Industry Experience, specializing Odoo Development, Analysis, Customization, Implementation, Integration.
- I have done many Customization modules in Sale, Purchase, Point of Sale, Inventory, CRM and much more. Also Worked in the Odoo Themes like Business Theme or E-Commerce Theme.
- Develop Jewelery Manufacturing process from Scratch. It have more than 10 Department. Develop PDF and Excel reports for this project around 150 per format.

Jignesh Mehta
On 4/21/16, 6:09 AM

Hello Pedro,

For this, you can use _inherits concepts of odoo.

For Ex :-

class MainModel(models.Model):

     _name = 'main.model'

      _inherits = {'model.a': 'a_id', 'model.b': 'b_id', 'model.c':'c_id'}

     a_id = fields.Many2one('model.a', 'A')

     b_id = fields.Many2one('model.b', 'B')

     c_id = fields.Many2one('model.c', 'C')

     # another fields which you want to display

class ModelA(models.Model):

     _name = 'model.a'

     a_name = fields.Char('A Name')

     # another fields for A model

class ModelB(models.Model):

     _name = 'model.b'

     b_name = fields.Char('B Name')

     # another fields for A model

class ModelC(models.Model):

     _name = 'model.c'

     c_name = fields.Char('C Name')

     # another fields for A model

In Xml :-

<record id="new_view" model="ir.ui.view">
    <field name="name">main.model</field>
    <field name="model">main.model</field>
    <field name="arch" type="xml">
                    <page string="A">
                        <field name="a_name"/>
                    <page string="B">
                        <field name="b_name"/>
                    <page string="C">
                        <field name="c_name"/>

Hope it works for you.


@Jignesh Mehta, you have change the "has a" relation in the "is a" relation , it will create a huge burden on db schema as the data size grow in MOdel A,B and C , this is not right

webkul, Prakash
on 4/21/16, 8:18 AM

Hello @Prakash, This is the only way to do that for @Pedro's situation.

Jignesh Mehta
on 4/21/16, 8:20 AM

@Prakash Sharma in odoo we have a facility of _inherits so we can use relation to use data like as example given by @Jignesh Mehta so we can use this way , and from my point of view @Jignesh Mehta is right. Thanx

Bhavik Bagadiya
on 4/21/16, 8:24 AM
Pedro Leite
On 4/21/16, 6:36 AM

Hi @Jigness Mehta,

thanks for the answer. I already have this structure, the problem is I want to put a form in each page of the notebook. I tried to do this:

<field name="payment_ids">
   <form string="Payments">
        <field name="name"/>

However, this form only appears when I click "Add an item" in the list that appears by default, because the field "payment_ids" is a One2Many.

see my updated ans. It will help you.

Jignesh Mehta
on 4/21/16, 7:49 AM

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: 4/21/16, 5:48 AM
Seen: 796 times
Last updated: 4/21/16, 6:36 AM