[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
This commit is contained in:
Martin Trigaux
2017-05-19 16:24:09 +02:00
parent 0280354045
commit 77aaba1c05
+1 -1
View File
@@ -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')