Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
8231 Vistas

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

Avatar
Descartar
Autor Mejor respuesta
   <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

Avatar
Descartar

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.

Publicaciones relacionadas Respuestas Vistas Actividad
3
ene 24
18387
2
nov 24
2883
1
nov 23
3181
1
sept 23
4605
0
abr 21
3482