2
0

[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.
This commit is contained in:
Alexis de Lattre 2023-03-10 12:44:13 +01:00
parent ed6e10820b
commit bf8bc28c07

View File

@ -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()