feat(fusion_accounting_reports): report_table component with drill chevrons
Made-with: Cursor
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
'name': 'Fusion Accounting Reports',
|
'name': 'Fusion Accounting Reports',
|
||||||
'version': '19.0.1.0.24',
|
'version': '19.0.1.0.25',
|
||||||
'category': 'Accounting/Accounting',
|
'category': 'Accounting/Accounting',
|
||||||
'summary': 'AI-augmented financial reports (P&L, balance sheet, trial balance, GL).',
|
'summary': 'AI-augmented financial reports (P&L, balance sheet, trial balance, GL).',
|
||||||
'description': """
|
'description': """
|
||||||
@@ -46,6 +46,8 @@ menu hides; the engine and AI tools remain available for the chat.
|
|||||||
'fusion_accounting_reports/static/src/views/report_viewer/report_viewer.js',
|
'fusion_accounting_reports/static/src/views/report_viewer/report_viewer.js',
|
||||||
'fusion_accounting_reports/static/src/views/report_viewer/report_viewer.xml',
|
'fusion_accounting_reports/static/src/views/report_viewer/report_viewer.xml',
|
||||||
'fusion_accounting_reports/static/src/views/report_viewer/report_viewer_view.js',
|
'fusion_accounting_reports/static/src/views/report_viewer/report_viewer_view.js',
|
||||||
|
'fusion_accounting_reports/static/src/components/report_table/report_table.js',
|
||||||
|
'fusion_accounting_reports/static/src/components/report_table/report_table.xml',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
'installable': True,
|
'installable': True,
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
/** @odoo-module **/
|
||||||
|
|
||||||
|
import { Component } from "@odoo/owl";
|
||||||
|
|
||||||
|
export class ReportTable extends Component {
|
||||||
|
static template = "fusion_accounting_reports.ReportTable";
|
||||||
|
static props = {
|
||||||
|
result: { type: Object },
|
||||||
|
onDrillDown: { type: Function, optional: true },
|
||||||
|
};
|
||||||
|
|
||||||
|
formatAmount(amount) {
|
||||||
|
if (amount === null || amount === undefined) return "";
|
||||||
|
return new Intl.NumberFormat(undefined, {
|
||||||
|
minimumFractionDigits: 2, maximumFractionDigits: 2,
|
||||||
|
}).format(amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
onRowClick(row) {
|
||||||
|
if (row.account_id && this.props.onDrillDown) {
|
||||||
|
this.props.onDrillDown(row.account_id, row.label);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rowClass(row) {
|
||||||
|
const classes = ['report-row', `level-${row.level || 0}`];
|
||||||
|
if (row.is_subtotal) classes.push('subtotal');
|
||||||
|
if (row.account_id) classes.push('drillable');
|
||||||
|
return classes.join(' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
varianceClass(pct) {
|
||||||
|
if (pct === null || pct === undefined) return "";
|
||||||
|
return pct > 0 ? 'variance-pos' : pct < 0 ? 'variance-neg' : '';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<templates xml:space="preserve">
|
||||||
|
|
||||||
|
<t t-name="fusion_accounting_reports.ReportTable">
|
||||||
|
<div class="o_fusion_reports_table">
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Line</th>
|
||||||
|
<th class="amount">Amount</th>
|
||||||
|
<t t-if="props.result.comparison_period">
|
||||||
|
<th class="amount">
|
||||||
|
<t t-esc="props.result.comparison_period.label"/>
|
||||||
|
</th>
|
||||||
|
<th class="amount">Variance %</th>
|
||||||
|
</t>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr t-foreach="props.result.rows" t-as="row" t-key="row.id"
|
||||||
|
t-att-class="rowClass(row)"
|
||||||
|
t-on-click="() => onRowClick(row)">
|
||||||
|
<td>
|
||||||
|
<span><t t-esc="row.label"/></span>
|
||||||
|
</td>
|
||||||
|
<td class="amount">
|
||||||
|
<t t-esc="formatAmount(row.amount)"/>
|
||||||
|
</td>
|
||||||
|
<t t-if="props.result.comparison_period">
|
||||||
|
<td class="amount">
|
||||||
|
<t t-esc="formatAmount(row.amount_comparison)"/>
|
||||||
|
</td>
|
||||||
|
<td class="amount" t-att-class="varianceClass(row.variance_pct)">
|
||||||
|
<t t-if="row.variance_pct !== null and row.variance_pct !== undefined">
|
||||||
|
<t t-esc="row.variance_pct.toFixed(1)"/>%
|
||||||
|
</t>
|
||||||
|
</td>
|
||||||
|
</t>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</t>
|
||||||
|
|
||||||
|
</templates>
|
||||||
Reference in New Issue
Block a user