Merge pull request #12633 from vishdha/issue_12388

[fix] Sales order link to purchase order not working fixed
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 1b88bdc..96ad60f 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -5,7 +5,7 @@
 from erpnext.hooks import regional_overrides
 from frappe.utils import getdate
 
-__version__ = '10.0.17'
+__version__ = '10.0.18'
 
 def get_default_company(user=None):
 	'''Get default company for user'''
diff --git a/erpnext/accounts/doctype/tax_rule/tax_rule.py b/erpnext/accounts/doctype/tax_rule/tax_rule.py
index 9c091e8..2e92e05 100644
--- a/erpnext/accounts/doctype/tax_rule/tax_rule.py
+++ b/erpnext/accounts/doctype/tax_rule/tax_rule.py
@@ -130,8 +130,8 @@
 def get_tax_template(posting_date, args):
 	"""Get matching tax rule"""
 	args = frappe._dict(args)
-	conditions = ["""(from_date is null  or from_date = '' or from_date <= '{0}')
-		and (to_date is null  or to_date = '' or to_date >= '{0}')""".format(posting_date)]
+	conditions = ["""(from_date is null or from_date <= '{0}')
+		and (to_date is null or to_date >= '{0}')""".format(posting_date)]
 
 	for key, value in args.iteritems():
 		if key=="use_for_shopping_cart":
diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py
index 53f9ecb..139586f 100644
--- a/erpnext/controllers/queries.py
+++ b/erpnext/controllers/queries.py
@@ -257,7 +257,7 @@
 def get_batch_no(doctype, txt, searchfield, start, page_len, filters):
 	cond = ""
 	if filters.get("posting_date"):
-		cond = "and (ifnull(batch.expiry_date, '')='' or batch.expiry_date >= %(posting_date)s)"
+		cond = "and (batch.expiry_date is null or batch.expiry_date >= %(posting_date)s)"
 
 	batch_nos = None
 	args = {
diff --git a/erpnext/patches/v7_1/set_currency_exchange_date.py b/erpnext/patches/v7_1/set_currency_exchange_date.py
index 7d8e4f0..630b7d4 100644
--- a/erpnext/patches/v7_1/set_currency_exchange_date.py
+++ b/erpnext/patches/v7_1/set_currency_exchange_date.py
@@ -5,5 +5,5 @@
 	frappe.db.sql("""
 		update `tabCurrency Exchange` 
 		set `date` = '2010-01-01' 
-		where date is null or date = '' or date = '0000-00-00'
+		where date is null or date = '0000-00-00'
 	""")
\ No newline at end of file
diff --git a/erpnext/patches/v7_2/rename_att_date_attendance.py b/erpnext/patches/v7_2/rename_att_date_attendance.py
index f7caf70..b2658ba 100644
--- a/erpnext/patches/v7_2/rename_att_date_attendance.py
+++ b/erpnext/patches/v7_2/rename_att_date_attendance.py
@@ -7,7 +7,7 @@
 	frappe.reload_doc("hr", "doctype", "attendance")
 	frappe.db.sql("""update `tabAttendance` 
 	 		set attendance_date = att_date
-			where attendance_date is null or attendance_date = '' or attendance_date = '0000-00-00'""")
+			where attendance_date is null or attendance_date = '0000-00-00'""")
 	
 	update_reports("Attendance", "att_date", "attendance_date")
 	update_users_report_view_settings("Attendance", "att_date", "attendance_date")
diff --git a/erpnext/patches/v7_2/update_salary_slips.py b/erpnext/patches/v7_2/update_salary_slips.py
index 22bb1d8..c6bca8e 100644
--- a/erpnext/patches/v7_2/update_salary_slips.py
+++ b/erpnext/patches/v7_2/update_salary_slips.py
@@ -9,8 +9,7 @@
 
 	salary_slips = frappe.db.sql("""select month, name, fiscal_year from `tabSalary Slip`
 				where (month is not null and month != '') and
-				(start_date is null  or start_date = '') and
-				(end_date is null  or end_date = '') and docstatus != 2""", as_dict=True)
+				start_date is null and end_date is null and docstatus != 2""", as_dict=True)
 
 	for salary_slip in salary_slips:
 		if not cint(salary_slip.month):
diff --git a/erpnext/stock/doctype/batch/batch.py b/erpnext/stock/doctype/batch/batch.py
index 1c66ea6..eca0475 100644
--- a/erpnext/stock/doctype/batch/batch.py
+++ b/erpnext/stock/doctype/batch/batch.py
@@ -116,7 +116,7 @@
 			else:
 				batch_qty = get_batch_qty(batch_no=d.batch_no, warehouse=warehouse)
 				if flt(batch_qty, d.precision("qty")) < flt(qty, d.precision("qty")):
-					frappe.throw(_("Row #{0}: The batch {1} has only {2} qty. Please select another batch which has {3} qty available or split the row into multiple rows, to deliver/issue from multiple batches").format(d.idx, d.batch_no, batch_qty, d.stock_qty))
+					frappe.throw(_("Row #{0}: The batch {1} has only {2} qty. Please select another batch which has {3} qty available or split the row into multiple rows, to deliver/issue from multiple batches").format(d.idx, d.batch_no, batch_qty, qty))
 
 @frappe.whitelist()
 def get_batch_no(item_code, warehouse, qty=1, throw=False):