Skip to Content
Menu
This question has been flagged

I want to change the position of the default phone number field in customer form and add another two fields for secondary and tertiary phone number field.

Avatar
Discard

Read more in details, Inheritance in models and views: https://goo.gl/4Zyc9d

Author

Thank you Sehrish. I'll check this out.

Best Answer

Hi Nilang,

You can do this by inheriting the view and creating an xpath expression for it. Your code should look something like this:

<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <record id="res_partner_form_view_phonechange" model="ir.ui.view">
        <field name="inherit_id" ref="base.view_partner_form"/>
        <field name="model">res.partner</field>
        <field name="arch" type="xml">
            <!-- Remove the phone field -->
            <xpath expr="//field[@name='phone']" position="replace"></xpath>
	    <!-- Add the phone field on the place you'd like -->
	    <xpath expr="//field[@name='street'"]" position="after">
	        <field name="phone"/>
		<field name="your_second_field"/>
		<field name="your_third_field"/>
	    </xpath>
	</field>
    </record>
</odoo>

Note: don't forget to first create your custom fields on the Python side (or through the frontend)

Regards,
Yenthe

Avatar
Discard
Related Posts Replies Views Activity
2
Jul 24
940
1
Jun 24
3561
1
Oct 23
8589
1
Oct 23
97
1
Aug 23
2192