feat(fusion_accounting_ai): wire ReportsAdapter fusion paths to engine
Adds three new method families on ReportsAdapter that route through fusion.report.engine when fusion_accounting_reports is installed: - run_fusion_report (pnl/balance_sheet/trial_balance/general_ledger) - get_anomalies (variance detection on engine output) - get_commentary (LLM narrative; falls back to templated) These coexist with the legacy ref_id-shaped run_report / export_report API so existing reporting tools (profit_loss, balance_sheet, etc.) keep working unchanged. FUSION_MODEL is updated to fusion.report.engine so mode detection picks FUSION when the new engine is installed. 4 new TransactionCase tests cover the fusion + community paths. Made-with: Cursor
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
'name': 'Fusion Accounting Reports',
|
||||
'version': '19.0.1.0.14',
|
||||
'version': '19.0.1.0.15',
|
||||
'category': 'Accounting/Accounting',
|
||||
'summary': 'AI-augmented financial reports (P&L, balance sheet, trial balance, GL).',
|
||||
'description': """
|
||||
|
||||
@@ -11,3 +11,4 @@ from . import test_commentary_generator
|
||||
from . import test_fusion_report_commentary
|
||||
from . import test_fusion_report_anomaly
|
||||
from . import test_reports_controller
|
||||
from . import test_reports_adapter
|
||||
|
||||
56
fusion_accounting_reports/tests/test_reports_adapter.py
Normal file
56
fusion_accounting_reports/tests/test_reports_adapter.py
Normal file
@@ -0,0 +1,56 @@
|
||||
"""Tests for ReportsAdapter Phase-2 (engine-routed) methods."""
|
||||
|
||||
from odoo.tests.common import TransactionCase, tagged
|
||||
|
||||
from odoo.addons.fusion_accounting_ai.services.data_adapters.reports import (
|
||||
ReportsAdapter,
|
||||
)
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestReportsAdapter(TransactionCase):
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.adapter = ReportsAdapter(self.env)
|
||||
|
||||
def test_run_fusion_report_via_fusion_pnl(self):
|
||||
result = self.adapter.run_fusion_report_via_fusion(
|
||||
report_type='pnl',
|
||||
date_from='2026-01-01',
|
||||
date_to='2026-12-31',
|
||||
company_id=self.env.company.id,
|
||||
)
|
||||
self.assertEqual(result.get('report_type'), 'pnl')
|
||||
self.assertIn('rows', result)
|
||||
|
||||
def test_run_fusion_report_via_community_returns_error(self):
|
||||
result = self.adapter.run_fusion_report_via_community(
|
||||
report_type='pnl',
|
||||
date_from='2026-01-01',
|
||||
date_to='2026-12-31',
|
||||
)
|
||||
self.assertIn('error', result)
|
||||
|
||||
def test_get_anomalies_via_fusion(self):
|
||||
result = self.adapter.get_anomalies_via_fusion(
|
||||
report_type='pnl',
|
||||
date_from='2026-01-01',
|
||||
date_to='2026-12-31',
|
||||
comparison='previous_year',
|
||||
company_id=self.env.company.id,
|
||||
)
|
||||
self.assertIn('anomalies', result)
|
||||
self.assertIsInstance(result['anomalies'], list)
|
||||
|
||||
def test_get_commentary_via_fusion(self):
|
||||
result = self.adapter.get_commentary_via_fusion(
|
||||
report_type='pnl',
|
||||
date_from='2026-01-01',
|
||||
date_to='2026-12-31',
|
||||
company_id=self.env.company.id,
|
||||
)
|
||||
self.assertIn('summary', result)
|
||||
self.assertIn('highlights', result)
|
||||
self.assertIn('concerns', result)
|
||||
self.assertIn('next_actions', result)
|
||||
Reference in New Issue
Block a user