diff --git a/addons/account_discount/models/account_invoice.py b/addons/account_discount/models/account_invoice.py index 73c0a382..e4ae74d1 100644 --- a/addons/account_discount/models/account_invoice.py +++ b/addons/account_discount/models/account_invoice.py @@ -121,10 +121,11 @@ class AccountInvoice(models.Model): values = self.get_maximum_per_amount() if self.discount < 0: raise Warning(_("Discount should be less than Gross Amount")) - if self.discount > self.gross_amount: + discount = self.discount or self.discount_amount + if discount > self.gross_amount: raise Warning(_("Discount (%s) should be less than " "Gross Amount (%s).") % ( - formatLang(self.env, self.discount, digits=2), + formatLang(self.env, discount, digits=2), formatLang(self.env, self.gross_amount, digits=2))) if self.discount > values.get('max_amount', False) \ and values.get('check_group', False): diff --git a/addons/account_discount/report/custom_invoice_report.xml b/addons/account_discount/report/custom_invoice_report.xml index 5d4c7d5b..acc8ed8b 100644 --- a/addons/account_discount/report/custom_invoice_report.xml +++ b/addons/account_discount/report/custom_invoice_report.xml @@ -2,56 +2,57 @@