Merge branch 'develop'
diff --git a/erpnext/__version__.py b/erpnext/__version__.py
index 3289850..ca621e3 100644
--- a/erpnext/__version__.py
+++ b/erpnext/__version__.py
@@ -1,2 +1,2 @@
 from __future__ import unicode_literals
-__version__ = '5.0.25'
+__version__ = '5.0.26'
diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py
index b4fec98..be2e968 100644
--- a/erpnext/accounts/report/financial_statements.py
+++ b/erpnext/accounts/report/financial_statements.py
@@ -210,7 +210,7 @@
 	if from_date:
 		additional_conditions.append("and posting_date >= %(from_date)s")
 
-	gl_entries = frappe.db.sql("""select posting_date, account, debit, credit from `tabGL Entry`
+	gl_entries = frappe.db.sql("""select posting_date, account, debit, credit, is_opening from `tabGL Entry`
 		where company=%(company)s
 		{additional_conditions}
 		and posting_date <= %(to_date)s
diff --git a/erpnext/accounts/report/general_ledger/general_ledger.py b/erpnext/accounts/report/general_ledger/general_ledger.py
index b268156..9f1f560 100644
--- a/erpnext/accounts/report/general_ledger/general_ledger.py
+++ b/erpnext/accounts/report/general_ledger/general_ledger.py
@@ -3,7 +3,7 @@
 
 from __future__ import unicode_literals
 import frappe
-from frappe.utils import flt, getdate
+from frappe.utils import flt, getdate, cstr
 from frappe import _
 
 def execute(filters=None):
@@ -155,7 +155,7 @@
 	for gle in gl_entries:
 		amount = flt(gle.debit, 3) - flt(gle.credit, 3)
 		if (filters.get("account") or filters.get("party") or filters.get("group_by_account")) \
-				and gle.posting_date < from_date:
+				and (gle.posting_date < from_date or cstr(gle.is_opening) == "Yes"):
 			gle_map[gle.account].opening += amount
 			if filters.get("account") or filters.get("party"):
 				opening += amount
diff --git a/erpnext/accounts/report/trial_balance/trial_balance.py b/erpnext/accounts/report/trial_balance/trial_balance.py
index 8187601..2571751 100644
--- a/erpnext/accounts/report/trial_balance/trial_balance.py
+++ b/erpnext/accounts/report/trial_balance/trial_balance.py
@@ -90,7 +90,7 @@
 		where 
 			company=%(company)s
 			{additional_conditions}
-			and posting_date < %(from_date)s
+			and (posting_date < %(from_date)s or ifnull(is_opening, 'No') = 'Yes')
 			and account in (select name from `tabAccount` where report_type=%(report_type)s)
 		group by account""".format(additional_conditions=additional_conditions),
 		{
@@ -128,16 +128,21 @@
 	for d in accounts:
 		d.update(init.copy())
 
+		# add opening
+		d["opening_debit"] = opening_balances.get(d.name, {}).get("opening_debit", 0)
+		d["opening_credit"] = opening_balances.get(d.name, {}).get("opening_credit", 0)
+
 		for entry in gl_entries_by_account.get(d.name, []):
-			d["debit"] += flt(entry.debit)
-			d["credit"] += flt(entry.credit)
+			if entry.is_opening == "Yes" and d.root_type in ("Asset", "Liability", "Equity"):
+				d["opening_debit"] += flt(entry.debit)
+				d["opening_credit"] += flt(entry.credit)
+			else:
+				d["debit"] += flt(entry.debit)
+				d["credit"] += flt(entry.credit)
 
 		total_row["debit"] += d["debit"]
 		total_row["credit"] += d["credit"]
 		
-		# add opening
-		d["opening_debit"] = opening_balances.get(d.name, {}).get("opening_debit", 0)
-		d["opening_credit"] = opening_balances.get(d.name, {}).get("opening_credit", 0)
 
 	return total_row
 
diff --git a/erpnext/config/manufacturing.py b/erpnext/config/manufacturing.py
index c2dacad..5b51b0f 100644
--- a/erpnext/config/manufacturing.py
+++ b/erpnext/config/manufacturing.py
@@ -103,6 +103,12 @@
 					"name": "Completed Production Orders",
 					"doctype": "Production Order"
 				},
+				{
+					"type": "report",
+					"is_query_report": True,
+					"name": "BOM Search",
+					"doctype": "BOM"
+				},
 			]
 		},
 		{
diff --git a/erpnext/config/selling.py b/erpnext/config/selling.py
index 7f8d517..78c73d8 100644
--- a/erpnext/config/selling.py
+++ b/erpnext/config/selling.py
@@ -240,6 +240,12 @@
 				{
 					"type": "report",
 					"is_query_report": True,
+					"name": "BOM Search",
+					"doctype": "BOM"
+				},
+				{
+					"type": "report",
+					"is_query_report": True,
 					"name": "Customers Not Buying Since Long Time",
 					"doctype": "Sales Order"
 				},
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index fa92684..d36f269 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -5,7 +5,7 @@
 app_description = "Open Source Enterprise Resource Planning for Small and Midsized Organizations"
 app_icon = "icon-th"
 app_color = "#e74c3c"
-app_version = "5.0.25"
+app_version = "5.0.26"
 
 error_report_email = "support@erpnext.com"
 
diff --git a/erpnext/setup/doctype/naming_series/naming_series.py b/erpnext/setup/doctype/naming_series/naming_series.py
index dc7a90c..81a4c4e 100644
--- a/erpnext/setup/doctype/naming_series/naming_series.py
+++ b/erpnext/setup/doctype/naming_series/naming_series.py
@@ -26,7 +26,8 @@
 			except frappe.DoesNotExistError:
 				continue
 
-			prefixes = prefixes + "\n" + options
+			if options:
+				prefixes = prefixes + "\n" + options
 
 		prefixes.replace("\n\n", "\n")
 		prefixes = "\n".join(sorted(prefixes.split()))
diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js
index b31b682..ed1367e 100644
--- a/erpnext/stock/doctype/item/item.js
+++ b/erpnext/stock/doctype/item/item.js
@@ -55,6 +55,9 @@
 		// read only if any stock ledger entry exists
 		erpnext.item.make_dashboard(frm);
 
+		// clear intro
+		frm.set_intro();
+
 		if (frm.doc.has_variants) {
 			frm.set_intro(__("This Item is a Template and cannot be used in transactions. Item attributes will be copied over into the variants unless 'No Copy' is set"), true);
 			frm.add_custom_button(__("Show Variants"), function() {
@@ -85,7 +88,7 @@
 		erpnext.item.weight_to_validate(frm);
 		erpnext.item.variants_can_not_be_created_manually(frm);
 	},
-	
+
 	image: function(frm) {
 		refresh_field("image_view");
 	},
@@ -209,11 +212,11 @@
 			validated = 0;
 		}
 	},
-	
+
 	variants_can_not_be_created_manually: function(frm) {
 		if (frm.doc.__islocal && frm.doc.variant_of)
 			frappe.throw(__("Variants can not be created manually, add item attributes in the template item"))
 	}
-	
+
 
 });
diff --git a/erpnext/stock/report/bom_search/__init__.py b/erpnext/stock/report/bom_search/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/stock/report/bom_search/__init__.py
diff --git a/erpnext/stock/report/bom_search/bom_search.js b/erpnext/stock/report/bom_search/bom_search.js
new file mode 100644
index 0000000..e9e763c
--- /dev/null
+++ b/erpnext/stock/report/bom_search/bom_search.js
@@ -0,0 +1,42 @@
+// Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and Contributors and contributors
+// For license information, please see license.txt
+
+frappe.query_reports["BOM Search"] = {
+	"filters": [
+		{
+			fieldname: "item1",
+			label: __("Item 1"),
+			fieldtype: "Link",
+			options: "Item"
+		},
+		{
+			fieldname: "item2",
+			label: __("Item 2"),
+			fieldtype: "Link",
+			options: "Item"
+		},
+		{
+			fieldname: "item3",
+			label: __("Item 3"),
+			fieldtype: "Link",
+			options: "Item"
+		},
+		{
+			fieldname: "item4",
+			label: __("Item 4"),
+			fieldtype: "Link",
+			options: "Item"
+		},
+		{
+			fieldname: "item5",
+			label: __("Item 5"),
+			fieldtype: "Link",
+			options: "Item"
+		},
+		{
+			fieldname: "search_sub_assemblies",
+			label: __("Search Sub Assemblies"),
+			fieldtype: "Check",
+		},
+	]
+}
diff --git a/erpnext/stock/report/bom_search/bom_search.json b/erpnext/stock/report/bom_search/bom_search.json
new file mode 100644
index 0000000..2857c17
--- /dev/null
+++ b/erpnext/stock/report/bom_search/bom_search.json
@@ -0,0 +1,17 @@
+{
+ "add_total_row": 0, 
+ "apply_user_permissions": 0, 
+ "creation": "2015-06-16 15:16:11.930954", 
+ "disabled": 0, 
+ "docstatus": 0, 
+ "doctype": "Report", 
+ "is_standard": "Yes", 
+ "modified": "2015-06-16 15:16:29.850834", 
+ "modified_by": "Administrator", 
+ "module": "Stock", 
+ "name": "BOM Search", 
+ "owner": "Administrator", 
+ "ref_doctype": "BOM", 
+ "report_name": "BOM Search", 
+ "report_type": "Script Report"
+}
\ No newline at end of file
diff --git a/erpnext/stock/report/bom_search/bom_search.py b/erpnext/stock/report/bom_search/bom_search.py
new file mode 100644
index 0000000..b8a7b78
--- /dev/null
+++ b/erpnext/stock/report/bom_search/bom_search.py
@@ -0,0 +1,43 @@
+# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and Contributors and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe, json
+
+def execute(filters=None):
+	data = []
+	parents = {
+		"Sales BOM Item": "Sales BOM",
+		"BOM Explosion Item": "BOM",
+		"BOM Item": "BOM"
+	}
+
+	for doctype in ("Sales BOM Item",
+		"BOM Explosion Item" if filters.search_sub_assemblies else "BOM Item"):
+		all_boms = {}
+		for d in frappe.get_all(doctype, fields=["parent", "item_code"]):
+			all_boms.setdefault(d.parent, []).append(d.item_code)
+
+		for parent, items in all_boms.iteritems():
+			valid = True
+			for key, item in filters.iteritems():
+				if key != "search_sub_assemblies":
+					if item and item not in items:
+						valid = False
+
+			if valid:
+				data.append((parent, parents[doctype]))
+
+	return [{
+		"fieldname": "parent",
+		"label": "BOM",
+		"width": 200,
+		"fieldtype": "Dynamic Link",
+		"options": "doctype"
+	},
+	{
+		"fieldname": "doctype",
+		"label": "Type",
+		"width": 200,
+		"fieldtype": "Data"
+	}], data
diff --git a/setup.py b/setup.py
index 86e89f9..2cba2e8 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,6 @@
 from setuptools import setup, find_packages
 
-version = "5.0.25"
+version = "5.0.26"
 
 with open("requirements.txt", "r") as f:
 	install_requires = f.readlines()