Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
8293 มุมมอง

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

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด
   <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

อวตาร
ละทิ้ง

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.

Related Posts ตอบกลับ มุมมอง กิจกรรม
Field does not exist แก้ไขแล้ว
3
ม.ค. 24
18403
2
พ.ย. 24
2908
Blank Page After Logged in. แก้ไขแล้ว
1
พ.ย. 23
3194
1
ก.ย. 23
4616
0
เม.ย. 21
3510