diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.js b/erpnext/accounts/doctype/pricing_rule/pricing_rule.js index 854f5b3888..70c039725f 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.selling = function() { 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 cd6bcf450b..59f0322acd 100644 --- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py +++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py @@ -126,6 +126,12 @@ def get_pricing_rule_for_item(args): }) 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):