Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
4883 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Autor

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.

Related Posts Odpovědi Zobrazení Aktivita
6
zář 17
8271
1
led 17
4238
3
čvn 15
8010
2
bře 15
9982
1
bře 15
4483