bom code cleanup
diff --git a/manufacturing/doctype/bom/bom.js b/manufacturing/doctype/bom/bom.js
index 9d0175f..7cd6e06 100644
--- a/manufacturing/doctype/bom/bom.js
+++ b/manufacturing/doctype/bom/bom.js
@@ -19,7 +19,7 @@
 	cur_frm.toggle_enable("item", doc.__islocal);
 	if (!doc.__islocal && doc.docstatus==0) {
 		cur_frm.set_intro("Submit the BOM to use it in production");
-	}
+	} else cur_frm.set_intro("");
 }
 
 cur_frm.cscript.item = function(doc, dt, dn) {
@@ -164,8 +164,12 @@
 		ORDER BY `tabItem`.`name` LIMIT 50';
 }
 
-cur_frm.fields_dict['bom_materials'].grid.get_field('bom_no').get_query = function(doc) {
-	var d = locals[this.doctype][this.docname];
+cur_frm.fields_dict['bom_materials'].grid.get_field('bom_no').get_query = function(doc, cdt, cdn) {
+	var d = locals[cdt][cdn];
+	msgprint('SELECT DISTINCT `tabBOM`.`name`, `tabBOM`.`remarks` FROM `tabBOM` \
+		WHERE `tabBOM`.`item` = "' + d.item_code + '" AND `tabBOM`.`is_active` = "Yes" AND \
+		 	`tabBOM`.docstatus = 1 AND `tabBOM`.`name` like "%s" \
+		ORDER BY `tabBOM`.`name` LIMIT 50');
 	return 'SELECT DISTINCT `tabBOM`.`name`, `tabBOM`.`remarks` FROM `tabBOM` \
 		WHERE `tabBOM`.`item` = "' + d.item_code + '" AND `tabBOM`.`is_active` = "Yes" AND \
 		 	`tabBOM`.docstatus = 1 AND `tabBOM`.`name` like "%s" \
diff --git a/manufacturing/doctype/bom/bom.py b/manufacturing/doctype/bom/bom.py
index ea596db..7345569 100644
--- a/manufacturing/doctype/bom/bom.py
+++ b/manufacturing/doctype/bom/bom.py
@@ -42,7 +42,7 @@
 
 	def get_item_det(self, item_code):
 		item = sql("""select name, is_asset_item, is_purchase_item, docstatus,
-		 	is_sub_contracted_item, description, stock_uom, default_bom, 
+		 	is_sub_contracted_item, stock_uom, default_bom, 
 			last_purchase_rate, standard_rate, is_manufactured_item 
 			from `tabItem` where item_code = %s""", item_code, as_dict = 1)
 
@@ -50,27 +50,13 @@
 
 
 	def get_item_detail(self, item_code):
-		""" Get stock uom and description for finished good item"""
-
-		item = self.get_item_det(item_code)
-		ret={
-			'description'	 : item and item[0]['description'] or '',
-			'uom'				: item and item[0]['stock_uom'] or ''
-		}
-		return ret
-
+		return { 'uom' : webnotes.conn.get_value("Item", item_code, "stock_uom")}
 
 	def get_workstation_details(self,workstation):
-		""" Fetch hour rate from workstation master"""
-
-		ws = sql("select hour_rate from `tabWorkstation` where name = %s", 
-			workstation , as_dict = 1)
-		return {'hour_rate'	: ws and flt(ws[0]['hour_rate']) or ''}
+		return {'hour_rate': webnotes.conn.get_value("Workstation", workstation, "hour_rate")}
 
 
 	def validate_rm_item(self, item):
-		""" Validate raw material items"""
-
 		if item[0]['name'] == self.doc.item:
 			msgprint("Item_code: %s in materials tab cannot be same as FG Item", 
 				item[0]['name'], raise_exception=1)
@@ -130,7 +116,6 @@
 			as per valuation method (MAR/FIFO) 
 			as on costing date	
 		"""
-
 		dt = self.doc.costing_date or nowdate()
 		time = self.doc.costing_date == nowdate() and now().split()[1] or '23:59'
 		warehouse = sql("select warehouse from `tabBin` where item_code = %s", arg['item_code'])
diff --git a/manufacturing/doctype/bom/bom.txt b/manufacturing/doctype/bom/bom.txt
index 90bcfc7..14fa23e 100644
--- a/manufacturing/doctype/bom/bom.txt
+++ b/manufacturing/doctype/bom/bom.txt
@@ -2,9 +2,9 @@
  {
   "owner": "Administrator", 
   "docstatus": 0, 
-  "creation": "2012-12-10 19:03:43", 
+  "creation": "2012-12-12 10:17:41", 
   "modified_by": "Administrator", 
-  "modified": "2012-12-11 15:13:42"
+  "modified": "2012-12-13 11:43:11"
  }, 
  {
   "istable": 0, 
@@ -68,6 +68,7 @@
  }, 
  {
   "description": "Total quantity of items for which raw materials required and operations done will be defined", 
+  "default": "1", 
   "oldfieldtype": "Currency", 
   "doctype": "DocField", 
   "label": "Quantity", 
@@ -79,19 +80,28 @@
  }, 
  {
   "doctype": "DocField", 
+  "label": "Item UOM", 
+  "options": "link:UOM", 
+  "fieldname": "uom", 
+  "fieldtype": "Select", 
+  "permlevel": 1
+ }, 
+ {
+  "doctype": "DocField", 
   "width": "50%", 
   "fieldname": "column_break1", 
   "fieldtype": "Column Break", 
   "permlevel": 0
  }, 
  {
+  "permlevel": 0, 
   "no_copy": 1, 
   "oldfieldtype": "Select", 
   "allow_on_submit": 1, 
   "doctype": "DocField", 
   "label": "Is Active", 
   "oldfieldname": "is_active", 
-  "permlevel": 0, 
+  "default": "Yes", 
   "fieldname": "is_active", 
   "fieldtype": "Select", 
   "reqd": 1, 
@@ -204,30 +214,6 @@
   "in_filter": 1
  }, 
  {
-  "doctype": "DocField", 
-  "label": "Item UOM", 
-  "options": "link:UOM", 
-  "fieldname": "uom", 
-  "fieldtype": "Select", 
-  "permlevel": 1
- }, 
- {
-  "oldfieldtype": "Text", 
-  "doctype": "DocField", 
-  "label": "Item Description", 
-  "oldfieldname": "description", 
-  "width": "300px", 
-  "fieldname": "description", 
-  "fieldtype": "Small Text", 
-  "permlevel": 0
- }, 
- {
-  "doctype": "DocField", 
-  "fieldname": "col_break23", 
-  "fieldtype": "Column Break", 
-  "permlevel": 0
- }, 
- {
   "oldfieldtype": "Data", 
   "doctype": "DocField", 
   "label": "Maintained By", 
@@ -237,6 +223,12 @@
   "permlevel": 0
  }, 
  {
+  "doctype": "DocField", 
+  "fieldname": "col_break23", 
+  "fieldtype": "Column Break", 
+  "permlevel": 0
+ }, 
+ {
   "print_hide": 1, 
   "no_copy": 1, 
   "doctype": "DocField", 
@@ -270,7 +262,7 @@
  {
   "print_hide": 0, 
   "doctype": "DocField", 
-  "label": "Exploded BOM Items", 
+  "label": "BOM Explosion Items", 
   "options": "Simple", 
   "fieldname": "section_break0", 
   "fieldtype": "Section Break", 
@@ -283,7 +275,7 @@
   "no_copy": 1, 
   "oldfieldtype": "Table", 
   "doctype": "DocField", 
-  "label": "Exploded BOM Items", 
+  "label": "BOM Explosion Item", 
   "oldfieldname": "flat_bom_details", 
   "default": "No Toolbar", 
   "fieldname": "flat_bom_details",