Odoo Help

1

0
5 Answers
0
Jihane Hemicha
2/18/17, 6:34 AM
hank you ! the problems was in using the right module ! my mistake( beginner )Xpath does work ! .
<record model="ir.ui.view" id="respartner_viewform">
<field name="name">respartner_form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/> <field name="arch" type="xml">
<xpath expr="//notebook" position="inside">
<page string="sys">
 <group>
 <field name="partnerform_ids" widget="one2many_list">
<tree editable="bottom" >
 <field name="id_type"/>
 <field name="id_product"/>
 <field name="valdate"/>
</tree> </field>
 </group>
 </page>
</xpath>
</field></record>
0
legland
1/31/19, 5:09 AM


0
Sehrish
2/18/18, 10:55 PM

In Odoo/OpenERP we can inherit or use existing modules object/class/model and views. We can also inherit single field of existing modules. The question is why we need such inheritance.

The purpose of inheritance or why we need inheritance is given below:

  1. To change attributes of some fields which exists on existing/custom model (e.g. making fields readonly,invisible)

  2. To add/modify/delete old or new fields in existing/custom model (e.g. Product, Sales, HR, Fleet Management, Attendance modules model etc)

  3. We can also add buttons in already existing/custom model (form and tree) view by using inheritance

To get complete guidance about xpath and inheritance in odoo read: http://learnopenerp.blogspot.com/2018/01/inheritance-in-models-and-views.html

1 Comment
Sehrish
2/18/18, 10:56 PM
0
Bharat Parmar (bhp)
2/16/17, 1:20 PM

This is not a proper way to inherit views.

try like this,

your_module.py

class respartner(models.Model):
     _inherit='res.partner'
     partnerform_ids=fields.One2many('partnerform','id_partner',string="respartners")

your_view.xml

<record id="respartner_inherit_viewform" model="ir.ui.view">			
    <field name="name">respartner_inherit_form</field>
    <field name="model">res.partner</field>
    <field name="inherit_id" ref="base.view_partner_form"/>
    <field name="arch" type="xml">
        <notebook position="inside">
            <page string="Management System">
                <group>
                    <field name="partnerform_ids" widget="one2many_list">
                        <tree>
                            <field name="id_type"/>
                            <field name="id_product"/>
                            <field name="valdate"/>
                        </tree>
                    </field>
                </group>
            </page>
        </notebook>
    </field>
</record>

 I hope this will help you.

Ask a Question
Tags
Keep Informed
1 follower(s)
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.

Register
Odoo Training Center

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

Test it now