From 5e9e93ca6cb537c7dcab715ec2b517b027eddb9e Mon Sep 17 00:00:00 2001 From: nie Date: Fri, 15 Jan 2021 16:43:01 +0000 Subject: [PATCH] [FIX] point_of_sale: cannot close rescue session with Cash Control Steps: - Go to Point of Sale > Shop > Settings - Activate "Advanced Cash Control" - Start a new Shop session - Once in the POS go offline - Create some orders - Close the POS UI in the top-right corner - Go back online - Close the session and post the entries - Start a new session - Create an order - Close the POS UI - Close the session and post the entries - Go to Orders > Sessions - Click the rescue session - Click "Continue Selling" Bug: The user is redirected to the POS dashboard instead of opening the UI. Explanation: First, you cannot "Continue Selling" in a rescue session as seen here: https://github.com/odoo/odoo/blob/b826c96ad39fc887a735c6ca839e3796aa18dac5/addons/point_of_sale/controllers/main.py#L17-L22 This commit removes the button from the UI in this case. Then, after it has been created, the rescue session should be open and not in the 'opening_control' state as seen here: https://github.com/odoo/odoo/blob/9a8ebcc7cb05572681444ddb2511ccea4cee5565/addons/point_of_sale/models/pos_order.py#L98-L99 This is not the case anymore since https://github.com/odoo/odoo/commit/d21420d87ad8a269a0f30b3d9c0a3cee8c46cb14 opw:2427972 closes odoo/odoo#64705 X-original-commit: 71b342b8e16973eae9fdc3484b88ed135c5d2834 Signed-off-by: backspac --- addons/point_of_sale/models/pos_session.py | 2 +- addons/point_of_sale/views/pos_session_view.xml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/models/pos_session.py b/addons/point_of_sale/models/pos_session.py index 163688a762f..799677a207d 100644 --- a/addons/point_of_sale/models/pos_session.py +++ b/addons/point_of_sale/models/pos_session.py @@ -245,7 +245,7 @@ class PosSession(models.Model): values = {} if not session.start_at: values['start_at'] = fields.Datetime.now() - if session.config_id.cash_control: + if session.config_id.cash_control and not session.rescue: last_sessions = self.env['pos.session'].search([('config_id', '=', self.config_id.id)]).ids # last session includes the new one already. if len(last_sessions) > 1: diff --git a/addons/point_of_sale/views/pos_session_view.xml b/addons/point_of_sale/views/pos_session_view.xml index f1187cc0006..3381b407006 100644 --- a/addons/point_of_sale/views/pos_session_view.xml +++ b/addons/point_of_sale/views/pos_session_view.xml @@ -9,7 +9,8 @@