From 8fe0639d0a27452ffc4726facad5829bfb1ed11f Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 18 Apr 2017 15:00:42 +0200 Subject: [PATCH] [IMP] point_of_sale: display failing orders When closing a session is failing, explain which order fails and why. Allow to quickly see payment or rounding issues. --- addons/point_of_sale/models/pos_session.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/models/pos_session.py b/addons/point_of_sale/models/pos_session.py index 07db76c8af8..e9d721600e3 100644 --- a/addons/point_of_sale/models/pos_session.py +++ b/addons/point_of_sale/models/pos_session.py @@ -27,7 +27,14 @@ class PosSession(models.Model): orders.with_context(force_company=company_id)._create_account_move_line(session, move) for order in session.order_ids.filtered(lambda o: o.state not in ['done', 'invoiced']): if order.state not in ('paid'): - raise UserError(_("You cannot confirm all orders of this session, because they don't have the 'paid' status")) + raise UserError( + _("You cannot confirm all orders of this session, because they have not the 'paid' status.\n" + "{reference} is in state {state}, total amount: {total}, paid: {paid}").format( + reference=order.pos_reference or order.name, + state=order.state, + total=order.amount_total, + paid=order.amount_paid, + )) order.action_pos_order_done() orders = session.order_ids.filtered(lambda order: order.state == 'done') orders._reconcile_payments()