This question has been flagged
1 Reply
3746 Views

trying to override the existing view of sales_order_lines from the form view. Keep getting xml errors here.

<record id="sales_order_line_modified" model="ir.ui.view">
    <field name="name">sale.order.form</field>
    <field name="model">sale.order</field>
    <field name="type">form</field>
    <field name="inherit_id" ref="sale.view_order_form" />
    <field name="arch" type="xml">
        <data>
            <xpath expr="/tree/field[@name='name']" position="replace">
                <field name="name" on_change="onchange_order_line(product_id,name)"/>
            </xpath>
        </data>
    </field>
</record>

Trying to add an on_change method and getting an XML Archetecture error. Any help would be greatly appreciated.

Avatar
Discard
Best Answer

Your code is wrong It's:

<openerp>
    <data>
        <record id="sales_order_line_modified" model="ir.ui.view">
        <field name="name">sale.order.form</field>
        <field name="model">sale.order</field>
        <field name="type">form</field>
        <field name="inherit_id" ref="sale.view_order_form" />
        <field name="arch" type="xml">

             <xpath expr="//field[@name='order_line']/tree/field[@name='name']" position="replace">
                 <field name="name" on_change="onchange_order_line(product_id,name)"/>
             </xpath>

        </field>
        </record>
    </data>
</openerp>
Avatar
Discard
Author

Your solution works, but you've got your data tags in the wrong area. They should be around the xpath tags. Once I made this change openERP installed the module just fine. Thanks for your time!

edit: If you make the changes indicated to your post, I'll mark this as correct answer.

I'm not sure why it works for you, but data doesn't go inside a XML arch. Anyways I fixed my mistake.