diff --git a/account_reconcile_oca/models/account_journal.py b/account_reconcile_oca/models/account_journal.py
index 8c6409c5..bc4ded92 100644
--- a/account_reconcile_oca/models/account_journal.py
+++ b/account_reconcile_oca/models/account_journal.py
@@ -12,6 +12,7 @@ class AccountJournal(models.Model):
default="edit",
required=True,
)
+ company_currency_id = fields.Many2one(related="company_id.currency_id")
def get_rainbowman_message(self):
self.ensure_one()
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 65dfa94c..4639d6a2 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
@@ -1,14 +1,17 @@
/** @odoo-module */
-const {useState, useSubEnv, onMounted} = owl;
+const {onMounted, onWillStart, useState, useSubEnv} = owl;
import {useBus, useService} from "@web/core/utils/hooks";
import {KanbanController} from "@web/views/kanban/kanban_controller";
import {View} from "@web/views/view";
+import {formatMonetary} from "@web/views/fields/formatters";
export class ReconcileController extends KanbanController {
async setup() {
super.setup();
this.state = useState({
selectedRecordId: null,
+ journalBalance: 0,
+ currency: false,
});
useSubEnv({
parentController: this,
@@ -22,7 +25,43 @@ export class ReconcileController extends KanbanController {
useBus(this.model.bus, "update", () => {
this.selectRecord();
});
- onMounted(() => this.selectRecord());
+ onWillStart(() => {
+ this.updateJournalInfo();
+ });
+ onMounted(() => {
+ this.selectRecord();
+ });
+ }
+ get journalId() {
+ if (this.props.resModel === "account.bank.statement.line") {
+ return this.props.context.active_id;
+ }
+ return false;
+ }
+ async updateJournalInfo() {
+ var journalId = this.journalId;
+ if (!journalId) {
+ return;
+ }
+ var result = await this.orm.call("account.journal", "read", [
+ [journalId],
+ ["current_statement_balance", "currency_id", "company_currency_id"],
+ ]);
+ this.state.journalBalance = result[0].current_statement_balance;
+ this.state.currency = (result[0].currency_id ||
+ result[0].company_currency_id)[0];
+ }
+ get journalBalanceStr() {
+ if (!this.state.journalBalance) {
+ return "";
+ }
+ console.log(this.state, {
+ currencyId: this.state.currency,
+ humanReadable: true,
+ });
+ return formatMonetary(this.state.journalBalance, {
+ currencyId: this.state.currency,
+ });
}
exposeController(controller) {
this.form_controller = controller;
@@ -48,6 +87,7 @@ export class ReconcileController extends KanbanController {
return {
resId: this.state.selectedRecordId,
type: "form",
+ noBreadcrumbs: true,
context: {
...(this.props.context || {}),
form_view_ref: this.props.context.view_ref,
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 d031e2bc..3dafa4ec 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,7 +2,11 @@
import {KanbanRenderer} from "@web/views/kanban/kanban_renderer";
import {ReconcileKanbanRecord} from "./reconcile_kanban_record.esm.js";
-export class ReconcileRenderer extends KanbanRenderer {}
+export class ReconcileRenderer extends KanbanRenderer {
+ get journalBalanceStr() {
+ console.log(this);
+ }
+}
ReconcileRenderer.components = {
...KanbanRenderer.components,
diff --git a/account_reconcile_oca/static/src/js/reconcile_form/reconcile_form_controller.esm.js b/account_reconcile_oca/static/src/js/reconcile_form/reconcile_form_controller.esm.js
index 571b4673..d91b4bda 100644
--- a/account_reconcile_oca/static/src/js/reconcile_form/reconcile_form_controller.esm.js
+++ b/account_reconcile_oca/static/src/js/reconcile_form/reconcile_form_controller.esm.js
@@ -17,6 +17,9 @@ export class ReconcileFormController extends FormController {
afterExecuteAction: this.afterExecuteActionButton.bind(this),
});
}
+ displayName() {
+ return this.env.config.getDisplayName();
+ }
async reloadFormController() {
var is_reconciled = this.model.root.data.is_reconciled;
await this.model.root.load();
diff --git a/account_reconcile_oca/static/src/js/widgets/reconcile_data_widget.esm.js b/account_reconcile_oca/static/src/js/widgets/reconcile_data_widget.esm.js
index 3deb8499..1f858f27 100644
--- a/account_reconcile_oca/static/src/js/widgets/reconcile_data_widget.esm.js
+++ b/account_reconcile_oca/static/src/js/widgets/reconcile_data_widget.esm.js
@@ -21,18 +21,17 @@ export class AccountReconcileDataWidget extends Component {
getReconcileLines() {
var data = this.props.record.data[this.props.name].data;
for (var line in data) {
- data[line].amount_format = formatMonetary(data[line].amount, undefined, {
+ data[line].amount_format = formatMonetary(data[line].amount, {
currency: data[line].currency_id,
});
- data[line].debit_format = formatMonetary(data[line].debit, undefined, {
+ data[line].debit_format = formatMonetary(data[line].debit, {
currency: data[line].currency_id,
});
- data[line].credit_format = formatMonetary(data[line].credit, undefined, {
+ data[line].credit_format = formatMonetary(data[line].credit, {
currency: data[line].currency_id,
});
data[line].amount_currency_format = formatMonetary(
data[line].currency_amount,
- undefined,
{
currency: data[line].line_currency_id,
}
@@ -40,7 +39,6 @@ export class AccountReconcileDataWidget extends Component {
if (data[line].original_amount) {
data[line].original_amount_format = formatMonetary(
data[line].original_amount,
- undefined,
{
currency: data[line].currency_id,
}
diff --git a/account_reconcile_oca/static/src/xml/reconcile.xml b/account_reconcile_oca/static/src/xml/reconcile.xml
index 7fbe4632..d79159a2 100644
--- a/account_reconcile_oca/static/src/xml/reconcile.xml
+++ b/account_reconcile_oca/static/src/xml/reconcile.xml
@@ -5,6 +5,17 @@
t-inherit="web.KanbanRenderer"
t-inherit-mode="primary"
>
+
+
+ Balance
+
+
+
- Reconcile bank statement lines
+ Statement lines
account.bank.statement.line
[('journal_id', '=', active_id)]