mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-16 19:49:18 +00:00
fix(test): pass sufficient amount to breach accumulated limit
This commit is contained in:
@@ -51,10 +51,13 @@ class TestBudget(ERPNextTestSuite):
|
|||||||
|
|
||||||
frappe.db.set_value("Budget", budget.name, "action_if_accumulated_monthly_budget_exceeded", "Stop")
|
frappe.db.set_value("Budget", budget.name, "action_if_accumulated_monthly_budget_exceeded", "Stop")
|
||||||
|
|
||||||
|
accumulated_limit = get_accumulated_monthly_budget(
|
||||||
|
budget.monthly_distribution, nowdate(), budget.fiscal_year, budget.accounts[0].budget_amount
|
||||||
|
)
|
||||||
jv = make_journal_entry(
|
jv = make_journal_entry(
|
||||||
"_Test Account Cost for Goods Sold - _TC",
|
"_Test Account Cost for Goods Sold - _TC",
|
||||||
"_Test Bank - _TC",
|
"_Test Bank - _TC",
|
||||||
40000,
|
accumulated_limit + 1,
|
||||||
"_Test Cost Center - _TC",
|
"_Test Cost Center - _TC",
|
||||||
posting_date=nowdate(),
|
posting_date=nowdate(),
|
||||||
)
|
)
|
||||||
@@ -146,7 +149,12 @@ class TestBudget(ERPNextTestSuite):
|
|||||||
frappe.db.set_value("Budget", budget.name, "action_if_accumulated_monthly_budget_exceeded", "Stop")
|
frappe.db.set_value("Budget", budget.name, "action_if_accumulated_monthly_budget_exceeded", "Stop")
|
||||||
frappe.db.set_value("Budget", budget.name, "fiscal_year", fiscal_year)
|
frappe.db.set_value("Budget", budget.name, "fiscal_year", fiscal_year)
|
||||||
|
|
||||||
po = create_purchase_order(transaction_date=nowdate(), do_not_submit=True)
|
accumulated_limit = get_accumulated_monthly_budget(
|
||||||
|
budget.monthly_distribution, nowdate(), budget.fiscal_year, budget.accounts[0].budget_amount
|
||||||
|
)
|
||||||
|
po = create_purchase_order(
|
||||||
|
transaction_date=nowdate(), qty=1, rate=accumulated_limit + 1, do_not_submit=True
|
||||||
|
)
|
||||||
|
|
||||||
po.set_missing_values()
|
po.set_missing_values()
|
||||||
|
|
||||||
@@ -164,11 +172,13 @@ class TestBudget(ERPNextTestSuite):
|
|||||||
frappe.db.set_value("Budget", budget.name, "action_if_accumulated_monthly_budget_exceeded", "Stop")
|
frappe.db.set_value("Budget", budget.name, "action_if_accumulated_monthly_budget_exceeded", "Stop")
|
||||||
|
|
||||||
project = frappe.get_value("Project", {"project_name": "_Test Project"})
|
project = frappe.get_value("Project", {"project_name": "_Test Project"})
|
||||||
|
accumulated_limit = get_accumulated_monthly_budget(
|
||||||
|
budget.monthly_distribution, nowdate(), budget.fiscal_year, budget.accounts[0].budget_amount
|
||||||
|
)
|
||||||
jv = make_journal_entry(
|
jv = make_journal_entry(
|
||||||
"_Test Account Cost for Goods Sold - _TC",
|
"_Test Account Cost for Goods Sold - _TC",
|
||||||
"_Test Bank - _TC",
|
"_Test Bank - _TC",
|
||||||
40000,
|
accumulated_limit + 1,
|
||||||
"_Test Cost Center - _TC",
|
"_Test Cost Center - _TC",
|
||||||
project=project,
|
project=project,
|
||||||
posting_date=nowdate(),
|
posting_date=nowdate(),
|
||||||
@@ -283,10 +293,13 @@ class TestBudget(ERPNextTestSuite):
|
|||||||
budget = make_budget(budget_against="Cost Center", cost_center="_Test Company - _TC")
|
budget = make_budget(budget_against="Cost Center", cost_center="_Test Company - _TC")
|
||||||
frappe.db.set_value("Budget", budget.name, "action_if_accumulated_monthly_budget_exceeded", "Stop")
|
frappe.db.set_value("Budget", budget.name, "action_if_accumulated_monthly_budget_exceeded", "Stop")
|
||||||
|
|
||||||
|
accumulated_limit = get_accumulated_monthly_budget(
|
||||||
|
budget.monthly_distribution, nowdate(), budget.fiscal_year, budget.accounts[0].budget_amount
|
||||||
|
)
|
||||||
jv = make_journal_entry(
|
jv = make_journal_entry(
|
||||||
"_Test Account Cost for Goods Sold - _TC",
|
"_Test Account Cost for Goods Sold - _TC",
|
||||||
"_Test Bank - _TC",
|
"_Test Bank - _TC",
|
||||||
40000,
|
accumulated_limit + 1,
|
||||||
"_Test Cost Center 2 - _TC",
|
"_Test Cost Center 2 - _TC",
|
||||||
posting_date=nowdate(),
|
posting_date=nowdate(),
|
||||||
)
|
)
|
||||||
@@ -313,10 +326,13 @@ class TestBudget(ERPNextTestSuite):
|
|||||||
budget = make_budget(budget_against="Cost Center", cost_center=cost_center)
|
budget = make_budget(budget_against="Cost Center", cost_center=cost_center)
|
||||||
frappe.db.set_value("Budget", budget.name, "action_if_accumulated_monthly_budget_exceeded", "Stop")
|
frappe.db.set_value("Budget", budget.name, "action_if_accumulated_monthly_budget_exceeded", "Stop")
|
||||||
|
|
||||||
|
accumulated_limit = get_accumulated_monthly_budget(
|
||||||
|
budget.monthly_distribution, nowdate(), budget.fiscal_year, budget.accounts[0].budget_amount
|
||||||
|
)
|
||||||
jv = make_journal_entry(
|
jv = make_journal_entry(
|
||||||
"_Test Account Cost for Goods Sold - _TC",
|
"_Test Account Cost for Goods Sold - _TC",
|
||||||
"_Test Bank - _TC",
|
"_Test Bank - _TC",
|
||||||
40000,
|
accumulated_limit + 1,
|
||||||
cost_center,
|
cost_center,
|
||||||
posting_date=nowdate(),
|
posting_date=nowdate(),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user