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
This commit is contained in:
gsinghpal
2026-04-19 13:25:59 -04:00
parent b6aedc9bbe
commit 6048df0645
6 changed files with 110 additions and 1 deletions

View File

@@ -2,3 +2,4 @@ from . import models
from . import controllers
from . import services
from . import wizards
from . import reports

View File

@@ -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': [

View File

@@ -0,0 +1 @@
from . import migration_audit_report

View File

@@ -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,
}

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="action_report_migration_audit" model="ir.actions.report">
<field name="name">Bank-Rec Migration Audit</field>
<field name="model">fusion.migration.wizard</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">fusion_accounting_bank_rec.migration_audit_template</field>
<field name="report_file">fusion_accounting_bank_rec.migration_audit_template</field>
<field name="binding_model_id" ref="fusion_accounting_migration.model_fusion_migration_wizard"/>
<field name="binding_type">report</field>
</record>
</odoo>

View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="migration_audit_template">
<t t-call="web.html_container">
<t t-call="web.external_layout">
<div class="page">
<h2>Bank-Rec Migration Audit</h2>
<p>
Generated
<span t-esc="context_timestamp(datetime.datetime.now()).strftime('%Y-%m-%d %H:%M')"/>
</p>
<h3>Per-Company Summary</h3>
<table class="table table-sm">
<thead>
<tr>
<th>Company</th>
<th class="text-end">Backfilled Precedents</th>
<th class="text-end">Patterns</th>
<th class="text-end">Still Unreconciled</th>
</tr>
</thead>
<tbody>
<tr t-foreach="company_stats" t-as="cs">
<td><span t-esc="cs['company'].name"/></td>
<td class="text-end"><span t-esc="cs['precedents_count']"/></td>
<td class="text-end"><span t-esc="cs['patterns_count']"/></td>
<td class="text-end"><span t-esc="cs['unreconciled_count']"/></td>
</tr>
</tbody>
</table>
<p class="text-muted">
This report verifies that Phase 1 migration successfully
bootstrapped the AI's reconcile memory from past Enterprise
reconciles.
</p>
</div>
</t>
</t>
</template>
</odoo>