Skip to content

Commit

Permalink
fix: use event for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanket322 committed Dec 10, 2024
1 parent 4523b41 commit aa04a75
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,6 @@ frappe.ui.form.on("Purchase Reconciliation Tool", {
await frappe.require("purchase_reconciliation_tool.bundle.js");
frm.trigger("company");
frm.purchase_reconciliation_tool = new PurchaseReconciliationTool(frm);

frappe.realtime.on("download_failed", message => {
frm.dashboard.hide();
frappe.msgprint({
title: __("Download Failed"),
message: message.error,
indicator: "red"
});
})
},

onload(frm) {
Expand Down Expand Up @@ -198,6 +189,7 @@ frappe.ui.form.on("Purchase Reconciliation Tool", {
() => frm.events.update_progress(frm, "update_api_progress"),
() => frm.events.update_progress(frm, "update_transactions_progress"),
]);
frm.events.handle_download_failure(frm);
} else if (type == "upload") {
frm.events.update_progress(frm, "update_transactions_progress");
}
Expand Down Expand Up @@ -238,6 +230,17 @@ frappe.ui.form.on("Purchase Reconciliation Tool", {
}
});
},

handle_download_failure(frm) {
frappe.realtime.on("download_failed", message => {
frm.dashboard.hide();
frappe.msgprint({
title: __("Download Failed"),
message: message.error,
indicator: "red"
});
})
},
});

class PurchaseReconciliationTool {
Expand Down

0 comments on commit aa04a75

Please sign in to comment.