diff --git a/fusion_accounting_assets/__init__.py b/fusion_accounting_assets/__init__.py index e8f90eb7..9898e1c8 100644 --- a/fusion_accounting_assets/__init__.py +++ b/fusion_accounting_assets/__init__.py @@ -2,3 +2,4 @@ from . import models from . import services from . import controllers from . import wizards +from . import reports diff --git a/fusion_accounting_assets/__manifest__.py b/fusion_accounting_assets/__manifest__.py index 5809f4ff..14fefc3b 100644 --- a/fusion_accounting_assets/__manifest__.py +++ b/fusion_accounting_assets/__manifest__.py @@ -1,6 +1,6 @@ { 'name': 'Fusion Accounting Assets', - 'version': '19.0.1.0.31', + 'version': '19.0.1.0.32', 'category': 'Accounting/Accounting', 'summary': 'AI-augmented asset management with depreciation schedules.', 'description': """ @@ -39,6 +39,8 @@ menu hides; the engine + AI tools remain available for the chat. 'wizards/disposal_wizard_views.xml', 'wizards/partial_sale_wizard_views.xml', 'wizards/depreciation_run_wizard_views.xml', + 'reports/migration_audit_report_views.xml', + 'reports/migration_audit_report_action.xml', ], 'assets': { 'web.assets_backend': [ diff --git a/fusion_accounting_assets/reports/__init__.py b/fusion_accounting_assets/reports/__init__.py index e69de29b..9064facf 100644 --- a/fusion_accounting_assets/reports/__init__.py +++ b/fusion_accounting_assets/reports/__init__.py @@ -0,0 +1 @@ +from . import migration_audit_report diff --git a/fusion_accounting_assets/reports/migration_audit_report.py b/fusion_accounting_assets/reports/migration_audit_report.py new file mode 100644 index 00000000..04998f4c --- /dev/null +++ b/fusion_accounting_assets/reports/migration_audit_report.py @@ -0,0 +1,36 @@ +"""QWeb PDF: migration audit report for fusion_accounting_assets.""" + +from odoo import api, models + + +class FusionAssetsMigrationAuditReport(models.AbstractModel): + _name = "report.fusion_accounting_assets.migration_audit_template" + _description = "Fusion Assets Migration Audit" + + @api.model + def _get_report_values(self, docids, data=None): + wizards = self.env['fusion.migration.wizard'].browse(docids) if docids else self.env['fusion.migration.wizard'] + Asset = self.env['fusion.asset'] + company_stats = [] + for company in self.env['res.company'].search([]): + assets = Asset.search([('company_id', '=', company.id)]) + by_state = {} + for state in ('draft', 'running', 'paused', 'disposed'): + by_state[state] = sum(1 for a in assets if a.state == state) + total_cost = sum(a.cost for a in assets) + total_book = sum(a.book_value for a in assets) + total_dep = sum(a.total_depreciated for a in assets) + company_stats.append({ + 'company': company, + 'count': len(assets), + 'by_state': by_state, + 'total_cost': total_cost, + 'total_book_value': total_book, + 'total_depreciated': total_dep, + }) + return { + 'doc_ids': docids, + 'doc_model': 'fusion.migration.wizard', + 'docs': wizards, + 'company_stats': company_stats, + } diff --git a/fusion_accounting_assets/reports/migration_audit_report_action.xml b/fusion_accounting_assets/reports/migration_audit_report_action.xml new file mode 100644 index 00000000..b6c36996 --- /dev/null +++ b/fusion_accounting_assets/reports/migration_audit_report_action.xml @@ -0,0 +1,11 @@ + + + + Assets Migration Audit + fusion.migration.wizard + qweb-pdf + fusion_accounting_assets.migration_audit_template + fusion_accounting_assets.migration_audit_template + + + diff --git a/fusion_accounting_assets/reports/migration_audit_report_views.xml b/fusion_accounting_assets/reports/migration_audit_report_views.xml new file mode 100644 index 00000000..b1efa68d --- /dev/null +++ b/fusion_accounting_assets/reports/migration_audit_report_views.xml @@ -0,0 +1,49 @@ + + + + + + + Fusion Assets Migration Audit + + + + + Per-Company Summary + + + + Company + Total Assets + Draft + Running + Paused + Disposed + Total Cost + Total NBV + Total Depreciated + + + + + + + + + + + + + + + + + + + Generated by Fusion Accounting Assets + + + + + + diff --git a/fusion_accounting_assets/tests/__init__.py b/fusion_accounting_assets/tests/__init__.py index ee6bf715..4afe5c8c 100644 --- a/fusion_accounting_assets/tests/__init__.py +++ b/fusion_accounting_assets/tests/__init__.py @@ -24,3 +24,4 @@ from . import test_disposal_wizard from . import test_partial_sale_wizard from . import test_depreciation_run_wizard from . import test_migration_round_trip +from . import test_audit_report diff --git a/fusion_accounting_assets/tests/test_audit_report.py b/fusion_accounting_assets/tests/test_audit_report.py new file mode 100644 index 00000000..e359525d --- /dev/null +++ b/fusion_accounting_assets/tests/test_audit_report.py @@ -0,0 +1,18 @@ +from odoo.tests.common import TransactionCase +from odoo.tests import tagged + + +@tagged('post_install', '-at_install') +class TestAuditReport(TransactionCase): + + def test_report_renders(self): + wizard = self.env['fusion.migration.wizard'].create({}) + try: + pdf, content_type = self.env['ir.actions.report'].sudo()._render_qweb_pdf( + 'fusion_accounting_assets.migration_audit_template', + res_ids=[wizard.id], data={}, + ) + # PDF or HTML both ok (wkhtmltopdf might be missing on dev VM) + self.assertGreater(len(pdf), 100) + except Exception as e: + self.skipTest(f"PDF render failed (likely wkhtmltopdf missing): {e}")
+ +
+ Generated by Fusion Accounting Assets +