perf: skip get_pricing_rules if no pricing rule exists

This commit is contained in:
Saqib Ansari 2021-10-12 13:25:55 +05:30
parent 569dc5f6b1
commit a500252570

View File

@ -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):