Se rendre au contenu
Menu
Cette question a été signalée
1 Répondre
17283 Vues

<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
Ignorer
Meilleure réponse

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
Ignorer
Auteur

Thank you Haresh Kansara

Publications associées Réponses Vues Activité
0
avr. 20
3547
4
avr. 20
9018
1
nov. 19
3929
3
oct. 19
7752
1
août 19
6214