pricing list tets case fixes
This commit is contained in:
parent
8de61559b0
commit
ccb9826afd
@ -223,7 +223,7 @@
|
|||||||
"icon": "icon-gift",
|
"icon": "icon-gift",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"modified": "2014-05-27 15:14:34.849671",
|
"modified": "2014-05-28 15:36:29.403659",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Pricing Rule",
|
"name": "Pricing Rule",
|
||||||
|
@ -72,7 +72,7 @@ class TestPricingRule(unittest.TestCase):
|
|||||||
|
|
||||||
frappe.db.sql("update `tabPricing Rule` set priority=NULL where campaign='_Test Campaign'")
|
frappe.db.sql("update `tabPricing Rule` set priority=NULL where campaign='_Test Campaign'")
|
||||||
from erpnext.stock.get_item_details import MultiplePricingRuleConflict
|
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"
|
args.item_code = "_Test Item 2"
|
||||||
details = get_item_details(args)
|
details = get_item_details(args)
|
||||||
|
@ -260,11 +260,11 @@ def apply_pricing_rule(args):
|
|||||||
args.item_group, args.brand = frappe.db.get_value("Item",
|
args.item_group, args.brand = frappe.db.get_value("Item",
|
||||||
args.item_code, ["item_group", "brand"])
|
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_group, args.territory = frappe.db.get_value("Customer",
|
||||||
args.customer, ["customer_group", "territory"])
|
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")
|
args.supplier_type = frappe.db.get_value("Supplier", args.supplier, "supplier_type")
|
||||||
|
|
||||||
pricing_rules = get_pricing_rules(args)
|
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):
|
if if_all_rules_same(pricing_rules, remaining_fields):
|
||||||
pricing_rules = apply_internal_priority(pricing_rules, field_set, args)
|
pricing_rules = apply_internal_priority(pricing_rules, field_set, args)
|
||||||
break
|
break
|
||||||
|
|
||||||
if len(pricing_rules) > 1:
|
if len(pricing_rules) > 1:
|
||||||
price_or_discount = list(set([d.price_or_discount for d in pricing_rules]))
|
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":
|
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:
|
if len(pricing_rules) > 1:
|
||||||
frappe.throw(_("Multiple Price Rule exists with same criteria, please resolve \
|
frappe.throw(_("Multiple Price Rule exists with same criteria, please resolve \
|
||||||
|
Loading…
Reference in New Issue
Block a user