From e96672251803c5ffe7d4d34d0e44e4a6acfca5ea Mon Sep 17 00:00:00 2001 From: "Pedram (pebr)" Date: Tue, 27 Feb 2024 10:01:58 +0100 Subject: [PATCH] [FIX] point_of_sale: prevent order duplication due to quantity rounding Before this commit, it was possible to capture an order twice due to the rounding difference in quantity, especially when users use a scale. With this commit, it uses a more relaxed condition and remove the quantity from the orderline comparison. Given that the system checks the payments and with the same product and price units, it's unlikely that two orders will have the same payment amount. opw-3735436 closes odoo/odoo#155612 X-original-commit: 9f1f8fcd272005eb2cba4bf6feee0ea0b2f2609f Signed-off-by: Joseph Caburnay (jcb) Signed-off-by: Pedram Bi Ria (pebr) --- addons/point_of_sale/models/pos_order.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/models/pos_order.py b/addons/point_of_sale/models/pos_order.py index ed07ccd05ba..d36df22c272 100644 --- a/addons/point_of_sale/models/pos_order.py +++ b/addons/point_of_sale/models/pos_order.py @@ -969,8 +969,8 @@ class PosOrder(models.Model): if len(data['lines']) != len(existing_order.lines): return False - received_lines = sorted([(l[2]['product_id'], l[2]['qty'], l[2]['price_unit']) for l in data['lines']]) - existing_lines = sorted([(l.product_id.id, l.qty, l.price_unit) for l in existing_order.lines]) + received_lines = sorted([(l[2]['product_id'], l[2]['price_unit']) for l in data['lines']]) + existing_lines = sorted([(l.product_id.id, l.price_unit) for l in existing_order.lines]) if received_lines != existing_lines: return False