[Fix] batch no searching in pos
diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py
index 605bf09..9f64e07 100644
--- a/erpnext/accounts/doctype/sales_invoice/pos.py
+++ b/erpnext/accounts/doctype/sales_invoice/pos.py
@@ -20,7 +20,7 @@
 	if pos_profile.get('name'):
 		pos_profile = frappe.get_doc('POS Profile', pos_profile.get('name'))
 	else:
-		frappe.msgprint('<a href="#Form/POS Profile/New POS Profile">'
+		frappe.msgprint('<a href="#List/POS Profile">'
 			+ _("Welcome to POS: Create your POS Profile") + '</a>');
 
 	update_pos_profile_data(doc, pos_profile)
@@ -115,7 +115,7 @@
 		item.actual_qty = frappe.db.get_value('Bin', {'item_code': item.name,
 								'warehouse': item.default_warehouse}, 'actual_qty') or 0
 		item.serial_nos = get_serial_nos(item, pos_profile)
-		item.batch_nos = frappe.db.sql_list("""select name from `tabBatch` where expiry_date > curdate()
+		item.batch_nos = frappe.db.sql_list("""select name from `tabBatch` where ifnull(expiry_date, '4000-10-10') > curdate()
 			and item = %(item_code)s""", {'item_code': item.item_code})
 
 		item_list.append(item)
diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js
index a89f40e..1830103 100644
--- a/erpnext/accounts/page/pos/pos.js
+++ b/erpnext/accounts/page/pos/pos.js
@@ -423,16 +423,16 @@
 
 		if(key){
 			return $.grep(window.items, function(item){
-				if( (item.item_code.toLowerCase().match(key)) ||
-				(item.item_name.toLowerCase().match(key)) || (item.item_group.toLowerCase().match(key)) ){
+				if(in_list(item.batch_nos, me.search.$input.val())){
+					return me.item_batch_no[item.item_code] = me.search.$input.val()
+				} else if((item.item_code.toLowerCase().match(key)) ||
+				(item.item_name.toLowerCase().match(key)) || (item.item_group.toLowerCase().match(key))){
 					return true
 				}else if(item.barcode == me.search.$input.val()){
 					return item.barcode == me.search.$input.val();
 				} else if (in_list(Object.keys(item.serial_nos), me.search.$input.val())){
 					me.item_serial_no[item.item_code] = [me.search.$input.val(), item.serial_nos[me.search.$input.val()]]
 					return true
-				} else if(in_list(item.batch_nos, me.search.$input.val())){
-					return me.item_batch_no[item.item_code] = me.search.$input.val()
 				}
 			})
 		}else{
diff --git a/erpnext/projects/doctype/timesheet/timesheet.js b/erpnext/projects/doctype/timesheet/timesheet.js
index f3dfefa..e2e6459 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.js
+++ b/erpnext/projects/doctype/timesheet/timesheet.js
@@ -31,7 +31,6 @@
 
 	onload: function(frm){
 		if (frm.doc.__islocal && frm.doc.time_logs) {
-			frm.set_value("employee", "")
 			calculate_time_and_amount(frm);
 		}
 	},
diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js
index 8405e3d..34c4557 100644
--- a/erpnext/public/js/controllers/taxes_and_totals.js
+++ b/erpnext/public/js/controllers/taxes_and_totals.js
@@ -582,7 +582,7 @@
 	set_default_payment: function(total_amount_to_pay, update_paid_amount){
 		var me = this;
 		payment_status = true;
-		if(this.frm.doc.is_pos && (!this.frm.doc.paid_amount || update_paid_amount===undefined || update_paid_amount)){
+		if(this.frm.doc.is_pos && (update_paid_amount===undefined || update_paid_amount)){
 			$.each(this.frm.doc['payments'] || [], function(index, data){
 				if(data.type == "Cash" && payment_status) {
 					data.amount = total_amount_to_pay;
diff --git a/erpnext/public/js/payment/payments.js b/erpnext/public/js/payment/payments.js
index 0638b84..7437f2a 100644
--- a/erpnext/public/js/payment/payments.js
+++ b/erpnext/public/js/payment/payments.js
@@ -57,6 +57,13 @@
 					currency: me.frm.doc.currency,
 					type: data.type
 				})).appendTo(multimode_payments)
+
+				if (data.type == 'Cash' && data.amount == me.frm.doc.paid_amount) {
+					me.idx = data.idx;
+					me.selected_mode = $(me.$body).find(repl("input[idx='%(idx)s']",{'idx': me.idx}));
+					me.highlight_selected_row();
+					me.bind_amount_change_event();
+				}
 			})
 		}else{
 			$("<p>No payment mode selected in pos profile</p>").appendTo(multimode_payments)
@@ -90,8 +97,10 @@
 	bind_payment_mode_keys_event: function(){
 		var me = this;
 		$(this.$body).find('.pos-payment-row').click(function(){
-			me.idx = $(this).attr("idx");
-			me.set_outstanding_amount()
+			if(me.frm.doc.outstanding_amount > 0){
+				me.idx = $(this).attr("idx");
+				me.set_outstanding_amount()
+			}
 		})
 	},
 
@@ -124,12 +133,16 @@
 	
 	bind_amount_change_event: function(){
 		var me = this;
-		me.selected_mode.change(function(){
+		this.selected_mode.change(function(){
 			me.payment_val =  flt($(this).val()) || 0.0;
 			me.selected_mode.val(format_number(me.payment_val, 2))
 			me.idx = me.selected_mode.attr("idx")
 			me.update_paid_amount()
 		})
+
+		this.selected_mode.click(function(){
+			me.selected_mode.select();
+		})
 	},
 
 	clear_amount: function(){
@@ -140,6 +153,7 @@
 			me.selected_mode = $(me.$body).find(repl("input[idx='%(idx)s']",{'idx': me.idx}));
 			me.payment_val = 0.0;
 			me.selected_mode.val(0.0);
+			me.highlight_selected_row();
 			me.update_paid_amount();
 		})
 	},