From 0f575dd5234c3c044e56a74b34baa1d14d27ddca Mon Sep 17 00:00:00 2001 From: gsinghpal Date: Sun, 19 Apr 2026 15:52:01 -0400 Subject: [PATCH] test(fusion_accounting_reports): balance sheet + trial balance integration Made-with: Cursor --- fusion_accounting_reports/__manifest__.py | 2 +- fusion_accounting_reports/tests/__init__.py | 1 + .../tests/test_bs_tb_integration.py | 54 +++++++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 fusion_accounting_reports/tests/test_bs_tb_integration.py diff --git a/fusion_accounting_reports/__manifest__.py b/fusion_accounting_reports/__manifest__.py index 39bf43dd..7dd38056 100644 --- a/fusion_accounting_reports/__manifest__.py +++ b/fusion_accounting_reports/__manifest__.py @@ -1,6 +1,6 @@ { 'name': 'Fusion Accounting Reports', - 'version': '19.0.1.0.18', + 'version': '19.0.1.0.19', 'category': 'Accounting/Accounting', 'summary': 'AI-augmented financial reports (P&L, balance sheet, trial balance, GL).', 'description': """ diff --git a/fusion_accounting_reports/tests/__init__.py b/fusion_accounting_reports/tests/__init__.py index 2eb7366a..01398d5a 100644 --- a/fusion_accounting_reports/tests/__init__.py +++ b/fusion_accounting_reports/tests/__init__.py @@ -15,3 +15,4 @@ from . import test_reports_adapter from . import test_fusion_report_tools from . import test_engine_property from . import test_pnl_integration +from . import test_bs_tb_integration diff --git a/fusion_accounting_reports/tests/test_bs_tb_integration.py b/fusion_accounting_reports/tests/test_bs_tb_integration.py new file mode 100644 index 00000000..14ad8a20 --- /dev/null +++ b/fusion_accounting_reports/tests/test_bs_tb_integration.py @@ -0,0 +1,54 @@ +"""Integration tests for balance sheet + trial balance.""" + +from datetime import date + +from odoo.tests.common import TransactionCase, tagged + +from odoo.addons.fusion_accounting_reports.services.date_periods import Period + + +@tagged('post_install', '-at_install', 'integration') +class TestBalanceSheetIntegration(TransactionCase): + + def test_balance_sheet_includes_total_assets(self): + result = self.env['fusion.report.engine'].compute_balance_sheet( + date(2026, 12, 31), company_id=self.env.company.id) + labels = [r['label'] for r in result['rows']] + self.assertIn('TOTAL ASSETS', labels) + self.assertIn('TOTAL LIABILITIES', labels) + self.assertIn('TOTAL EQUITY', labels) + + def test_balance_sheet_total_assets_is_subtotal(self): + result = self.env['fusion.report.engine'].compute_balance_sheet( + date(2026, 12, 31), company_id=self.env.company.id) + ta = next( + (r for r in result['rows'] if r['label'] == 'TOTAL ASSETS'), + None, + ) + self.assertIsNotNone(ta) + self.assertTrue(ta['is_subtotal']) + + def test_balance_sheet_returns_period(self): + result = self.env['fusion.report.engine'].compute_balance_sheet( + date(2026, 4, 19), company_id=self.env.company.id) + self.assertEqual(result['period']['date_to'], '2026-04-19') + + +@tagged('post_install', '-at_install', 'integration') +class TestTrialBalanceIntegration(TransactionCase): + + def test_trial_balance_returns_all_5_groups(self): + period = Period(date(2026, 1, 1), date(2026, 12, 31), 'Test 2026') + result = self.env['fusion.report.engine'].compute_trial_balance( + period, company_id=self.env.company.id) + labels = [r['label'] for r in result['rows']] + for label in ('Assets', 'Liabilities', 'Equity', 'Income', 'Expenses'): + self.assertIn(label, labels) + + def test_trial_balance_has_total_subtotal(self): + period = Period(date(2026, 1, 1), date(2026, 12, 31), 'Test 2026') + result = self.env['fusion.report.engine'].compute_trial_balance( + period, company_id=self.env.company.id) + last = result['rows'][-1] + self.assertEqual(last['label'], 'Total (should be 0)') + self.assertTrue(last['is_subtotal'])