diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.json b/erpnext/accounts/doctype/pricing_rule/pricing_rule.json index 5fbb08f1cf..e023dd08c3 100644 --- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.json +++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.json @@ -223,7 +223,7 @@ "icon": "icon-gift", "idx": 1, "istable": 0, - "modified": "2014-05-27 15:14:34.849671", + "modified": "2014-05-28 15:36:29.403659", "modified_by": "Administrator", "module": "Accounts", "name": "Pricing Rule", diff --git a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py index 003c6e66b4..1c53902076 100644 --- a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py +++ b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py @@ -72,7 +72,7 @@ class TestPricingRule(unittest.TestCase): frappe.db.sql("update `tabPricing Rule` set priority=NULL where campaign='_Test Campaign'") from erpnext.stock.get_item_details import MultiplePricingRuleConflict - self.assertRaises (MultiplePricingRuleConflict, get_item_details, args) + self.assertRaises(MultiplePricingRuleConflict, get_item_details, args) args.item_code = "_Test Item 2" details = get_item_details(args) diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index bd8cd3e939..fe62070640 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -260,11 +260,11 @@ def apply_pricing_rule(args): args.item_group, args.brand = frappe.db.get_value("Item", args.item_code, ["item_group", "brand"]) - if not args.get("customer_group") or not args.get("territory"): + if args.get("customer") and (not args.get("customer_group") or not args.get("territory")): args.customer_group, args.territory = frappe.db.get_value("Customer", args.customer, ["customer_group", "territory"]) - if not args.get("supplier_type"): + if args.get("supplier") and not args.get("supplier_type"): args.supplier_type = frappe.db.get_value("Supplier", args.supplier, "supplier_type") pricing_rules = get_pricing_rules(args) @@ -350,10 +350,12 @@ def filter_pricing_rules(args, pricing_rules): if if_all_rules_same(pricing_rules, remaining_fields): pricing_rules = apply_internal_priority(pricing_rules, field_set, args) break + if len(pricing_rules) > 1: price_or_discount = list(set([d.price_or_discount for d in pricing_rules])) if len(price_or_discount) == 1 and price_or_discount[0] == "Discount Percentage": - pricing_rules = filter(lambda x: x.for_price_list==args.price_list, pricing_rules) + pricing_rules = filter(lambda x: x.for_price_list==args.price_list, pricing_rules) \ + or pricing_rules if len(pricing_rules) > 1: frappe.throw(_("Multiple Price Rule exists with same criteria, please resolve \