diff --git a/addons/point_of_sale/models/pos_order.py b/addons/point_of_sale/models/pos_order.py index 061e381438e..40b6cbbfa34 100644 --- a/addons/point_of_sale/models/pos_order.py +++ b/addons/point_of_sale/models/pos_order.py @@ -105,6 +105,9 @@ class PosOrder(models.Model): }) # bypass opening_control (necessary when using cash control) new_session.action_pos_session_open() + if new_session.config_id.cash_control and new_session.rescue: + last_session = self.env['pos.session'].search([('config_id', '=', new_session.config_id.id), ('id', '!=', new_session.id)], limit=1) + new_session.cash_register_balance_start = last_session.cash_register_balance_end_real return new_session diff --git a/addons/point_of_sale/tests/test_point_of_sale_flow.py b/addons/point_of_sale/tests/test_point_of_sale_flow.py index 17842c592f2..cfde83c9eaf 100644 --- a/addons/point_of_sale/tests/test_point_of_sale_flow.py +++ b/addons/point_of_sale/tests/test_point_of_sale_flow.py @@ -688,6 +688,7 @@ class TestPointOfSaleFlow(TestPointOfSaleCommon): rescue_session.post_closing_cash_details(total_cash_payment) rescue_session.close_session_from_ui() self.assertEqual(rescue_session.state, 'closed', "Rescue session was not properly closed") + self.assertEqual(rescue_session.cash_register_balance_start, current_session.cash_register_balance_end_real, "Rescue session does not start with the same amount as the previous session") def test_order_to_payment_currency(self): """