[FIX] sale_coupon: Prommotional program applied on canceled SO

Steps to reproduce the bug:

- Create a promotional program P with 'Fixed amount' discount of $50 and 'Automatically applied' on current order
- Create SO and cancel it

Bug:

P was applied on the canceled SO

opw:2579344

closes odoo/odoo#77455

X-original-commit: 8f11cabcb605cab5c83e4889156e4979d55aa517
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
Goffin Simon
2021-10-04 09:16:00 +00:00
parent b34d68c842
commit 546ce6416b
+2 -1
View File
@@ -30,7 +30,8 @@ class SaleOrder(models.Model):
def recompute_coupon_lines(self):
for order in self:
order._remove_invalid_reward_lines()
order._create_new_no_code_promo_reward_lines()
if order.state != 'cancel':
order._create_new_no_code_promo_reward_lines()
order._update_existing_reward_lines()
@api.returns('self', lambda value: value.id)