Search code examples
openerp-7

How to inherit views properly in openerp 7.0


hi my view inheritance code is this , i get the following error while using this code . " ValueError: too many values to unpack "

Please help me to resolve this issue

    <record model="ir.ui.view" id="inherit_form_view1">
        <field name="name">Inherit Form</field>
        <field name="model">student.info.student</field>
        <field name="type">form</field>
        <field name="inherit_id" ref="student.info.student.form_view1" />
        <field name="arch" type="xml">
            <!-- <xpath expr="/sheet/notebook/page/field[@name='mname']" position="after">
                <field name="m_tongue" />
            </xpath -->>

            <field name="mname" positon="after">
            <field name="m_tongue" />
            </field>

        </field>
    </record>

</data>


Solution

  • <record model="ir.ui.view" id="inherit_form_view1">
        <field name="name">Inherit Form</field>
        <field name="model">student.info.student</field>
        <field name="type">form</field>
        <field name="inherit_id" ref="student_info_student.form_view1" />
        <field name="arch" type="xml">
    
            <field name="mname" positon="after">
                <field name="m_tongue" />
            </field>
    
        </field>
    </record>
    

    Your ref is wrong! structure must be "module_name"."view_name". Further using xpath is usually safer and preferable but this way is, if you are a beginner, clearer.

    Hope it helped :)