[IMP] Check condition if gross amount exists

This commit is contained in:
Haresh Chavda 2018-02-09 11:34:22 +05:30
parent 5b462b14b1
commit ef8fc58c3c

View File

@ -121,7 +121,7 @@ class AccountInvoice(models.Model):
if self.discount < 0: if self.discount < 0:
raise Warning(_("Discount should be less than Gross Amount")) raise Warning(_("Discount should be less than Gross Amount"))
discount = self.discount or self.discount_amount discount = self.discount or self.discount_amount
if discount > self.gross_amount: if self.gross_amount and discount > self.gross_amount:
raise Warning(_("Discount (%s) should be less than " raise Warning(_("Discount (%s) should be less than "
"Gross Amount (%s).") % ( "Gross Amount (%s).") % (
formatLang(self.env, discount, digits=2), formatLang(self.env, discount, digits=2),