Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
8283 Lượt xem

Hi everyone

Probem is I am trying to add a fax_number field in res.partner.

When I add the field after mobile or before email, it seems like it wants to include it in widget=phone or widget=email


<odoo>
<record model="ir.ui.view" id="view_partner_form">
<field name="name">res.partner.form.inherit</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<data>
<field name="zip" position="attributes">
<attribute name="invisible">1</attribute>
</field>
<xpath expr="//field[@name='zip']" position="before">
<field name="Postal_code" placeholder="Postal code" class="o_address_Postal_code"/>
</xpath>
<xpath
expr="//field[@name='country_id']" position="after">
<field name="Modify_date" placeholder="Date modified" class="o_datetime"/>
</xpath>
<field name="website" position="after">
<field name="fax_number"/>
</field>
</data>
</field>
</record>
</odoo>

works to add a label after website

<odoo>
<record model="ir.ui.view" id="view_partner_form">
<field name="name">res.partner.form.inherit</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<data>
<field name="zip" position="attributes">
<attribute name="invisible">1</attribute>
</field>
<xpath expr="//field[@name='zip']" position="before">
<field name="Postal_code" placeholder="Postal code" class="o_address_Postal_code"/>
</xpath>
<xpath
expr="//field[@name='country_id']" position="after">
<field name="Modify_date" placeholder="Date modified" class="o_datetime"/>
</xpath>
<field name="mobile" position="after">
<field name="fax_number" string="fax"/>
</field>
</data>
</field>
</record>
</odoo>

only adds a field no label and adds it in the same line as the mobile number with a fax string

I have added 'label for' xpath but just adds a label on that line not in the right column

Version 12 odoo

please let me know your thoughts

regards,

Justin

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất
   <xpath expr="//field[@name='mobile']/.." position="after">
            <label for="fax_number"/>
            <div>
                <field name="fax_number"/>
            </div>
        </xpath>

Did some digging and found my fix. If anyone else happens to run into the same issue this is the proper xpath

Ảnh đại diện
Huỷ bỏ

Superb!!!!!!. Actually xpath is //sheet/group/group after this source code has two groups. So there is confusion. No group name defined. Above code is perfect. Thanks a lot.

Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 1 24
18395
2
thg 11 24
2899
1
thg 11 23
3186
1
thg 9 23
4612
0
thg 4 21
3491