Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: column formatting in Bank Reconciliation Tool #35540

Merged
merged 4 commits into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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