From 39fd19ffd7799301b94199390e7dfc10f9762254 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 10 Apr 2019 09:28:16 +0000 Subject: [PATCH] [FIX] point_of_sale: lost pos orders on IntegrityError This revision is similar to 605b94e64c202d7dbb335ce37280fae87a3a6d87 except that instead of an OperationalError (e.g. a conccurent update), this is an IntegrityError which is raised, an sql constraint which is not met, e.g. a unique or required constraint. In the case of this opw, this is the picking name unique constraint which was not met, the picking sequence number has somehow been re-used. Both `psycopg2.OperationalError` and `psycopg2.IntegrityError` inherits from `psycopg2.DatabaseError` We therefore choose to use this Exception class, to include all kind of psycopg2 exceptions that prevent the transaction to be committed. opw-1965679 closes odoo/odoo#32577 Signed-off-by: Denis Ledoux --- addons/point_of_sale/models/pos_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/models/pos_order.py b/addons/point_of_sale/models/pos_order.py index 21746b083ae..68ffa036317 100644 --- a/addons/point_of_sale/models/pos_order.py +++ b/addons/point_of_sale/models/pos_order.py @@ -615,7 +615,7 @@ class PosOrder(models.Model): try: pos_order.action_pos_order_paid() - except psycopg2.OperationalError: + except psycopg2.DatabaseError: # do not hide transactional errors, the order(s) won't be saved! raise except Exception as e: