[FIX] point_of_sale: delete cash statement if no sale
Suppose a POS with setting 'Advanced Cash Control' enabled. The user starts/closes a POS session (no sale, no cash difference). In Accounting > Cash, a bank statement exists, has no line and its starting balance is equal to its ending balance. The user has then to add a zero line, post an validate the bank statement. In such situation, the bank statement should be automatically deleted when closing the session OPW-2507394 closes odoo/odoo#71987 X-original-commit: 760c1b19229e2971ada911cd5607ceaea36e982f Signed-off-by: Adrien Widart <adwid@users.noreply.github.com> Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
This commit is contained in:
@@ -333,7 +333,10 @@ class PosSession(models.Model):
|
||||
self.env['pos.order'].search([('session_id', '=', self.id), ('state', '=', 'paid')]).write({'state': 'done'})
|
||||
else:
|
||||
self.move_id.unlink()
|
||||
|
||||
elif not self.cash_register_id.difference:
|
||||
cash_register = self.cash_register_id
|
||||
cash_register.pos_session_id = False
|
||||
cash_register.unlink()
|
||||
self.write({'state': 'closed'})
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
|
||||
Reference in New Issue
Block a user