From 985c16cf6be68892f2abb9068f179dcfec867bf8 Mon Sep 17 00:00:00 2001 From: Demesmaeker Date: Thu, 11 Apr 2024 11:20:00 +0200 Subject: [PATCH] [FIX] sale_loyalty: open wizard to select reward defined by tag Currently, when there is only one loyalty program available for an order, we apply it automatically without opening the wizard. This is a problem when the reward is a free product among all with a specific tags because the user can not choose it (it takes the first one by default) We now automatically apply only when there is only one reward possible opw-3774944 closes odoo/odoo#161442 Signed-off-by: Morgane Demesmaeker --- addons/sale_loyalty/models/sale_order.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/sale_loyalty/models/sale_order.py b/addons/sale_loyalty/models/sale_order.py index 4890ba628ef..5d1358134a8 100644 --- a/addons/sale_loyalty/models/sale_order.py +++ b/addons/sale_loyalty/models/sale_order.py @@ -101,7 +101,8 @@ class SaleOrder(models.Model): claimable_rewards = self._get_claimable_rewards() if len(claimable_rewards) == 1: coupon = next(iter(claimable_rewards)) - if len(claimable_rewards[coupon]) == 1: + rewards = claimable_rewards[coupon] + if len(rewards) == 1 and not rewards.multi_product: self._apply_program_reward(claimable_rewards[coupon], coupon) return True elif not claimable_rewards: