[fix] [minor] bind onclick function based on docstatus in pos
diff --git a/accounts/doctype/sales_invoice/pos.js b/accounts/doctype/sales_invoice/pos.js
index 0dba40f..c68b991 100644
--- a/accounts/doctype/sales_invoice/pos.js
+++ b/accounts/doctype/sales_invoice/pos.js
@@ -213,8 +213,8 @@
 				});
 
 				// if form is local then allow this function
-				if (me.frm.doc.docstatus===0) {
-					$(me.wrapper).find("div.pos-item").on("click", function() {
+				$(me.wrapper).find("div.pos-item").on("click", function() {
+					if(me.frm.doc.docstatus==0) {
 						if(!me.frm.doc[me.party.toLowerCase()] && ((me.frm.doctype == "Quotation" && 
 								me.frm.doc.quotation_to == "Customer") 
 								|| me.frm.doctype != "Quotation")) {
@@ -223,8 +223,8 @@
 						}
 						else
 							me.add_to_cart($(this).attr("data-item_code"));
-					});
-				}
+					}
+				});
 			}
 		});
 	},
@@ -371,7 +371,7 @@
 			});
 
 			me.refresh_delete_btn();
-			this.frm.pos.barcode.$input.focus();
+			this.barcode.$input.focus();
 		}
 
 		// if form is submitted & cancelled then disable all input box & buttons
@@ -476,7 +476,7 @@
 						"total_amount": $(".grand-total").text()
 					});
 					dialog.show();
-					me.frm.pos.barcode.$input.focus();
+					me.barcode.$input.focus();
 					
 					dialog.get_input("total_amount").prop("disabled", true);
 					
diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js
index 4f8dda8..5220c0f 100644
--- a/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/accounts/doctype/sales_invoice/sales_invoice.js
@@ -29,11 +29,10 @@
 		// toggle to pos view if is_pos is 1 in user_defaults
 		if ((cint(wn.defaults.get_user_defaults("is_pos"))===1 || cur_frm.doc.is_pos) && 
 				cint(wn.defaults.get_user_defaults("fs_pos_view"))===1) {
-					if(this.frm.doc.__islocal) {
+					if(this.frm.doc.__islocal && !this.frm.doc.amended_from) {
 						this.frm.set_value("is_pos", 1);
-						this.is_pos();
+						this.is_pos(function() {cur_frm.cscript.toggle_pos(true);});
 					}
-					cur_frm.cscript.toggle_pos(true);
 		}
 		
 		// if document is POS then change default print format to "POS Invoice"
@@ -128,7 +127,7 @@
 		this.get_terms();
 	},
 	
-	is_pos: function() {
+	is_pos: function(callback_fn) {
 		cur_frm.cscript.hide_fields(this.frm.doc);
 		if(cint(this.frm.doc.is_pos)) {
 			if(!this.frm.doc.company) {
@@ -142,6 +141,7 @@
 					callback: function(r) {
 						if(!r.exc) {
 							me.frm.script_manager.trigger("update_stock");
+							if(callback_fn) callback_fn()
 						}
 					}
 				});