Skip to content

Commit

Permalink
perf: skip get_pricing_rules if no pricing rule exists
Browse files Browse the repository at this point in the history
  • Loading branch information
nextchamp-saqib committed Oct 12, 2021
1 parent 569dc5f commit a500252
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions erpnext/accounts/doctype/pricing_rule/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ def get_pricing_rules(args, doc=None):
pricing_rules = []
values = {}

if not frappe.db.exists('Pricing Rule', {'disable': 0, args.transaction_type: 1}):
return

for apply_on in ['Item Code', 'Item Group', 'Brand']:
pricing_rules.extend(_get_pricing_rules(apply_on, args, values))
if pricing_rules and not apply_multiple_pricing_rules(pricing_rules):
Expand Down

0 comments on commit a500252

Please sign in to comment.