From ee87484134164cf2360e558fc5249e57252a1eac Mon Sep 17 00:00:00 2001 From: Afshan <33727827+AfshanKhan@users.noreply.github.com> Date: Thu, 11 Feb 2021 20:11:58 +0530 Subject: [PATCH] fix: calculated discount percentage (#24510) * fix: calculated discount percentage * fix: slider Co-authored-by: Nabin Hait --- erpnext/public/js/controllers/taxes_and_totals.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js index 22e75780b8..416495ceac 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -4,7 +4,7 @@ erpnext.taxes_and_totals = erpnext.payments.extend({ setup: function() {}, - apply_pricing_rule_on_item: function(item){ + apply_pricing_rule_on_item: function(item) { let effective_item_rate = item.price_list_rate; let item_rate = item.rate; if (in_list(["Sales Order", "Quotation"], item.parenttype) && item.blanket_order_rate) { @@ -26,6 +26,7 @@ erpnext.taxes_and_totals = erpnext.payments.extend({ if (item.discount_amount) { item_rate = flt((item.rate_with_margin) - (item.discount_amount), precision('rate', item)); + item.discount_percentage = 100 * flt(item.discount_amount) / flt(item.rate_with_margin); } frappe.model.set_value(item.doctype, item.name, "rate", item_rate);