mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-16 16:15:02 +00:00
chore: resolve conflicts
This commit is contained in:
@@ -1087,70 +1087,6 @@ class TestPricingRule(unittest.TestCase):
|
||||
frappe.delete_doc_if_exists("Pricing Rule", "_Test Pricing Rule 1")
|
||||
frappe.delete_doc_if_exists("Pricing Rule", "_Test Pricing Rule 2")
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
def test_pricing_rules_with_and_without_apply_multiple(self):
|
||||
item = make_item("PR Item 99")
|
||||
|
||||
test_records = [
|
||||
{
|
||||
"doctype": "Pricing Rule",
|
||||
"title": "_Test discount on item group",
|
||||
"name": "_Test discount on item group",
|
||||
"apply_on": "Item Group",
|
||||
"item_groups": [
|
||||
{
|
||||
"item_group": "Products",
|
||||
}
|
||||
],
|
||||
"selling": 1,
|
||||
"price_or_product_discount": "Price",
|
||||
"rate_or_discount": "Discount Percentage",
|
||||
"discount_percentage": 60,
|
||||
"has_priority": 1,
|
||||
"company": "_Test Company",
|
||||
"apply_multiple_pricing_rules": True,
|
||||
},
|
||||
{
|
||||
"doctype": "Pricing Rule",
|
||||
"title": "_Test fixed rate on item code",
|
||||
"name": "_Test fixed rate on item code",
|
||||
"apply_on": "Item Code",
|
||||
"items": [
|
||||
{
|
||||
"item_code": item.name,
|
||||
}
|
||||
],
|
||||
"selling": 1,
|
||||
"price_or_product_discount": "Price",
|
||||
"rate_or_discount": "Rate",
|
||||
"rate": 25,
|
||||
"has_priority": 1,
|
||||
"company": "_Test Company",
|
||||
"apply_multiple_pricing_rules": False,
|
||||
},
|
||||
]
|
||||
|
||||
for item_group_priority, item_code_priority in [(2, 4), (4, 2)]:
|
||||
item_group_rule = frappe.get_doc(test_records[0].copy())
|
||||
item_group_rule.priority = item_group_priority
|
||||
item_group_rule.insert()
|
||||
|
||||
item_code_rule = frappe.get_doc(test_records[1].copy())
|
||||
item_code_rule.priority = item_code_priority
|
||||
item_code_rule.insert()
|
||||
|
||||
si = create_sales_invoice(qty=5, customer="_Test Customer 1", item=item.name, do_not_submit=True)
|
||||
si.save()
|
||||
self.assertEqual(len(si.pricing_rules), 1)
|
||||
# Item Code rule should've applied as it has higher priority
|
||||
expected_rule = item_group_rule if item_group_priority > item_code_priority else item_code_rule
|
||||
self.assertEqual(si.pricing_rules[0].pricing_rule, expected_rule.name)
|
||||
|
||||
si.delete()
|
||||
item_group_rule.delete()
|
||||
item_code_rule.delete()
|
||||
|
||||
def test_validation_on_mixed_condition_with_recursion(self):
|
||||
pricing_rule = make_pricing_rule(
|
||||
discount_percentage=10,
|
||||
@@ -1163,7 +1099,6 @@ class TestPricingRule(unittest.TestCase):
|
||||
pricing_rule.is_recursive = True
|
||||
self.assertRaises(frappe.ValidationError, pricing_rule.save)
|
||||
|
||||
>>>>>>> eb4af58bf0 (test: validation on mixed condition and recursion on pricing rule)
|
||||
|
||||
test_dependencies = ["Campaign"]
|
||||
|
||||
|
||||
@@ -107,30 +107,6 @@ class TestPromotionalScheme(unittest.TestCase):
|
||||
price_rules = frappe.get_all("Pricing Rule", filters={"promotional_scheme": ps.name})
|
||||
self.assertEqual(price_rules, [])
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
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 test_validation_on_recurse_with_mixed_condition(self):
|
||||
ps = make_promotional_scheme()
|
||||
ps.set("price_discount_slabs", [])
|
||||
@@ -150,7 +126,6 @@ class TestPromotionalScheme(unittest.TestCase):
|
||||
ps.mixed_conditions = True
|
||||
self.assertRaises(frappe.ValidationError, ps.save)
|
||||
|
||||
>>>>>>> 9bd4e7b709 (test: validation on mixed condition with recursion)
|
||||
|
||||
def make_promotional_scheme(**args):
|
||||
args = frappe._dict(args)
|
||||
|
||||
Reference in New Issue
Block a user