Skip to content

Commit

Permalink
fix: column formatting in Bank Reconciliation Tool (#35540)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
barredterra authored Jun 7, 2023
1 parent e1f3b7c commit e9d7b9f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
10 changes: 3 additions & 7 deletions erpnext/public/js/bank_reconciliation_tool/data_table_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"],
`
<Button class="btn btn-primary btn-xs center" data-name = ${row["name"]} >
${__("Actions")}
</a>
`,
`<button class="btn btn-primary btn-xs center" data-name="${row["name"]}">${__("Actions")}</button>`
];
}

Expand Down
27 changes: 13 additions & 14 deletions erpnext/public/js/bank_reconciliation_tool/dialog_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
},
Expand All @@ -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"),
Expand All @@ -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 = {
Expand Down

0 comments on commit e9d7b9f

Please sign in to comment.