From b4b1d1b9b6605f506d155873d7726c5aeeef66d5 Mon Sep 17 00:00:00 2001 From: Ali <010109ali@gmail.com> Date: Mon, 11 May 2026 13:02:53 +0000 Subject: [PATCH] fix(bank-integration): re-add BRT checkbox column on every "Get Unreconciled Entries" The checkbox column + Create & Reconcile toolbar setup was on the form's `refresh` event, which fires only once. On a second "Get Unreconciled Entries" ERPNext rebuilds the DataTableManager without the checkbox column and the polling interval never restarted. Moved the enhancement to the `render` event (fires on every rebuild), matching the pattern the kapital_bank BRT extension used. The prototype patch that adds the "Bank Transaction" column stays on `refresh` since it is idempotent. Co-Authored-By: Claude Opus 4.7 (1M context) --- jey_erp/public/js/bank_reconciliation_tool.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/jey_erp/public/js/bank_reconciliation_tool.js b/jey_erp/public/js/bank_reconciliation_tool.js index a143e99..c56e583 100644 --- a/jey_erp/public/js/bank_reconciliation_tool.js +++ b/jey_erp/public/js/bank_reconciliation_tool.js @@ -12,6 +12,7 @@ frappe.ui.form.on("Bank Reconciliation Tool", { // Make BRT fill the page (existing fallback) frm.$wrapper.closest('.page-container').css('--page-max-width', 'none'); + // Patch the DataTableManager prototype once: adds the "Bank Transaction" column. frappe.require("bank-reconciliation-tool.bundle.js", function () { const DTM = erpnext.accounts.bank_reconciliation.DataTableManager; if (!DTM || DTM.prototype._jey_erp_patched) return; @@ -43,9 +44,12 @@ frappe.ui.form.on("Bank Reconciliation Tool", { proto._jey_erp_patched = true; }); + }, - // === 2 + 3: checkbox column + Create & Reconcile toolbar === - // We poll for the DataTableManager instance on the form, then enhance once. + // `render` fires every time the reconciliation tool is (re)built — i.e. on + // every "Get Unreconciled Entries". Each time a brand-new DataTableManager + // is created, so we re-poll for it and re-add the checkbox column + toolbar. + render(frm) { if (frm._bi_check_interval) clearInterval(frm._bi_check_interval); frm._bi_check_interval = setInterval(function () { const dtm = frm.bank_reconciliation_data_table_manager;