Merge pull request #17090 from rohitwaghchaure/pos_qty_decrement_not_working
fix: POS qty decrement freezing the screen
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 b098fde..dcb9ed1 100644
--- a/erpnext/selling/page/point_of_sale/point_of_sale.js
+++ b/erpnext/selling/page/point_of_sale/point_of_sale.js
@@ -233,13 +233,16 @@
} else {
this.update_item_in_frm(item, field, value)
.then(() => {
- this.frm.doc.items.forEach(item_row => {
- // update cart
- frappe.run_serially([
- () => this.update_cart_data(item_row),
- () => this.set_form_action()
- ]);
- });
+ frappe.dom.unfreeze();
+ let items = this.frm.doc.items.map(item => item.idx);
+ if (items && items.length > 0 && items.indexOf(item.idx)) {
+ this.frm.doc.items.forEach(item_row => {
+ // update cart
+ this.on_qty_change(item_row);
+ });
+ } else {
+ this.on_qty_change(item);
+ }
});
}
return;
@@ -280,6 +283,13 @@
]);
}
+ on_qty_change(item) {
+ frappe.run_serially([
+ () => this.update_cart_data(item),
+ () => this.set_form_action()
+ ]);
+ }
+
select_batch_and_serial_no(row) {
frappe.dom.unfreeze();