diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py index b36898a8078..3b3184c92b4 100644 --- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py +++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py @@ -126,7 +126,7 @@ def get_pricing_rule_for_item(args): }) if args.ignore_pricing_rule or not args.item_code: - if args.name and args.get("pricing_rule"): + if frappe.db.exists(args.doctype, args.name) and args.get("pricing_rule"): item_details = remove_pricing_rule(args, item_details) return item_details