test: Update test cases

(cherry picked from commit 65232edfd5)

# Conflicts:
#	erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py
#	erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py
This commit is contained in:
Deepesh Garg
2022-05-16 10:52:58 +05:30
committed by Mergify
parent 4ca6cdca76
commit 0628785c64
2 changed files with 49 additions and 1 deletions

View File

@@ -79,9 +79,14 @@ class TestPeriodClosingVoucher(unittest.TestCase):
rate=400,
debit_to="Debtors - TPC",
<<<<<<< HEAD
<<<<<<< HEAD
=======
currency="USD"
>>>>>>> 60915e874d (test: Update test cases for currency change validation)
=======
currency="USD",
customer="_Test Customer USD",
>>>>>>> 65232edfd5 (test: Update test cases)
)
create_sales_invoice(
company=company,
@@ -91,9 +96,14 @@ class TestPeriodClosingVoucher(unittest.TestCase):
rate=200,
debit_to="Debtors - TPC",
<<<<<<< HEAD
<<<<<<< HEAD
=======
currency="USD"
>>>>>>> 60915e874d (test: Update test cases for currency change validation)
=======
currency="USD",
customer="_Test Customer USD",
>>>>>>> 65232edfd5 (test: Update test cases)
)
pcv = self.make_period_closing_voucher(submit=False)
@@ -127,14 +137,17 @@ class TestPeriodClosingVoucher(unittest.TestCase):
surplus_account = create_account()
cost_center = create_cost_center("Test Cost Center 1")
create_sales_invoice(
si = create_sales_invoice(
company=company,
income_account="Sales - TPC",
expense_account="Cost of Goods Sold - TPC",
cost_center=cost_center,
rate=400,
debit_to="Debtors - TPC",
currency="USD",
customer="_Test Customer USD",
)
jv = make_journal_entry(
account1="Cash - TPC",
account2="Sales - TPC",

View File

@@ -768,6 +768,41 @@ class TestPricingRule(unittest.TestCase):
frappe.get_doc("Item Price", {"item_code": "Water Flask"}).delete()
item.delete()
<<<<<<< HEAD
=======
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)
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")
>>>>>>> 65232edfd5 (test: Update test cases)
test_dependencies = ["Campaign"]