From 80b692e5c430d1570a6e245c09b4635f32e291c4 Mon Sep 17 00:00:00 2001 From: Charles-Henri Decultot Date: Fri, 5 Jan 2024 14:20:37 +0100 Subject: [PATCH] chore: Make bank reconciliation page extendable --- .../bank_reconciliation/bank_reconciliation.js | 11 ++++++++++- .../bank_reconciliation.js | 15 +++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/erpnext/accounts/page/bank_reconciliation/bank_reconciliation.js b/erpnext/accounts/page/bank_reconciliation/bank_reconciliation.js index 1c2f751b3c8..8a428af9430 100644 --- a/erpnext/accounts/page/bank_reconciliation/bank_reconciliation.js +++ b/erpnext/accounts/page/bank_reconciliation/bank_reconciliation.js @@ -2,9 +2,18 @@ // For license information, please see license.txt frappe.provide("erpnext.accounts"); +frappe.provide("erpnext.bank_reconciliation"); frappe.pages['bank-reconciliation'].on_page_load = function(wrapper) { + wrapper.page = frappe.ui.make_app_page({ + parent: wrapper, + title: __("Bank Reconciliation"), + single_column: true + }); + + frappe.utils.make_event_emitter(erpnext.bank_reconciliation); + frappe.require('bank_reconciliation.bundle.js', function() { - new erpnext.accounts.bankReconciliationPage(wrapper); + erpnext.accounts.bank_reconciliation_page = new erpnext.accounts.bankReconciliationPage(wrapper); }); } diff --git a/erpnext/accounts/page/bank_reconciliation/bank_reconciliation_page/bank_reconciliation.js b/erpnext/accounts/page/bank_reconciliation/bank_reconciliation_page/bank_reconciliation.js index 41e33be39f2..c82d9710449 100644 --- a/erpnext/accounts/page/bank_reconciliation/bank_reconciliation_page/bank_reconciliation.js +++ b/erpnext/accounts/page/bank_reconciliation/bank_reconciliation_page/bank_reconciliation.js @@ -4,11 +4,6 @@ frappe.provide("erpnext.bank_reconciliation") erpnext.accounts.bankReconciliationPage = class BankReconciliationPage { constructor(wrapper) { - this.page = frappe.ui.make_app_page({ - parent: wrapper, - title: __("Bank Reconciliation"), - single_column: true - }); this.parent = wrapper; this.page = this.parent.page; @@ -19,10 +14,18 @@ erpnext.accounts.bankReconciliationPage = class BankReconciliationPage { ) this.bank_account = this.user_bank_account; this.date_range = [frappe.datetime.add_months(frappe.datetime.get_today(),-1), frappe.datetime.get_today()]; - frappe.utils.make_event_emitter(erpnext.bank_reconciliation); + + this.emit_initial_events() + this.make(); } + emit_initial_events() { + if (this.user_bank_account) { + erpnext.bank_reconciliation.trigger("filter_change", {name: 'BANK_ACCOUNT', value: this.user_bank_account}) + } + } + make() { const me = this; -- GitLab