From 77aaba1c050e85098f645ab8f5e0387beb4bef20 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 19 May 2017 16:24:09 +0200 Subject: [PATCH] [FIX] point_of_sale: do not recompute the past The cash_control flag on a session will be true if at least one payment method is cash and the config has cache control. However, the prevents to enable the flag on the config if one session in the past had no cash method. As the field is not stored, it will be recomputed if displayed (or prefetched) and raise an error, on a past session. If the session is already closed, never raise an error opw-744314 --- addons/point_of_sale/models/pos_session.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/models/pos_session.py b/addons/point_of_sale/models/pos_session.py index 76dd5a0faf6..d60767f26da 100644 --- a/addons/point_of_sale/models/pos_session.py +++ b/addons/point_of_sale/models/pos_session.py @@ -122,7 +122,7 @@ class PosSession(models.Model): session.cash_control = True session.cash_journal_id = statement.journal_id.id session.cash_register_id = statement.id - if not session.cash_control: + if not session.cash_control and session.state != 'closed': raise UserError(_("Cash control can only be applied to cash journals.")) @api.constrains('user_id', 'state')