Module
sale_fixed_discount
Affected version
19.0
Describe the bug
Two issues in sale_fixed_discount/views/sale_portal_templates.xml on the 19.0 branch:
1. Typo: line.fixed_discount should be line.discount_fixed
Line 30 of the portal template references a non-existent field name:
<attribute name="t-if">line.discount >= 0 or line.fixed_discount >= 0</attribute>
The field defined in models/sale_order_line.py is discount_fixed, not fixed_discount. Every other reference in the same file uses the correct name, there are 8 correct uses of discount_fixed and this single typo:
| Line |
Value |
Correct? |
| 13 |
line.discount_fixed |
✅ |
| 30 |
line.fixed_discount |
❌ typo |
| 33 |
line.discount_fixed |
✅ |
| 36 |
line.discount_fixed |
✅ |
| 39 |
line.discount_fixed |
✅ |
| 46 |
line.discount_fixed |
✅ |
| 47 |
line.discount_fixed |
✅ |
Fix:
<attribute name="t-if">line.discount >= 0 or line.discount_fixed >= 0</attribute>
Note: The typo is currently latent (does not cause a visible crash) because line.discount >= 0 evaluates to True for any standard discount value, short-circuiting the or. However it is still incorrect and would become a real bug if the condition logic were tightened (e.g. > 0).
2. Fix from 17.0 PR #3945 was not ported to 19.0
PR #3945 (open, targeting 17.0) fixes the portal not displaying the discounted unit price when a fixed discount is applied, the same symptom reported in issues #3768 and #3769. That fix was not included in the 19.0 migration (PR #4031), so the 19.0 branch still has the broken display behaviour.
The fix in #3945 replaces:
<xpath expr="//div[@t-if='line.discount']/t" position="attributes">
<attribute name="t-out">line.price_unit - line.discount_fixed</attribute>
</xpath>
with a proper t-elif sibling element so the discounted price renders when a fixed discount is set:
<xpath expr="//div[@t-if='line.discount']" position="after">
<div t-elif="line.discount_fixed">
<t
t-out="line.price_unit - line.discount_fixed"
t-options='{"widget": "float", "decimal_precision": "Product Price"}'
/>
</div>
</xpath>
Related
Module
sale_fixed_discountAffected version
19.0
Describe the bug
Two issues in
sale_fixed_discount/views/sale_portal_templates.xmlon the 19.0 branch:1. Typo:
line.fixed_discountshould beline.discount_fixedLine 30 of the portal template references a non-existent field name:
The field defined in
models/sale_order_line.pyisdiscount_fixed, notfixed_discount. Every other reference in the same file uses the correct name, there are 8 correct uses ofdiscount_fixedand this single typo:line.discount_fixedline.fixed_discountline.discount_fixedline.discount_fixedline.discount_fixedline.discount_fixedline.discount_fixedFix:
Note: The typo is currently latent (does not cause a visible crash) because
line.discount >= 0evaluates toTruefor any standard discount value, short-circuiting theor. However it is still incorrect and would become a real bug if the condition logic were tightened (e.g.> 0).2. Fix from 17.0 PR #3945 was not ported to 19.0
PR #3945 (open, targeting 17.0) fixes the portal not displaying the discounted unit price when a fixed discount is applied, the same symptom reported in issues #3768 and #3769. That fix was not included in the 19.0 migration (PR #4031), so the 19.0 branch still has the broken display behaviour.
The fix in #3945 replaces:
with a proper
t-elifsibling element so the discounted price renders when a fixed discount is set:Related
sale_fixed_discount: fix portal template #3945 : 17.0 fix (open), not yet ported to 19.0