fix(pos): freeze screen while processing pos invoices (#30850)
This commit is contained in:
parent
935e5b1dcd
commit
4b04694c2c
@ -102,7 +102,9 @@ frappe.ui.form.on('POS Closing Entry', {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
before_save: function(frm) {
|
before_save: async function(frm) {
|
||||||
|
frappe.dom.freeze(__('Processing Sales! Please Wait...'));
|
||||||
|
|
||||||
frm.set_value("grand_total", 0);
|
frm.set_value("grand_total", 0);
|
||||||
frm.set_value("net_total", 0);
|
frm.set_value("net_total", 0);
|
||||||
frm.set_value("total_quantity", 0);
|
frm.set_value("total_quantity", 0);
|
||||||
@ -112,8 +114,13 @@ frappe.ui.form.on('POS Closing Entry', {
|
|||||||
row.expected_amount = row.opening_amount;
|
row.expected_amount = row.opening_amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let row of frm.doc.pos_transactions) {
|
const pos_inv_promises = frm.doc.pos_transactions.map(
|
||||||
frappe.db.get_doc("POS Invoice", row.pos_invoice).then(doc => {
|
row => frappe.db.get_doc("POS Invoice", row.pos_invoice)
|
||||||
|
);
|
||||||
|
|
||||||
|
const pos_invoices = await Promise.all(pos_inv_promises);
|
||||||
|
|
||||||
|
for (let doc of pos_invoices) {
|
||||||
frm.doc.grand_total += flt(doc.grand_total);
|
frm.doc.grand_total += flt(doc.grand_total);
|
||||||
frm.doc.net_total += flt(doc.net_total);
|
frm.doc.net_total += flt(doc.net_total);
|
||||||
frm.doc.total_quantity += flt(doc.total_qty);
|
frm.doc.total_quantity += flt(doc.total_qty);
|
||||||
@ -121,8 +128,9 @@ frappe.ui.form.on('POS Closing Entry', {
|
|||||||
refresh_taxes(doc, frm);
|
refresh_taxes(doc, frm);
|
||||||
refresh_fields(frm);
|
refresh_fields(frm);
|
||||||
set_html_data(frm);
|
set_html_data(frm);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
frappe.dom.unfreeze();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user