From 39a41e742767bf24832898d4d75dcf19c2e882e4 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 28 Mar 2019 16:51:57 +0530 Subject: [PATCH] fix: pricing rule mixed connditions not working for item group --- erpnext/accounts/doctype/pricing_rule/utils.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/pricing_rule/utils.py b/erpnext/accounts/doctype/pricing_rule/utils.py index e12771b8ba..40b8a34848 100644 --- a/erpnext/accounts/doctype/pricing_rule/utils.py +++ b/erpnext/accounts/doctype/pricing_rule/utils.py @@ -14,6 +14,12 @@ from erpnext.stock.get_item_details import get_conversion_factor class MultiplePricingRuleConflict(frappe.ValidationError): pass +apply_on_table = { + 'Item Code': 'items', + 'Item Group': 'item_groups', + 'Brand': 'brands' +} + def get_pricing_rules(args, doc=None): pricing_rules = [] values = {} @@ -490,4 +496,7 @@ def apply_pricing_rule(doc, pr_doc, pr_row, item_row, value): def get_pricing_rule_items(pr_doc): apply_on = frappe.scrub(pr_doc.get('apply_on')) - return [item.get(apply_on) for item in pr_doc.items] or [] \ No newline at end of file + + pricing_rule_apply_on = apply_on_table.get(pr_doc.get('apply_on')) + + return [item.get(apply_on) for item in pr_doc.get(pricing_rule_apply_on)] or [] \ No newline at end of file