fix: Calculate rate based on discount on server side only if not rate or pricing rule applied
diff --git a/erpnext/public/js/controllers/buying.js b/erpnext/public/js/controllers/buying.js
index 3ec27fc..f2fe3fe 100644
--- a/erpnext/public/js/controllers/buying.js
+++ b/erpnext/public/js/controllers/buying.js
@@ -147,6 +147,8 @@
},
discount_amount: function(doc, cdt, cdn) {
+ var item = frappe.get_doc(cdt, cdn);
+ item.discount_percentage = 0.0;
this.price_list_rate(doc, cdt, cdn);
},
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 5291d4f..cb01c52 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -23,6 +23,7 @@
} else {
item.discount_percentage = flt((1 - item.rate / item.price_list_rate) * 100.0,
precision("discount_percentage", item));
+ item.discount_amount = flt(item.price_list_rate) - flt(item.rate);
item.margin_type = '';
item.margin_rate_or_amount = 0;
item.rate_with_margin = 0;