Odoo Help

Welcome!

This community 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.

0

How to use two different models in the same ir.ui.view view?

By
Pascal Tremblay
on 1/3/16, 7:15 PM 839 views

Hello all,

I don't understand something about view inheritance. I need (again and again) your help.

When we click on Sales->Products->Products (form view) :

This view product.product_template_form_view is called and declared with model product.template. I understand this.

<record id="product.product_template_form_view" model="ir.ui.view">

<field name="name">product.template.common.form</field>

<field name="model">product.template</field>

<field name="mode">primary</field>

<field name="arch" type="xml">

<form string="Product">    

                [...]

</form>

            </field>
</record>


When we click on Sales->Sales->Products variants (form view) :

This view product.product_normal_form_view is called and declared with model product.product. It inherits the above view

product.product_template_form_view. I don't understand this! These two views don't have the same model...


<record id="product.product_normal_form_view" model="ir.ui.view">

<field name="name">product.product.form</field>

<field name="model">product.product</field>

<field name="mode">primary</field>

<field eval="7" name="priority"/>

<field name="inherit_id" ref="product.product_template_form_view"/>

<field name="arch" type="xml">

<form position="attributes">

<attribute name="string">Product Variant ZZZ</attribute>

</form>

                [...]

</field>

</record>



I would really need example, documentation about this concept.

How can a view inherit an other view from an other model?

I thought that a view that inherits an other view must have the SAME MODEL... No???


Update #1 (january 4th)

Old post : https://bugs.launchpad.net/openobject-server/+bug/702337


0

Tarek Mohamed Ibrahim

--Tarek Mohamed Ibrahim--
896
| 5 3 7
Gîza, Egypt
--Tarek Mohamed Ibrahim--

I am an old VFP developer on ERP

I have moved to 2p since Nov-2014 and started developing with Python on Odoo.

https://www.linkedin.com/profile/public-profile-settings?trk=prof-edit-edit-public_profile

tibrahim@2p.com.sa

Tarek Mohamed Ibrahim
On 1/4/16, 6:52 PM

I searched the id product_template_form_view in OpenERP 7 and found it being used only with product.template, so there is no problem there.


In Odoo 8 all places referred to product.template, except in the 'product' module. I can guess that there is no problem in this change if we took in consideration that the 'product.product' inherits from 'product.template'


Pascal, after I posted my reply I noticed the old post link you added. This link suggests the feature you are discussing in this post. I think they changed this in Odoo 8 to be allowed.

Tarek Mohamed Ibrahim
on 1/4/16, 6:57 PM

It would be nice to have some examples of those changes in Odoo 8 on the web... I would want to read it somewhere... Not you? I don't find any example of this concept. No proof.

Pascal Tremblay
on 1/4/16, 7:44 PM

oh! I forgot... Thanks for your answer mister.

Pascal Tremblay
on 1/4/16, 7:45 PM

<field name="mode">primary</field> use?

Annadurai
on 7/11/16, 1:14 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 1/3/16, 7:15 PM
Seen: 839 times
Last updated: 1/4/16, 6:52 PM