[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.
This commit is contained in:
Olivier Dony 2016-04-15 10:03:53 +02:00
parent 38905d686f
commit 605b94e64c
1 changed files with 4 additions and 0 deletions

View File

@ -24,6 +24,7 @@ from dateutil.relativedelta import relativedelta
from decimal import Decimal from decimal import Decimal
import logging import logging
import pdb import pdb
import psycopg2
import time import time
import openerp import openerp
@ -537,6 +538,9 @@ class pos_order(osv.osv):
wf_service = netsvc.LocalService("workflow") wf_service = netsvc.LocalService("workflow")
try: try:
wf_service.trg_validate(uid, 'pos.order', order_id, 'paid', cr) 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: except Exception:
_logger.error('ERROR: Could not fully process the POS Order', exc_info=True) _logger.error('ERROR: Could not fully process the POS Order', exc_info=True)
return order_ids return order_ids