[FIX] sale: safer inheritance of res.partner form view + no hiding of use_parent_address field
The use_parent_address field is not directly related to the address type field and was not really meant to be hidden along with it. In addition, the div[@name=div_type] and the corresponding label[@for=type] were duplicated in the embedded form view inside the `child_ids` field, but that happened later in the 7.0 series. As a consequence the inherited view must not rely on the presence of the latter, since some users may install sales on top of an older version of the base views. The XPath expressions were therefore modified to match the first occurrence of these elements in the original res.partner view, and to match *only* the second occurrence in the new version of the view. This works via a dirty hack relying on the fact that the `use_parent_address` field is present in the first occurrence of the div in the original view, but not in the newer view, so the XPath expression can be made to match only *one* element in each version of the view. (Keep in mind that XPath evaluation will always return results in the order of the document being looked up, and the ORM only uses the first match. So matching both nodes was not an option.) bzr revid: odo@openerp.com-20130429105458-r89mnkx8okdxsdld
This commit is contained in:
parent
3536f65967
commit
56dbd6078e
|
@ -69,27 +69,15 @@
|
|||
<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>
|
||||
|
|
Loading…
Reference in New Issue