From 605b94e64c202d7dbb335ce37280fae87a3a6d87 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Fri, 15 Apr 2016 10:03:53 +0200 Subject: [PATCH] [FIX] point_of_sale: do not hide transactional errors Catching and hiding database transactional errors can sometimes cause a POS order to be entirely lost. When it occurs, the transaction won't be committed into the database, and if there is only one order in the batch, the server won't return any error to the frontend POS which will consider the order saved. --- addons/point_of_sale/point_of_sale.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index fbe0e3c1241..05a3dcb4339 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -24,6 +24,7 @@ from dateutil.relativedelta import relativedelta from decimal import Decimal import logging import pdb +import psycopg2 import time import openerp @@ -537,6 +538,9 @@ class pos_order(osv.osv): wf_service = netsvc.LocalService("workflow") try: wf_service.trg_validate(uid, 'pos.order', order_id, 'paid', cr) + except psycopg2.OperationalError: + # do not hide transactional errors, the order(s) won't be saved! + raise except Exception: _logger.error('ERROR: Could not fully process the POS Order', exc_info=True) return order_ids