Merge pull request #17040 from rohitwaghchaure/pricing_rule_not_working_for_item_groups

fix: pricing rule mixed connditions not working for item group
This commit is contained in:
rohitwaghchaure 2019-03-28 16:52:55 +05:30 committed by GitHub
commit a8c9b81d93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 []
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 []