Skip to content
Snippets Groups Projects
Commit 36d4c998 authored by Goffin Simon's avatar Goffin Simon Committed by Christophe Simonis
Browse files

[FIX] sale_coupon: Promotion code removed when adding in shopping cart

Steps to reproduce:
- Create a sale.coupon.program with a discount of 10% and generate coupons for it
- Go on the shop and add a product of 100€ in the cart
- Go in your shopping cart and add a promotion code
- A new line has been created in your cart with a discount of 10€
- Click on "Process to checkout"

Bug:

The discount had been removed from the cart

Technically:

When clicking on button "Process to checkout", the function "recompute_coupon_lines" is called several times.
The second time, in function "_remove_invalid_reward_lines", the valid applied coupon program couldn't be retrieved
due to the sale price of the discount_line_product_id = -1000000 €. The function _filter_on_mimimum_amount filtered
the targted program  because the untaxed_amount of the order was equal to -999900€. So the program._compute_program_amount
was all the time greater than untaxed_amount or untaxed_amount + tax_amount

It s not consistant to set a default value to -1000000 to prevent pricelist strikethrough because in some currencies,-1000000 is not enough.
Now the reward lines are not strikethrough.

X-port/cherry-pick of odoo/enterprise@2748249c0b0674d659a363bae4acbc7b4c230dc7

opw:1957671
parent 3a3f7fd5
No related branches found
No related tags found
No related merge requests found
......@@ -101,7 +101,7 @@ class SaleCouponProgram(models.Model):
'sale_ok': False,
'purchase_ok': False,
'invoice_policy': 'order',
'lst_price': -1000000, # Prevent pricelist strikethrough as negative value will always be lower then default 1$
'lst_price': 0, #Do not set a high value to avoid issue with coupon code
})
program.write({'discount_line_product_id': discount_line_product_id.id})
return program
......
......@@ -20,6 +20,9 @@
<span class="js_quantity text-muted" t-esc="int(line.product_uom_qty)"/>
</t>
</xpath>
<xpath expr="//del" position="attributes">
<attribute name="t-if">not line.is_reward_line</attribute>
</xpath>
</template>
<template id="sale_coupon_result" inherit_id="website_sale.coupon_form">
<xpath expr="//form[@name='coupon_code']" position="after">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment