From af8cc475433578aa73d03d3d5986739465bdc30c Mon Sep 17 00:00:00 2001
From: "Walid HANNICHE (waha)" <waha@odoo.com>
Date: Wed, 23 Nov 2022 11:27:07 +0000
Subject: [PATCH] [FIX] sale_coupon: move all discounts to the end of the
 sale_order

update to this PR[1]

BUG:
some discounts are still displayed on the middle of the order

FIX:
move all discounts to the end

[1]:https://github.com/odoo/odoo/pull/102700
opw-2985632

closes odoo/odoo#106322

Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
---
 addons/sale_coupon/models/sale_order.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/addons/sale_coupon/models/sale_order.py b/addons/sale_coupon/models/sale_order.py
index e057e3761472..f46374a3c762 100644
--- a/addons/sale_coupon/models/sale_order.py
+++ b/addons/sale_coupon/models/sale_order.py
@@ -393,9 +393,8 @@ class SaleOrder(models.Model):
         def update_line(order, lines, values):
             '''Update the lines and return them if they should be deleted'''
             lines_to_remove = self.env['sale.order.line']
-            # move global coupons to the end of the SO
-            if program.discount_apply_on == 'on_order':
-                values['sequence'] = max(order.order_line.mapped('sequence')) + 1
+            # move coupons to the end of the SO
+            values['sequence'] = max(order.order_line.mapped('sequence')) + 1
 
             # Check commit 6bb42904a03 for next if/else
             # Remove reward line if price or qty equal to 0
-- 
GitLab