From 91c94542816eb3de3e94a767ac4890caa7aeff81 Mon Sep 17 00:00:00 2001 From: thomi Date: Wed, 24 Jan 2018 13:14:47 +0100 Subject: [PATCH] [FIX] account_discount: calculation if tax option included used --- addons/account_discount/models/account_invoice.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/account_discount/models/account_invoice.py b/addons/account_discount/models/account_invoice.py index e4ae74d1..61be6c4c 100644 --- a/addons/account_discount/models/account_invoice.py +++ b/addons/account_discount/models/account_invoice.py @@ -43,7 +43,8 @@ class AccountInvoice(models.Model): self._check_constrains() for line in self.invoice_line_ids: line.write({'discount': 0.0}) - amount_untaxed = self.amount_untaxed + # amount_untaxed = self.amount_untaxed + gross_amount = self.gross_amount if self.discount_method == 'per': for line in self.invoice_line_ids: line.write({'discount': line.discount + self.discount_per}) @@ -51,7 +52,7 @@ class AccountInvoice(models.Model): for line in self.invoice_line_ids: discount_value_ratio = \ (self.discount_amount * line.price_subtotal) / \ - amount_untaxed + gross_amount discount_per_ratio = \ (discount_value_ratio * 100) / line.price_subtotal line.write({'discount': line.discount + discount_per_ratio})