Skip to content

Commit

Permalink
fix: expense causing p&l test case to fail
Browse files Browse the repository at this point in the history
(cherry picked from commit 01888c9)
  • Loading branch information
rtdany10 authored and mergify[bot] committed Apr 29, 2024
1 parent 62966ac commit acfee42
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,10 @@ def test_zero_months(self):
]
self.assertEqual(report.period_total, expected)

@change_settings("Accounts Settings", {"book_deferred_entries_based_on": "Months"})
@change_settings(
"Accounts Settings",
{"book_deferred_entries_based_on": "Months", "book_deferred_entries_via_journal_entry": 0},
)
def test_zero_amount(self):
self.create_item("_Test Office Desk", 0, self.warehouse, self.company)
item = frappe.get_doc("Item", self.item)
Expand All @@ -295,7 +298,7 @@ def test_zero_amount(self):
supplier=self.supplier,
is_return=False,
update_stock=False,
posting_date=frappe.utils.datetime.date(2023, 12, 30),
posting_date=frappe.utils.datetime.date(2021, 12, 30),
parent_cost_center=self.cost_center,
cost_center=self.cost_center,
do_not_save=True,
Expand All @@ -306,8 +309,8 @@ def test_zero_amount(self):
)
pi.set_posting_time = True
pi.items[0].enable_deferred_expense = 1
pi.items[0].service_start_date = "2023-12-30"
pi.items[0].service_end_date = "2024-12-30"
pi.items[0].service_start_date = "2021-12-30"
pi.items[0].service_end_date = "2022-12-30"
pi.items[0].deferred_expense_account = self.deferred_expense_account
pi.items[0].expense_account = self.expense_account
pi.save()
Expand All @@ -316,22 +319,22 @@ def test_zero_amount(self):
pda = frappe.get_doc(
doctype="Process Deferred Accounting",
posting_date=nowdate(),
start_date="2024-01-01",
end_date="2024-01-31",
start_date="2022-01-01",
end_date="2022-01-31",
type="Expense",
company=self.company,
)
pda.insert()
pda.submit()

# execute report
fiscal_year = frappe.get_doc("Fiscal Year", get_fiscal_year(date="2024-01-31"))
fiscal_year = frappe.get_doc("Fiscal Year", get_fiscal_year(date="2022-01-31"))
self.filters = frappe._dict(
{
"company": self.company,
"filter_based_on": "Date Range",
"period_start_date": "2024-01-01",
"period_end_date": "2024-01-31",
"period_start_date": "2022-01-01",
"period_end_date": "2022-01-31",
"from_fiscal_year": fiscal_year.year,
"to_fiscal_year": fiscal_year.year,
"periodicity": "Monthly",
Expand Down

0 comments on commit acfee42

Please sign in to comment.