perf: skip get_pricing_rules if no pricing rule exists

(cherry picked from commit a500252570)
This commit is contained in:
Saqib Ansari
2021-10-12 13:25:55 +05:30
committed by mergify-bot
parent cb97e950e6
commit de38c70707

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