From 31167ee2fe19240d9b3ea18c7729ac333426b0d1 Mon Sep 17 00:00:00 2001 From: Enric Tobella Date: Sun, 21 Apr 2024 15:05:15 +0200 Subject: [PATCH] [IMP] account_reconcile_oca: show balances --- .../js/reconcile/reconcile_controller.esm.js | 4 --- .../js/reconcile/reconcile_renderer.esm.js | 31 +++++++++++++++++-- .../static/src/xml/reconcile.xml | 18 +++++++++++ .../views/account_bank_statement_line.xml | 3 ++ 4 files changed, 50 insertions(+), 6 deletions(-) diff --git a/account_reconcile_oca/static/src/js/reconcile/reconcile_controller.esm.js b/account_reconcile_oca/static/src/js/reconcile/reconcile_controller.esm.js index 2f0774c7..9c83aa86 100644 --- a/account_reconcile_oca/static/src/js/reconcile/reconcile_controller.esm.js +++ b/account_reconcile_oca/static/src/js/reconcile/reconcile_controller.esm.js @@ -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, }); diff --git a/account_reconcile_oca/static/src/js/reconcile/reconcile_renderer.esm.js b/account_reconcile_oca/static/src/js/reconcile/reconcile_renderer.esm.js index 3dafa4ec..7bf47166 100644 --- a/account_reconcile_oca/static/src/js/reconcile/reconcile_renderer.esm.js +++ b/account_reconcile_oca/static/src/js/reconcile/reconcile_renderer.esm.js @@ -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; } } diff --git a/account_reconcile_oca/static/src/xml/reconcile.xml b/account_reconcile_oca/static/src/xml/reconcile.xml index 77c585ab..9ef6a4a7 100644 --- a/account_reconcile_oca/static/src/xml/reconcile.xml +++ b/account_reconcile_oca/static/src/xml/reconcile.xml @@ -16,6 +16,24 @@ t-esc="env.parentController.journalBalanceStr" /> + + + + + +
+ + +
+
+ + +