fix: test cases
diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py
index fe12cf2..b75b8b8 100644
--- a/erpnext/controllers/taxes_and_totals.py
+++ b/erpnext/controllers/taxes_and_totals.py
@@ -69,12 +69,11 @@
if item.doctype in ['Quotation Item', 'Sales Order Item', 'Delivery Note Item', 'Sales Invoice Item']:
item.rate_with_margin, item.base_rate_with_margin = self.calculate_margin(item)
- if item.discount_percentage:
- if flt(item.rate_with_margin) > 0:
- item.rate = flt(item.rate_with_margin * (1.0 - (item.discount_percentage / 100.0)), item.precision("rate"))
- item.discount_amount = item.rate_with_margin - item.rate
- elif flt(item.price_list_rate) > 0:
- item.discount_amount = item.price_list_rate - item.rate
+ if flt(item.rate_with_margin) > 0:
+ item.rate = flt(item.rate_with_margin * (1.0 - (item.discount_percentage / 100.0)), item.precision("rate"))
+ item.discount_amount = item.rate_with_margin - item.rate
+ elif flt(item.price_list_rate) > 0:
+ item.discount_amount = item.price_list_rate - item.rate
elif flt(item.price_list_rate) > 0 and not item.discount_amount:
item.discount_amount = item.price_list_rate - item.rate