콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
17394 화면

<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

관련 게시물 답글 화면 활동
0
4월 20
3684
4
4월 20
9130
1
11월 19
4033
3
10월 19
7867
1
8월 19
6358