Comment 5 for bug 1111340

Revision history for this message
Kalpana Hemnani(SerpentCS) (khemnani-serpentcs) wrote :

Hello Yannick Vaucher,

We have tried replacing Contact form with xpath:

    <record id="view_partner_form_usedefault_form_for_contacts" model="ir.ui.view">
        <field name="name">res.partner.form</field>
        <field name="model">res.partner</field>
        <field eval="1" name="priority"/>
        <field name="inherit_id" ref="base.view_partner_form"/>
        <field name="arch" type="xml">
            <xpath expr="//notebook/page[@string='Contacts']/field[@name='child_ids']/form[@string='Contact']" position="replace" >
                <form string="Contact"></form>
            </xpath>
        </field>
     </record>

by above view, we are able to replace Contact form. We prefer to use xpath while working with internal views.

But some fields of Contact form are inherited in sales module, so in this case we also have to remove that inheritance from sales module:

        <record id="sale.res_partner_address_type" model="ir.ui.view">
            <field name="name">res.partner.view.address_type</field>
            <field name="model">res.partner</field>
            <field name="inherit_id" ref="base.view_partner_form" />
            <field name="arch" type="xml">
                <xpath expr="//label[@for='type']" position="attributes">
                    <attribute name="groups">sale.group_delivery_invoice_address</attribute>
                    <attribute name="invisible">False</attribute>
                </xpath>
                <xpath expr="//div[@name='div_type']" position="attributes">
                    <attribute name="invisible">False</attribute>
                    <attribute name="groups">sale.group_delivery_invoice_address</attribute>
                </xpath>
                <!-- Version-specific hacks to avoid breaking view inheritance when the sale module
                      is installed on top of an older 7.0 version of the base module
                      (as the second embedded div_type was added later in the 7.0 release)
                      TODO: remove the hacks in trunk -->
<!-- comment out or remove below two xpath attributes -->
<!-- <xpath expr="//div[@name='div_type'][field[@name='use_parent_address']] | //field[@name='child_ids']//div[@name='div_type']" position="attributes"> -->
<!-- <attribute name="invisible">False</attribute> -->
<!-- <attribute name="groups">sale.group_delivery_invoice_address</attribute> -->
<!-- </xpath> -->
<!-- <xpath expr="//label[@for='type'][following-sibling::div[@name='div_type']/field[@name='use_parent_address']] | //field[@name='child_ids']//label[@for='type']" position="attributes"> -->
<!-- <attribute name="invisible">False</attribute> -->
<!-- <attribute name="groups">sale.group_delivery_invoice_address</attribute> -->
<!-- </xpath> -->
            </field>
        </record>

Hope this helps.

Thanks and Regards,
Kalpana Hemnani,
Serpent Consulting Services Pvt. Ltd.