Merge pull request #11470 from rohitwaghchaure/pos_online_invalid_grand_total_issue
[Fix] Fast clicking on an item, showing invalid grand total and quantity in the POS cart
diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.js b/erpnext/selling/page/point_of_sale/point_of_sale.js
index 196bb96..a0f8598 100644
--- a/erpnext/selling/page/point_of_sale/point_of_sale.js
+++ b/erpnext/selling/page/point_of_sale/point_of_sale.js
@@ -43,6 +43,7 @@
make() {
return frappe.run_serially([
+ () => frappe.dom.freeze(),
() => {
this.prepare_dom();
this.prepare_menu();
@@ -55,6 +56,7 @@
frappe.timeout(1);
this.make_items();
this.bind_events();
+ frappe.dom.unfreeze();
},
() => this.page.set_title(__('Point of Sale'))
]);
@@ -156,6 +158,7 @@
}
update_item_in_cart(item_code, field='qty', value=1) {
+ frappe.dom.freeze();
if(this.cart.exists(item_code)) {
const item = this.frm.doc.items.find(i => i.item_code === item_code);
frappe.flags.hide_serial_batch_dialog = false;
@@ -220,6 +223,7 @@
this.cart.add_item(item);
this.cart.update_taxes_and_totals();
this.cart.update_grand_total();
+ frappe.dom.unfreeze();
}
update_item_in_frm(item, field, value) {
@@ -232,8 +236,6 @@
return frappe.model.set_value(item.doctype, item.name, field, value)
.then(() => this.frm.script_manager.trigger('qty', item.doctype, item.name))
.then(() => {
- console.log(item.qty, item.amount);
-
if (field === 'qty' && item.qty === 0) {
frappe.model.clear_doc(item.doctype, item.name);
}