@@ -2050,23 +2050,41 @@ def test_opening_entries_roll_into_opening_after_period_closing(self):
20502050 query_builder = FinancialQueryBuilder (filters , periods )
20512051 accounts = [
20522052 frappe ._dict ({"name" : cash_account , "account_name" : "Cash" , "account_number" : "1001" }),
2053+ frappe ._dict (
2054+ {
2055+ "name" : opening_offset_account ,
2056+ "account_name" : "Temporary Opening" ,
2057+ "account_number" : "1900" ,
2058+ }
2059+ ),
20532060 ]
20542061
20552062 balances_data = query_builder .fetch_account_balances (accounts )
20562063 cash_data = balances_data .get (cash_account )
2064+ offset_data = balances_data .get (opening_offset_account )
20572065 self .assertIsNotNone (cash_data , "Cash account should exist in results" )
2066+ self .assertIsNotNone (offset_data , "Offset account should exist in results" )
20582067
2059- year_2024 = cash_data .get_period ("2024" )
2060- self .assertIsNotNone (year_2024 , "FY 2024 period should exist" )
2068+ year_2024_cash = cash_data .get_period ("2024" )
2069+ year_2024_offset = offset_data .get_period ("2024" )
2070+ self .assertIsNotNone (year_2024_cash , "FY 2024 period should exist for cash" )
2071+ self .assertIsNotNone (year_2024_offset , "FY 2024 period should exist for offset" )
20612072
2062- # All is_opening JVs (current + next year) roll into FY 2024 opening = 8000
2073+ # All is_opening JVs (current + next year) roll into FY 2024 opening
20632074 self .assertEqual (
2064- year_2024 .opening ,
2075+ year_2024_cash .opening ,
20652076 8000.0 ,
2066- "FY 2024 opening must combine is_opening JVs from current and next year" ,
2077+ "FY 2024 cash opening must combine is_opening JVs from current and next year" ,
20672078 )
2068- self .assertEqual (year_2024 .movement , 0.0 , "Opening JVs must not be counted as period movement" )
2069- self .assertEqual (year_2024 .closing , 8000.0 , "Closing = opening when no non-opening movement" )
2079+ self .assertEqual (
2080+ year_2024_offset .opening ,
2081+ - 8000.0 ,
2082+ "FY 2024 offset opening must combine is_opening JVs from current and next year" ,
2083+ )
2084+ self .assertEqual (
2085+ year_2024_cash .movement , 0.0 , "Opening JVs must not be counted as period movement"
2086+ )
2087+ self .assertEqual (year_2024_cash .closing , 8000.0 , "Closing = opening when no non-opening movement" )
20702088
20712089 finally :
20722090 frappe .db .set_single_value (
0 commit comments