Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
17296 Представления

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


Аватар
Отменить
Лучший ответ

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

Аватар
Отменить
Автор

Thank you Haresh Kansara

Related Posts Ответы Просмотры Активность
0
апр. 20
3552
4
апр. 20
9028
1
нояб. 19
3935
3
окт. 19
7770
1
авг. 19
6230