Skip to Content
Menu
This question has been flagged
1 Reply
16079 Views

<record id="product_template_form_view" model="ir.ui.view">
<field name="name">product.template.form.inherit</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<xpath expr="//page[@name='sales']" position="attributes">
<attribute name="invisible">0</attribute>
</xpath>
<xpath expr="//page[@name='sales']" position="after">
<page name="pos" string="Point of Sale" attrs="{'invisible': [('sale_ok','=',False)]}">
<group name="pos">
<group>
<field name="available_in_pos"/>
<field name="pos_categ_id" attrs="{'invisible': [('available_in_pos', '=', False)]}" string="Category"/>
<field name="to_weight" attrs="{'invisible': [('available_in_pos', '=', False)]}"/>
</group>
</group>
</page>
</xpath>
</field>
</record>

how to add my field after  '' to_weight '' ?

i try this but doesn't work 

<xpath expr="//page[@name='sales']" position="inside">
<xpath expr="//group[@name='pos']" position="inside">
<group>
<field name="my_field" attrs="{'invisible': [('available_in_pos', '=', False)]}"/>
</group>
</xpath>
</xpath>


Avatar
Discard
Best Answer

Hi mostafa,

Here is the solution:

<record id="product_template_form_view_inh_pos" model="ir.ui.view">
    <field name="name">product.template.form.inherit.pos</field>
    <field name="model">product.template</field>
    <field name="inherit_id" ref="point_of_sale.product_template_form_view"/>
    <field name="arch" type="xml">
        <xpath expr="//field[@name='to_weight']" position="after">
            <!-- Added your field -->
            <field name="my_field" attrs="{'invisible': [('available_in_pos', '=', False)]}"/>
        </xpath>
    </field>
</record>


More about xpath: https://www.odoo.yenthevg.com/xpath-expressions-in-odoo-8/

I hope it will work for you


Thanks and regards

Haresh Kansara

Avatar
Discard
Author

Thank you Haresh Kansara

Related Posts Replies Views Activity
0
Apr 20
2599
4
Apr 20
7555
1
Nov 19
2897
3
Oct 19
6236
1
Aug 19
4980