fix(fusion_accounting_reports): expose dynamic OWL reports as menu items
User reported that after Enterprise uninstall, clicking 'Reports' opened PDF statements instead of the dynamic Fusion report viewer. Root cause: the OWL ReportViewer (registered as view_type='fusion_reports') was only reachable via the period-picker WIZARD; no menu items used the OWL view directly. Plus the JS service ignored report_code, so even within the viewer, all PnL-typed reports rendered the canonical P&L line_specs. Changes: JS layer - reports_service.js: runReport now accepts and forwards reportCode; state tracks currentReportCode so re-runs after period/comparison changes preserve the variant. - report_viewer.js: reads default_report_code (and default_comparison) from the action context. - period_filter.js: passes the cached reportCode on date changes; clears it when the user picks a different report_type. Backend - New fusion_accounting_reports/views/report_actions.xml with 11 dedicated ir.actions.act_window records, one per built-in report (P&L, Balance Sheet, Trial Balance, GL, Cash Flow, Executive Summary, Annual Statements, Aged Receivable, Aged Payable, Partner Ledger, Tax Summary). Each opens view_mode='fusion_reports' with the appropriate default_report_type + default_report_code context. - views/menu_views.xml: each report now gets its own menu item directly under Accounting > Reporting (sequence 10-40), matching Enterprise's flat structure. Custom Period wizard, XLSX export and Anomaly browser collected under a 'Tools' sub-group at the bottom. - fusion_accounting_l10n_ca: adds menu items for 'Profit and Loss (Canada)' and 'Balance Sheet (Canada)' as siblings, plus a 'Tax Returns (CA)' configuration menu. Verified live on westin-v19: - pnl rendering 3 rows, cash_flow 9, executive_summary 7, annual_statements 5, ca_profit_loss 9 \u2014 each report now renders its own line_specs correctly. - Reporting menu shows 14 Fusion report entries + Tools group. - 136/136 reports + l10n_ca tests pass. Version bumps: reports 19.0.1.1.1, l10n_ca 19.0.1.1.0. Made-with: Cursor
This commit is contained in:
@@ -15,9 +15,11 @@ export class PeriodFilter extends Component {
|
||||
async onReportTypeChange(ev) {
|
||||
const reportType = ev.target.value;
|
||||
if (reportType && this.state.dateFrom && this.state.dateTo) {
|
||||
// Switching report type clears the report_code (user is picking
|
||||
// a different category, not a variant).
|
||||
await this.reports.runReport(
|
||||
reportType, this.state.dateFrom, this.state.dateTo,
|
||||
this.state.comparison);
|
||||
this.state.comparison, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +29,8 @@ export class PeriodFilter extends Component {
|
||||
await this.reports.runReport(
|
||||
this.state.currentReportType,
|
||||
this.state.dateFrom, this.state.dateTo,
|
||||
this.state.comparison);
|
||||
this.state.comparison,
|
||||
this.state.currentReportCode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ export class ReportsService {
|
||||
this.state = reactive({
|
||||
availableReports: [],
|
||||
currentReportType: null,
|
||||
currentReportCode: null,
|
||||
currentResult: null,
|
||||
currentAnomalies: [],
|
||||
currentCommentary: null,
|
||||
@@ -41,15 +42,17 @@ export class ReportsService {
|
||||
}
|
||||
}
|
||||
|
||||
async runReport(reportType, dateFrom, dateTo, comparison = 'none') {
|
||||
async runReport(reportType, dateFrom, dateTo, comparison = 'none', reportCode = null) {
|
||||
this.state.isLoading = true;
|
||||
this.state.currentReportType = reportType;
|
||||
this.state.currentReportCode = reportCode;
|
||||
this.state.dateFrom = dateFrom;
|
||||
this.state.dateTo = dateTo;
|
||||
this.state.comparison = comparison;
|
||||
try {
|
||||
this.state.currentResult = await this.rpc(`${ENDPOINT_BASE}/run`, {
|
||||
report_type: reportType,
|
||||
report_code: reportCode,
|
||||
date_from: dateFrom,
|
||||
date_to: dateTo,
|
||||
comparison: comparison,
|
||||
@@ -136,7 +139,8 @@ export class ReportsService {
|
||||
this.state.comparison = mode;
|
||||
if (this.state.currentReportType) {
|
||||
return this.runReport(this.state.currentReportType,
|
||||
this.state.dateFrom, this.state.dateTo, mode);
|
||||
this.state.dateFrom, this.state.dateTo, mode,
|
||||
this.state.currentReportCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,11 @@ export class ReportViewer extends Component {
|
||||
|
||||
const ctx = this.props.action?.context || {};
|
||||
const reportType = ctx.default_report_type || 'pnl';
|
||||
// default_report_code lets multiple reports of the same type
|
||||
// (e.g. pnl, cash_flow, executive_summary, annual_statements all
|
||||
// type='pnl') resolve to their own line_specs.
|
||||
const reportCode = ctx.default_report_code || null;
|
||||
const comparison = ctx.default_comparison || 'none';
|
||||
const companyId = this.env.services.user?.context?.allowed_company_ids?.[0];
|
||||
|
||||
onWillStart(async () => {
|
||||
@@ -29,7 +34,8 @@ export class ReportViewer extends Component {
|
||||
const today = new Date();
|
||||
const year = today.getFullYear();
|
||||
await this.reports.runReport(
|
||||
reportType, `${year}-01-01`, `${year}-12-31`, 'none');
|
||||
reportType, `${year}-01-01`, `${year}-12-31`,
|
||||
comparison, reportCode);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user