fix: Clear invoice table post importing invoices

This commit is contained in:
Deepesh Garg 2022-10-24 11:45:24 +05:30
parent 2a50a0ce69
commit 267e7c3a90
2 changed files with 3 additions and 12 deletions

View File

@ -22,13 +22,13 @@ frappe.ui.form.on('Opening Invoice Creation Tool', {
} }
if (data.user != frappe.session.user) return; if (data.user != frappe.session.user) return;
if (data.count == data.total) { if (data.count == data.total) {
setTimeout((title) => { setTimeout(() => {
frm.doc.import_in_progress = false; frm.doc.import_in_progress = false;
frm.clear_table("invoices"); frm.clear_table("invoices");
frm.refresh_fields(); frm.refresh_fields();
frm.page.clear_indicator(); frm.page.clear_indicator();
frm.dashboard.hide_progress(title); frm.dashboard.hide_progress();
frappe.msgprint(__("Opening {0} Invoice created", [frm.doc.invoice_type])); frappe.msgprint(__("Opening {0} Invoices created", [frm.doc.invoice_type]));
}, 1500, data.title); }, 1500, data.title);
return; return;
} }
@ -51,13 +51,6 @@ frappe.ui.form.on('Opening Invoice Creation Tool', {
method: "make_invoices", method: "make_invoices",
freeze: 1, freeze: 1,
freeze_message: __("Creating {0} Invoice", [frm.doc.invoice_type]), freeze_message: __("Creating {0} Invoice", [frm.doc.invoice_type]),
callback: function(r) {
if (r.message.length == 1) {
frappe.msgprint(__("{0} Invoice created successfully.", [frm.doc.invoice_type]));
} else if (r.message.length < 50) {
frappe.msgprint(__("{0} Invoices created successfully.", [frm.doc.invoice_type]));
}
}
}); });
}); });

View File

@ -255,8 +255,6 @@ def start_import(invoices):
def publish(index, total, doctype): def publish(index, total, doctype):
if total < 50:
return
frappe.publish_realtime( frappe.publish_realtime(
"opening_invoice_creation_progress", "opening_invoice_creation_progress",
dict( dict(