test: pricing rule for product discounts
diff --git a/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py b/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py
index 9e576fb..9b40c98 100644
--- a/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py
+++ b/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py
@@ -107,6 +107,28 @@
price_rules = frappe.get_all("Pricing Rule", filters={"promotional_scheme": ps.name})
self.assertEqual(price_rules, [])
+ def test_pricing_rule_for_product_discount_slabs(self):
+ ps = make_promotional_scheme()
+ ps.set("price_discount_slabs", [])
+ ps.set(
+ "product_discount_slabs",
+ [
+ {
+ "rule_description": "12+1",
+ "min_qty": 12,
+ "free_item": "_Test Item 2",
+ "free_qty": 1,
+ "is_recursive": 1,
+ "recurse_for": 12,
+ }
+ ],
+ )
+ ps.save()
+ pr = frappe.get_doc("Pricing Rule", {"promotional_scheme_id": ps.product_discount_slabs[0].name})
+ self.assertSequenceEqual(
+ [pr.min_qty, pr.free_item, pr.free_qty, pr.recurse_for], [12, "_Test Item 2", 1, 12]
+ )
+
def make_promotional_scheme(**args):
args = frappe._dict(args)