[IMP] account_reconcile_oca: show balances

pull/662/head
Enric Tobella 2024-04-21 15:05:15 +02:00
parent 8f983803b0
commit 31167ee2fe
4 changed files with 50 additions and 6 deletions

View File

@ -53,10 +53,6 @@ export class ReconcileController extends KanbanController {
if (!this.state.journalBalance) {
return "";
}
console.log(this.state, {
currencyId: this.state.currency,
humanReadable: true,
});
return formatMonetary(this.state.journalBalance, {
currencyId: this.state.currency,
});

View File

@ -2,9 +2,36 @@
import {KanbanRenderer} from "@web/views/kanban/kanban_renderer";
import {ReconcileKanbanRecord} from "./reconcile_kanban_record.esm.js";
import {formatMonetary} from "@web/views/fields/formatters";
export class ReconcileRenderer extends KanbanRenderer {
get journalBalanceStr() {
console.log(this);
getStatements() {
console.log(this.props);
if (
this.env.parentController.props.resModel !== "account.bank.statement.line"
) {
return [];
}
const {list} = this.props;
const statements = [];
for (const record of list.records) {
const statementId = record.data.statement_id && record.data.statement_id[0];
if (
statementId &&
(!statements.length || statements[0].id !== statementId)
) {
statements.push({
id: statementId,
name: record.data.statement_name,
balance: record.data.statement_balance_end_real,
balanceStr: formatMonetary(record.data.statement_balance_end_real, {
currencyId: record.data.currency_id[0],
}),
});
}
}
console.log(statements);
return statements;
}
}

View File

@ -16,6 +16,24 @@
t-esc="env.parentController.journalBalanceStr"
/>
</div>
<t t-set="statements" t-value="getStatements()" />
</xpath>
<xpath expr="//t[@t-else='']/KanbanRecord" position="before">
<t
t-if="statements.length and groupOrRecord.record.data.statement_id and statements[0].id == groupOrRecord.record.data.statement_id[0]"
>
<t t-set="statement" t-value="statements.shift()" />
<div class="m-2 d-flex w-100" t-if="env.parentController.journalId">
<span
class="flex-fill text-900 text-start ps-0 fw-bold fs-4 align-self-center"
t-esc="statement.name"
/>
<span
class="pe-0 fw-bold fs-4 align-self-center"
t-esc="statement.balanceStr"
/>
</div>
</t>
</xpath>
<xpath expr="div[hasclass('o_kanban_renderer')]" position="attributes">
<attribute

View File

@ -11,6 +11,9 @@
<field name="is_reconciled" />
<field name="currency_id" />
<field name="foreign_currency_id" />
<field name="statement_id" />
<field name="statement_balance_end_real" />
<field name="statement_name" />
<field name="to_check" />
<templates>
<t t-name="kanban-box">