feat: on click of pay button and on focus out of qty field remove the zero qty items from the cart
diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js
index c89035c..7fcd2cb 100755
--- a/erpnext/accounts/page/pos/pos.js
+++ b/erpnext/accounts/page/pos/pos.js
@@ -602,7 +602,7 @@
 		this.remove_item = []
 		idx = $(this.wrapper).find(".pos-selected-item-action").attr("data-idx")
 		this.remove_item.push(idx)
-		this.remove_zero_qty_item()
+		this.remove_zero_qty_items_from_cart()
 		this.update_paid_amount_status(false)
 	},
 
@@ -1167,20 +1167,27 @@
 		$(this.wrapper).on("change", ".pos-item-qty", function () {
 			var item_code = $(this).parents(".pos-selected-item-action").attr("data-item-code");
 			var qty = $(this).val();
-			me.update_qty(item_code, qty)
-			me.update_value()
+			me.update_qty(item_code, qty);
+			me.update_value();
+		})
+
+		$(this.wrapper).on("focusout", ".pos-item-qty", function () {
+			var item_code = $(this).parents(".pos-selected-item-action").attr("data-item-code");
+			var qty = $(this).val();
+			me.update_qty(item_code, qty, true);
+			me.update_value();
 		})
 
 		$(this.wrapper).find("[data-action='increase-qty']").on("click", function () {
 			var item_code = $(this).parents(".pos-bill-item").attr("data-item-code");
 			var qty = flt($(this).parents(".pos-bill-item").find('.pos-item-qty').val()) + 1;
-			me.update_qty(item_code, qty)
+			me.update_qty(item_code, qty);
 		})
 
 		$(this.wrapper).find("[data-action='decrease-qty']").on("click", function () {
 			var item_code = $(this).parents(".pos-bill-item").attr("data-item-code");
 			var qty = flt($(this).parents(".pos-bill-item").find('.pos-item-qty').val()) - 1;
-			me.update_qty(item_code, qty)
+			me.update_qty(item_code, qty);
 		})
 
 		$(this.wrapper).on("change", ".pos-item-disc", function () {
@@ -1219,11 +1226,11 @@
 		me.bind_delete_event()
 	},
 
-	update_qty: function (item_code, qty) {
+	update_qty: function (item_code, qty, remove_zero_qty_items) {
 		var me = this;
 		this.items = this.get_items(item_code);
 		this.validate_serial_no()
-		this.set_item_details(item_code, "qty", qty);
+		this.set_item_details(item_code, "qty", qty, remove_zero_qty_items);
 	},
 
 	update_discount: function(item_code, discount) {
@@ -1284,7 +1291,7 @@
 		})
 	},
 
-	set_item_details: function (item_code, field, value) {
+	set_item_details: function (item_code, field, value, remove_zero_qty_items) {
 		var me = this;
 		if (value < 0) {
 			frappe.throw(__("Enter value must be positive"));
@@ -1299,7 +1306,7 @@
 
 				d[field] = flt(value);
 				d.amount = flt(d.rate) * flt(d.qty);
-				if (d.qty == 0) {
+				if (d.qty == 0 && remove_zero_qty_items) {
 					me.remove_item.push(d.idx)
 				}
 
@@ -1309,10 +1316,14 @@
 			}
 		});
 
+		if (field == 'qty') {
+			this.remove_zero_qty_items_from_cart();
+		}
+
 		this.update_paid_amount_status(false)
 	},
 
-	remove_zero_qty_item: function () {
+	remove_zero_qty_items_from_cart: function () {
 		var me = this;
 		var idx = 0;
 		this.items = []
@@ -1826,10 +1837,25 @@
 	validate: function () {
 		var me = this;
 		this.customer_validate();
+		this.validate_zero_qty_items();
 		this.item_validate();
 		this.validate_mode_of_payments();
 	},
 
+	validate_zero_qty_items: function() {
+		this.remove_item = [];
+
+		this.frm.doc.items.forEach(d => {
+			if (d.qty == 0) {
+				this.remove_item.push(d.idx);
+			}
+		});
+
+		if(this.remove_item) {
+			this.remove_zero_qty_items_from_cart();
+		}
+	},
+
 	item_validate: function () {
 		if (this.frm.doc.items.length == 0) {
 			frappe.throw(__("Select items to save the invoice"))