|
return (self.discount_fixed / self.price_unit) * 100 |
The _get_discount_from_fixed_discount method currently calculates the discount percentage based only on price_unit and discount_fixed.
This approach does not consider the quantity of items, which can lead to incorrect discount percentages when more than one unit is sold.
if float_is_zero(self.quantity, precision_rounding=currency.rounding): return 0.0
return (self.discount_fixed / (self.price_unit * self.quantity)) * 100
account-invoicing/account_invoice_fixed_discount/models/account_move_line.py
Line 88 in 205d33f
The _get_discount_from_fixed_discount method currently calculates the discount percentage based only on price_unit and discount_fixed.
This approach does not consider the quantity of items, which can lead to incorrect discount percentages when more than one unit is sold.
if float_is_zero(self.quantity, precision_rounding=currency.rounding): return 0.0return (self.discount_fixed / (self.price_unit * self.quantity)) * 100