changed the description of rate fields depending on margin type and if ignore pricing is unchecked returned the rate=0
diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.js b/erpnext/accounts/doctype/pricing_rule/pricing_rule.js
index 854f5b3..70c0397 100644
--- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.js
+++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.js
@@ -89,3 +89,8 @@
cur_frm.cscript.buying = function() {
cur_frm.cscript.set_options_for_applicable_for();
}
+
+//Dynamically change the description based on type of margin
+cur_frm.cscript.type = function(doc){
+ cur_frm.set_df_property('rate', 'description', doc.type=='Percentage'?'In Percentage %':'In Amount')
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
index cd6bcf4..59f0322 100644
--- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
+++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
@@ -126,6 +126,12 @@
})
if args.ignore_pricing_rule or not args.item_code:
+ # if ignore pricing rule then set the rate or amount field to zero
+ if item_details.doctype in ["Quotation Item", "Sales Order Item"]:
+ item_details.update({
+ "type":"Percentage",
+ "rate_or_amount": 0.00
+ })
return item_details
if not (args.item_group and args.brand):