[Fix] Ignore pricing rule not removed the discount percentage
diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
index f298bc8..b36898a 100644
--- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
+++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
@@ -126,6 +126,8 @@
 	})
 	
 	if args.ignore_pricing_rule or not args.item_code:
+		if args.name and args.get("pricing_rule"):
+			item_details = remove_pricing_rule(args, item_details)
 		return item_details
 
 	if not (args.item_group and args.brand):
@@ -166,9 +168,16 @@
 		else:
 			item_details.discount_percentage = pricing_rule.discount_percentage
 	elif args.get('pricing_rule'):
-		if frappe.db.get_value('Pricing Rule', args.get('pricing_rule'), 'price_or_discount') == 'Discount Percentage':
-			item_details.discount_percentage = 0.0
+		item_details = remove_pricing_rule(args, item_details)
 
+	return item_details
+
+def remove_pricing_rule(args, item_details):
+	pricing_rule = frappe.db.get_value('Pricing Rule', args.get('pricing_rule'), ['price_or_discount', 'margin_type'], as_dict=1)
+	if pricing_rule and pricing_rule.price_or_discount == 'Discount Percentage':
+		item_details.discount_percentage = 0.0
+
+	if pricing_rule and pricing_rule.margin_type in ['Percentage', 'Amount']:
 		item_details.margin_rate_or_amount = 0.0
 		item_details.margin_type = None