[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) <jcb@odoo.com> Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user