summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuis González <lgonzalez@vauxoo.com>2020-10-18 00:31:19 +0000
committerNicolas Martinelli <nim@odoo.com>2020-10-20 15:18:41 +0000
commit746bacf680c74603f63f7b46304b8fb364e0d60e (patch)
treec4cd4b240797309900c2374f59472e20420651aa
parent4f7a314eff2725d7bf03188634eff7af9b82cd0d (diff)
[IMP] sale_management: Non-deterministic elements in views
There are currently some elements in views that are not reachable on a deterministic way when those views are inherited. That means, to reach them, positional selectors need to be used (e.g. `last()`). That causes inherited views to get broken when there are small changes in element position. A good example of this is [1]: <th class="text-right">Unit Price</th> Which can't be filtered by: - Class, because there are several `<th>` elements with the same class - Text content, because when content is translated, selector will fail To solve the above, this change provides IDs for several elements, to make possible/easier to reach them on a safely manner. [1] https://github.com/odoo/odoo/blob/54b40f1eb096/addons/sale_management/report/sale_report_templates.xml#L15 closes odoo/odoo#60378 X-original-commit: c4c45ff1533f8b9c726d4ba6563d5bdb14bd3ebb Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
-rw-r--r--addons/sale_management/report/sale_report_templates.xml16
1 files changed, 8 insertions, 8 deletions
diff --git a/addons/sale_management/report/sale_report_templates.xml b/addons/sale_management/report/sale_report_templates.xml
index 4979a49b8b4..0816394738c 100644
--- a/addons/sale_management/report/sale_report_templates.xml
+++ b/addons/sale_management/report/sale_report_templates.xml
@@ -4,28 +4,28 @@
<xpath expr="//div[@name='signature']" position="after">
<div t-if="doc.sale_order_option_ids and doc.state in ['draft', 'sent']">
<t t-set="has_option_discount" t-value="any(option.discount != 0.0 for option in doc.sale_order_option_ids)" />
- <h4>
+ <h4 name="h_optional_products">
<span>Options</span>
</h4>
- <table class="table table-sm">
+ <table name="table_optional_products" class="table table-sm">
<thead>
<tr>
- <th class="text-left">Description</th>
- <th t-if="has_option_discount" groups="product.group_discount_per_so_line" class="text-left">Disc.%</th>
- <th class="text-right">Unit Price</th>
+ <th name="th_option_name" class="text-left">Description</th>
+ <th t-if="has_option_discount" name="th_option_discount" groups="product.group_discount_per_so_line" class="text-left">Disc.%</th>
+ <th name="th_option_price_unit" class="text-right">Unit Price</th>
</tr>
</thead>
<tbody class="sale_tbody">
<tr t-foreach="doc.sale_order_option_ids" t-as="option">
- <td>
+ <td name="td_option_name">
<span t-field="option.name"/>
</td>
- <td t-if="has_option_discount" groups="product.group_discount_per_so_line">
+ <td t-if="has_option_discount" name="td_option_discount" groups="product.group_discount_per_so_line">
<strong t-if="option.discount != 0.0" class="text-info">
<t t-esc="((option.discount % 1) and '%s' or '%d') % option.discount"/>%
</strong>
</td>
- <td>
+ <td name="td_option_price_unit">
<strong class="text-right">
<div t-field="option.price_unit"
t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'