Skip to content

Commit

Permalink
[FIX] point_of_sale: do not hide transactional errors
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
odony committed Apr 15, 2016
1 parent 38905d6 commit 605b94e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions addons/point_of_sale/point_of_sale.py
Expand Up @@ -24,6 +24,7 @@
from decimal import Decimal
import logging
import pdb
import psycopg2
import time

import openerp
Expand Down Expand Up @@ -537,6 +538,9 @@ def create_from_ui(self, cr, uid, orders, context=None):
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
Expand Down

0 comments on commit 605b94e

Please sign in to comment.