[FIX] point_of_sale: Disallow to close set closing control when orders in draft
Before, we ended stuck while using cash control and had order in draft. While in the closing control state, we could go back to the pos to end the order but it was needed to close the session. Now we force all the orders to be done before changing the state of the session. X-original-commit: 55bd39a9854ed446d45033a3992aab0938d27a86
This commit is contained in:
committed by
Pierre Masereel
parent
6ab57140ef
commit
c8ff9d7c46
@@ -269,6 +269,8 @@ class PosSession(models.Model):
|
||||
def action_pos_session_closing_control(self, balancing_account=False, amount_to_balance=0):
|
||||
self._check_pos_session_balance()
|
||||
for session in self:
|
||||
if any(order.state == 'draft' for order in session.order_ids):
|
||||
raise UserError(_("You cannot close the POS when orders are still in draft"))
|
||||
if session.state == 'closed':
|
||||
raise UserError(_('This session is already closed.'))
|
||||
session.write({'state': 'closing_control', 'stop_at': fields.Datetime.now()})
|
||||
|
||||
Reference in New Issue
Block a user