From a77f644fd2d3ee89463b0ab62f6d61fbf17b408f Mon Sep 17 00:00:00 2001 From: "Thomas Lefebvre (thle)" Date: Tue, 10 Jan 2023 13:25:56 +0000 Subject: [PATCH] [FIX] sale_loyalty: find sequence of a non-iterable Steps to reproduce: - go to e-commerce; - add a product to the cart; - add a gift card; - remove the product from the cart. Issue: A traceback appears. Cause: We are trying to find the maximum of a non-iterable object. Introduced by 7004b17ee5433e3b14561358348b42326f549261 opw-3114090 closes odoo/odoo#109635 X-original-commit: ae074117db7e7da1ba36a9151fae12bc16fb15ed Signed-off-by: William Braeckman (wbr) --- addons/sale_loyalty/models/sale_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale_loyalty/models/sale_order.py b/addons/sale_loyalty/models/sale_order.py index 96294052763..54fe6b81c0f 100644 --- a/addons/sale_loyalty/models/sale_order.py +++ b/addons/sale_loyalty/models/sale_order.py @@ -146,7 +146,7 @@ class SaleOrder(models.Model): 'points_cost': cost, 'reward_identifier_code': _generate_random_reward_code(), 'product_uom': product.uom_id.id, - 'sequence': max(self.order_line.filtered(lambda x: not x.is_reward_line).mapped('sequence')) + 1, + 'sequence': max(self.order_line.filtered(lambda x: not x.is_reward_line).mapped('sequence'), default=10) + 1, 'tax_id': [(Command.CLEAR, 0, 0)] + [(Command.LINK, tax.id, False) for tax in taxes] }]