From bf8bc28c07ea0b0a9704777562109b799b97eb60 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 10 Mar 2023 12:44:13 +0100 Subject: [PATCH] [FIX] account_cash_deposit: fix empty error In a cash deposit, if all lines are qty 0 but loose coin amount has a value, we must allow confirmation. --- account_cash_deposit/models/account_cash_deposit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/account_cash_deposit/models/account_cash_deposit.py b/account_cash_deposit/models/account_cash_deposit.py index d741b739..414a5af5 100644 --- a/account_cash_deposit/models/account_cash_deposit.py +++ b/account_cash_deposit/models/account_cash_deposit.py @@ -276,8 +276,8 @@ class AccountCashDeposit(models.Model): def _del_empty_lines(self, raise_if_empty=True): self.ensure_one() self.line_ids.filtered(lambda x: x.qty == 0).unlink() - if raise_if_empty and not self.line_ids: - raise UserError(_("There are no non-zero lines on %s!") % self.display_name) + if raise_if_empty and self.currency_id.is_zero(self.total_amount): + raise UserError(_("The total amount of %s is zero.") % self.display_name) def _prepare_account_move(self, vals): self.ensure_one()