Merge branch 'develop' into asset_split
diff --git a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py
index 5746a84..968137e 100644
--- a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py
+++ b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py
@@ -628,6 +628,26 @@
for doc in [si, si1]:
doc.delete()
+ def test_multiple_pricing_rules_with_min_qty(self):
+ make_pricing_rule(discount_percentage=20, selling=1, priority=1, min_qty=4,
+ apply_multiple_pricing_rules=1, title="_Test Pricing Rule with Min Qty - 1")
+ make_pricing_rule(discount_percentage=10, selling=1, priority=2, min_qty=4,
+ apply_multiple_pricing_rules=1, title="_Test Pricing Rule with Min Qty - 2")
+
+ si = create_sales_invoice(do_not_submit=True, customer="_Test Customer 1", qty=1, currency="USD")
+ item = si.items[0]
+ item.stock_qty = 1
+ si.save()
+ self.assertFalse(item.discount_percentage)
+ item.qty = 5
+ item.stock_qty = 5
+ si.save()
+ self.assertEqual(item.discount_percentage, 30)
+ si.delete()
+
+ frappe.delete_doc_if_exists("Pricing Rule", "_Test Pricing Rule with Min Qty - 1")
+ frappe.delete_doc_if_exists("Pricing Rule", "_Test Pricing Rule with Min Qty - 2")
+
test_dependencies = ["Campaign"]
def make_pricing_rule(**args):
diff --git a/erpnext/accounts/doctype/pricing_rule/utils.py b/erpnext/accounts/doctype/pricing_rule/utils.py
index 02bfc9d..7792590 100644
--- a/erpnext/accounts/doctype/pricing_rule/utils.py
+++ b/erpnext/accounts/doctype/pricing_rule/utils.py
@@ -73,7 +73,7 @@
for key in sorted(pricing_rule_dict):
pricing_rules_list.extend(pricing_rule_dict.get(key))
- return pricing_rules_list or pricing_rules
+ return pricing_rules_list
def filter_pricing_rule_based_on_condition(pricing_rules, doc=None):
filtered_pricing_rules = []