[FIX] sale: safer inheritance of res.partner form view + no hiding of use_parent_addr...
[odoo/odoo.git] / addons / sale / res_partner_view.xml
index 40ac119..5107f0c 100644 (file)
                     <attribute name="invisible">False</attribute>
                     <attribute name="groups">sale.group_delivery_invoice_address</attribute>
                 </xpath>
-                <xpath expr="//field[@name='use_parent_address']" position="attributes">
+                <!--  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 -->
+                <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='use_parent_address']" position="attributes">
-                    <attribute name="invisible">False</attribute>
-                    <attribute name="groups">sale.group_delivery_invoice_address</attribute>
-                </xpath>
-                <xpath expr="//field[@name='child_ids']//field[@name='use_parent_address']" position="attributes">
-                    <attribute name="invisible">False</attribute>
-                    <attribute name="groups">sale.group_delivery_invoice_address</attribute>
-                </xpath>
-                <xpath expr="//field[@name='child_ids']//label[@for='use_parent_address']" position="attributes">
-                    <attribute name="invisible">False</attribute>
-                    <attribute name="groups">sale.group_delivery_invoice_address</attribute>
-                </xpath>
-                <xpath expr="//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="//field[@name='child_ids']//label[@for='type']" position="attributes">
+                <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>