From e9d7b9f0f44c94a2cd73757c2fd20250e7e81d66 Mon Sep 17 00:00:00 2001 From: Raffael Meyer <14891507+barredterra@users.noreply.github.com> Date: Wed, 7 Jun 2023 18:21:49 +0200 Subject: [PATCH] fix: column formatting in Bank Reconciliation Tool (#35540) * fix(Bank Reconciliation): format Date column * fix(Bank Reconciliation): format Party column * fix(Bank Reconciliation): actions button - wrong closing tag - explicitly quote data-name * fix(Bank Reco): format date and link in dialog --- .../data_table_manager.js | 10 +++---- .../dialog_manager.js | 27 +++++++++---------- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/erpnext/public/js/bank_reconciliation_tool/data_table_manager.js b/erpnext/public/js/bank_reconciliation_tool/data_table_manager.js index 0cda93880fa..5e5742af8c1 100644 --- a/erpnext/public/js/bank_reconciliation_tool/data_table_manager.js +++ b/erpnext/public/js/bank_reconciliation_tool/data_table_manager.js @@ -40,8 +40,8 @@ erpnext.accounts.bank_reconciliation.DataTableManager = class DataTableManager { name: __("Date"), editable: false, width: 100, + format: frappe.form.formatters.Date, }, - { name: __("Party Type"), editable: false, @@ -117,17 +117,13 @@ erpnext.accounts.bank_reconciliation.DataTableManager = class DataTableManager { return [ row["date"], row["party_type"], - row["party"], + frappe.form.formatters.Link(row["party"], {options: row["party_type"]}), row["description"], row["deposit"], row["withdrawal"], row["unallocated_amount"], row["reference_number"], - ` - ` ]; } diff --git a/erpnext/public/js/bank_reconciliation_tool/dialog_manager.js b/erpnext/public/js/bank_reconciliation_tool/dialog_manager.js index 1271e38049a..cbb64ca61b2 100644 --- a/erpnext/public/js/bank_reconciliation_tool/dialog_manager.js +++ b/erpnext/public/js/bank_reconciliation_tool/dialog_manager.js @@ -76,30 +76,17 @@ erpnext.accounts.bank_reconciliation.DialogManager = class DialogManager { callback: (result) => { const data = result.message; - if (data && data.length > 0) { const proposals_wrapper = this.dialog.fields_dict.payment_proposals.$wrapper; proposals_wrapper.show(); this.dialog.fields_dict.no_matching_vouchers.$wrapper.hide(); - this.data = []; - data.forEach((row) => { - const reference_date = row[5] ? row[5] : row[8]; - this.data.push([ - row[1], - row[2], - reference_date, - format_currency(row[3], row[9]), - row[4], - row[6], - ]); - }); + this.data = data.map((row) => this.format_row(row)); this.get_dt_columns(); this.get_datatable(proposals_wrapper); } else { const proposals_wrapper = this.dialog.fields_dict.payment_proposals.$wrapper; proposals_wrapper.hide(); this.dialog.fields_dict.no_matching_vouchers.$wrapper.show(); - } this.dialog.show(); }, @@ -122,6 +109,7 @@ erpnext.accounts.bank_reconciliation.DialogManager = class DialogManager { name: __("Reference Date"), editable: false, width: 120, + format: frappe.form.formatters.Date, }, { name: __("Remaining"), @@ -141,6 +129,17 @@ erpnext.accounts.bank_reconciliation.DialogManager = class DialogManager { ]; } + format_row(row) { + return [ + row[1], // Document Type + frappe.form.formatters.Link(row[2], {options: row[1]}), // Document Name + row[5] || row[8], // Reference Date + format_currency(row[3], row[9]), // Remaining + row[4], // Reference Number + row[6], // Party + ]; + } + get_datatable(proposals_wrapper) { if (!this.datatable) { const datatable_options = {