bom cleanup: update cost and flat bom by traversing full tree
diff --git a/public/js/utils.js b/public/js/utils.js
index d02fdb3..599232d 100644
--- a/public/js/utils.js
+++ b/public/js/utils.js
@@ -103,4 +103,24 @@
 		AND tabAccount.%(key)s LIKE "%s" ' + (conditions 
 			? (" AND " + conditions.join(" AND "))
 			: "")
+}
+
+erpnext.queries.bom = function(opts) {
+	conditions = [];
+	if (opts) {
+		$.each(opts, function(key, val) {
+			if (esc_quotes(val).charAt(0) != "!")
+				conditions.push("tabBOM.`" + key + "`='"+esc_quotes(val)+"'");
+			else
+				conditions.push("tabBOM.`" + key + "`!='"+esc_quotes(val).substr(1)+"'");
+		});
+	}
+	
+	return 'SELECT tabBOM.name, tabBOM.item \
+		FROM tabBOM \
+		WHERE tabBOM.docstatus=1 \
+		AND tabBOM.is_active="Yes" \
+		AND tabBOM.%(key)s LIKE "%s" ' + (conditions.length 
+			? (" AND " + conditions.join(" AND "))
+			: "")
 }
\ No newline at end of file