From c162e3489f64bb7eee244e58f5498fc0ab71f51f Mon Sep 17 00:00:00 2001 From: Joren Van Onder <jov@odoo.com> Date: Wed, 11 May 2016 08:56:21 +0200 Subject: [PATCH] [IMP] point_of_sale: verbose logging when dealing with 'rescue' sessions When dealing with issues related to 'rescue' sessions we are very limited in what we can do because the actual orders sent to the backend exist only in localStorage in the browser on the device of the user. Because of this it is important that we log some data about the orders we receive in the backend to have an idea of what's going on. opw-676497 --- addons/point_of_sale/point_of_sale.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index b52bb92ec172..68f4016b32c5 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -689,9 +689,21 @@ class pos_order(osv.osv): ('user_id', '=', closed_session.user_id.id)], limit=1, order="start_at DESC", context=context) + _logger.warning('session %s (ID: %s) was closed but received order %s (total: %s) belonging to it', + closed_session.name, + closed_session.id, + order['name'], + order['amount_total']) + if open_sessions: - return open_sessions[0] + open_session = session.browse(cr, uid, open_sessions[0], context=context) + _logger.warning('using session %s (ID: %s) for order %s instead', + open_session.name, + open_session.id, + order['name']) + return open_session.id else: + _logger.warning('attempting to create new session for order %s', order['name']) new_session_id = session.create(cr, uid, { 'config_id': closed_session.config_id.id, }, context=context) -- GitLab