From 6048df064579edcbc027273f790baf54cfc9376e Mon Sep 17 00:00:00 2001 From: gsinghpal Date: Sun, 19 Apr 2026 13:25:59 -0400 Subject: [PATCH] feat(fusion_accounting_bank_rec): migration audit PDF report QWeb PDF showing per-company: backfilled precedent count, pattern count, remaining unreconciled bank line count. Bound to fusion.migration.wizard so it appears in the Print menu after migration runs. - reports/migration_audit_report.py defines the AbstractModel report.fusion_accounting_bank_rec.migration_audit_template, which aggregates per-company counts from fusion.reconcile.precedent (source='backfill'), fusion.reconcile.pattern, and account.bank.statement.line (is_reconciled=False). - reports/migration_audit_report_views.xml is the QWeb template. - reports/migration_audit_report_action.xml registers the ir.actions.report bound to fusion.migration.wizard. Made-with: Cursor --- fusion_accounting_bank_rec/__init__.py | 1 + fusion_accounting_bank_rec/__manifest__.py | 4 +- .../reports/__init__.py | 1 + .../reports/migration_audit_report.py | 51 +++++++++++++++++++ .../reports/migration_audit_report_action.xml | 12 +++++ .../reports/migration_audit_report_views.xml | 42 +++++++++++++++ 6 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 fusion_accounting_bank_rec/reports/__init__.py create mode 100644 fusion_accounting_bank_rec/reports/migration_audit_report.py create mode 100644 fusion_accounting_bank_rec/reports/migration_audit_report_action.xml create mode 100644 fusion_accounting_bank_rec/reports/migration_audit_report_views.xml diff --git a/fusion_accounting_bank_rec/__init__.py b/fusion_accounting_bank_rec/__init__.py index 6311ca4b..c7e7f580 100644 --- a/fusion_accounting_bank_rec/__init__.py +++ b/fusion_accounting_bank_rec/__init__.py @@ -2,3 +2,4 @@ from . import models from . import controllers from . import services from . import wizards +from . import reports diff --git a/fusion_accounting_bank_rec/__manifest__.py b/fusion_accounting_bank_rec/__manifest__.py index 60cb2be9..581ca267 100644 --- a/fusion_accounting_bank_rec/__manifest__.py +++ b/fusion_accounting_bank_rec/__manifest__.py @@ -1,6 +1,6 @@ { 'name': 'Fusion Accounting — Bank Reconciliation', - 'version': '19.0.1.0.21', + 'version': '19.0.1.0.22', 'category': 'Accounting/Accounting', 'sequence': 28, 'summary': 'Native V19 bank reconciliation widget with AI confidence scoring + behavioural learning.', @@ -33,6 +33,8 @@ Built by Nexa Systems Inc. 'data/cron.xml', 'wizards/auto_reconcile_wizard_views.xml', 'wizards/bulk_reconcile_wizard_views.xml', + 'reports/migration_audit_report_views.xml', + 'reports/migration_audit_report_action.xml', ], 'assets': { 'web.assets_backend': [ diff --git a/fusion_accounting_bank_rec/reports/__init__.py b/fusion_accounting_bank_rec/reports/__init__.py new file mode 100644 index 00000000..9064facf --- /dev/null +++ b/fusion_accounting_bank_rec/reports/__init__.py @@ -0,0 +1 @@ +from . import migration_audit_report diff --git a/fusion_accounting_bank_rec/reports/migration_audit_report.py b/fusion_accounting_bank_rec/reports/migration_audit_report.py new file mode 100644 index 00000000..0fa2c777 --- /dev/null +++ b/fusion_accounting_bank_rec/reports/migration_audit_report.py @@ -0,0 +1,51 @@ +"""QWeb PDF report: summary of bank-rec migration outcomes. + +Triggered from the migration wizard's "Print" menu after the wizard +completes. For each company on the system, reports: +- Backfilled precedents (source='backfill') +- Fusion reconcile patterns +- Bank statement lines still unreconciled + +Lets the operator confirm Phase 1 migration successfully bootstrapped +the AI's reconcile memory from past Enterprise reconciles. +""" + +from odoo import api, models + + +class FusionMigrationAuditReport(models.AbstractModel): + _name = "report.fusion_accounting_bank_rec.migration_audit_template" + _description = "Bank-Rec Migration Audit Report" + + @api.model + def _get_report_values(self, docids, data=None): + Wizard = self.env['fusion.migration.wizard'] + wizards = Wizard.browse(docids) if docids else Wizard + + Precedent = self.env['fusion.reconcile.precedent'] + Pattern = self.env['fusion.reconcile.pattern'] + Line = self.env['account.bank.statement.line'] + + company_stats = [] + for company in self.env['res.company'].search([]): + company_stats.append({ + 'company': company, + 'precedents_count': Precedent.search_count([ + ('company_id', '=', company.id), + ('source', '=', 'backfill'), + ]), + 'patterns_count': Pattern.search_count([ + ('company_id', '=', company.id), + ]), + 'unreconciled_count': Line.search_count([ + ('company_id', '=', company.id), + ('is_reconciled', '=', False), + ]), + }) + + return { + 'doc_ids': docids, + 'doc_model': 'fusion.migration.wizard', + 'docs': wizards, + 'company_stats': company_stats, + } diff --git a/fusion_accounting_bank_rec/reports/migration_audit_report_action.xml b/fusion_accounting_bank_rec/reports/migration_audit_report_action.xml new file mode 100644 index 00000000..558db4da --- /dev/null +++ b/fusion_accounting_bank_rec/reports/migration_audit_report_action.xml @@ -0,0 +1,12 @@ + + + + Bank-Rec Migration Audit + fusion.migration.wizard + qweb-pdf + fusion_accounting_bank_rec.migration_audit_template + fusion_accounting_bank_rec.migration_audit_template + + report + + diff --git a/fusion_accounting_bank_rec/reports/migration_audit_report_views.xml b/fusion_accounting_bank_rec/reports/migration_audit_report_views.xml new file mode 100644 index 00000000..fd616f0b --- /dev/null +++ b/fusion_accounting_bank_rec/reports/migration_audit_report_views.xml @@ -0,0 +1,42 @@ + + + +