Track Operations added to Production Order
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.js b/erpnext/manufacturing/doctype/production_order/production_order.js
index 6d16cd4..971f007 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.js
+++ b/erpnext/manufacturing/doctype/production_order/production_order.js
@@ -186,15 +186,24 @@
 	},
 
 	bom_no: function() {
-		return this.frm.call({
-			doc: this.frm.doc,
-			method: "set_production_order_operations"
-		});
+		if (this.frm.doc.track_operations) {
+			return this.frm.call({
+				doc: this.frm.doc,
+				method: "set_production_order_operations"
+			});
+		}
 	},
 	
 	qty: function() {
 		frappe.ui.form.trigger("Production Order", 'bom_no')
 	},
+	
+	track_operations: function() {
+		return this.frm.call({
+			doc: this.frm.doc,
+			method: "track_operation"
+		});
+	},
 
 	show_time_logs: function(doc, cdt, cdn) {
 		var child = locals[cdt][cdn]
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.json b/erpnext/manufacturing/doctype/production_order/production_order.json
index 07cc5c6..ccf3f68 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.json
+++ b/erpnext/manufacturing/doctype/production_order/production_order.json
@@ -74,6 +74,14 @@
    "permlevel": 0
   }, 
   {
+   "default": "1", 
+   "fieldname": "track_operations", 
+   "fieldtype": "Check", 
+   "label": "Track Operations", 
+   "permlevel": 0, 
+   "precision": ""
+  }, 
+  {
    "fieldname": "column_break1", 
    "fieldtype": "Column Break", 
    "oldfieldtype": "Column Break", 
@@ -207,7 +215,7 @@
    "read_only": 1
   }, 
   {
-   "depends_on": "", 
+   "depends_on": "track_operations", 
    "fieldname": "operations_section", 
    "fieldtype": "Section Break", 
    "label": "Operations", 
@@ -216,6 +224,7 @@
    "precision": ""
   }, 
   {
+   "depends_on": "", 
    "fieldname": "operations", 
    "fieldtype": "Table", 
    "label": "Operations", 
@@ -225,6 +234,7 @@
    "read_only": 1
   }, 
   {
+   "depends_on": "track_operations", 
    "fieldname": "section_break_22", 
    "fieldtype": "Section Break", 
    "label": "Operation Cost", 
@@ -358,7 +368,7 @@
  "idx": 1, 
  "in_create": 0, 
  "is_submittable": 1, 
- "modified": "2015-04-13 02:44:17.319988", 
+ "modified": "2015-07-09 03:31:01.291811", 
  "modified_by": "Administrator", 
  "module": "Manufacturing", 
  "name": "Production Order", 
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py
index 0f805d0..52061a0 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.py
+++ b/erpnext/manufacturing/doctype/production_order/production_order.py
@@ -4,7 +4,7 @@
 from __future__ import unicode_literals
 import frappe, json
 
-from frappe.utils import flt, nowdate, get_datetime, getdate, date_diff, cint
+from frappe.utils import flt, nowdate, get_datetime, getdate, date_diff, cint, now
 from frappe import _
 from frappe.model.document import Document
 from erpnext.manufacturing.doctype.bom.bom import validate_bom_no
@@ -174,13 +174,17 @@
 
 	def set_production_order_operations(self):
 		"""Fetch operations from BOM and set in 'Production Order'"""
-
+		if not self.bom_no:
+			return
 		self.set('operations', [])
-
 		operations = frappe.db.sql("""select operation, description, workstation, idx,
 			hour_rate, time_in_mins, "Pending" as status from `tabBOM Operation`
 			where parent = %s order by idx""", self.bom_no, as_dict=1)
-
+		if operations:
+			self.track_operations=1
+		else:
+			self.track_operations=0
+			frappe.msgprint(_("Cannot 'track operations' as selected BOM does not have Operations."))
 		self.set('operations', operations)
 		self.calculate_time()
 
@@ -219,14 +223,12 @@
 		for i, d in enumerate(self.operations):
 			self.set_operation_start_end_time(i, d)
 
-			if not d.workstation:
-				continue
-
 			time_log = make_time_log(self.name, d.operation, d.planned_start_time, d.planned_end_time,
 				flt(self.qty) - flt(d.completed_qty), self.project_name, d.workstation, operation_id=d.name)
 
-			# validate operating hours if workstation [not mandatory] is specified
-			self.check_operation_fits_in_working_hours(d)
+			if d.workstation:
+				# validate operating hours if workstation [not mandatory] is specified
+				self.check_operation_fits_in_working_hours(d)
 
 			original_start_time = time_log.from_time
 			while True:
@@ -327,6 +329,12 @@
 		
 		if frappe.db.get_value("Item", self.production_item, "has_variants"):
 			frappe.throw(_("Production Order cannot be raised against a Item Template"))
+	
+	def track_operation(self):
+		if self.track_operations:
+			self.set_production_order_operations()
+		else:
+			self.set('operations', [])
 
 @frappe.whitelist()
 def get_item_details(item):
@@ -391,7 +399,7 @@
 	return data
 
 @frappe.whitelist()
-def make_time_log(name, operation, from_time, to_time, qty=None,  project=None, workstation=None, operation_id=None):
+def make_time_log(name, operation, from_time=now(), to_time=now(), qty=None,  project=None, workstation=None, operation_id=None):
 	time_log =  frappe.new_doc("Time Log")
 	time_log.for_manufacturing = 1
 	time_log.from_time = from_time
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index c3597e3..fb1ec3d 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -201,6 +201,9 @@
 	def check_if_operations_completed(self):
 		"""Check if Time Logs are completed against before manufacturing to capture operating costs."""
 		prod_order = frappe.get_doc("Production Order", self.production_order)
+		if not prod_order.track_operations:
+			return
+			
 		for d in prod_order.get("operations"):
 			total_completed_qty = flt(self.fg_completed_qty) + flt(prod_order.produced_qty)
 			if total_completed_qty > flt(d.completed_qty):