production order - fixes cost not considering qty issue
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.js b/erpnext/manufacturing/doctype/production_order/production_order.js
index 60ecd03..1946a67 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.js
+++ b/erpnext/manufacturing/doctype/production_order/production_order.js
@@ -189,6 +189,13 @@
 			method: "set_production_order_operations"
 		});
 	},
+	
+	qty: function() {
+		return this.frm.call({
+			doc: this.frm.doc,
+			method: "set_production_order_operations"
+		});
+	},
 
 	show_time_logs: function(doc, cdt, cdn) {
 		var child = locals[cdt][cdn]
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py
index 9d17cf6..572b527 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.py
+++ b/erpnext/manufacturing/doctype/production_order/production_order.py
@@ -35,7 +35,7 @@
 
 		self.validate_sales_order()
 		self.validate_warehouse()
-		self.calculate_operating_cost()
+		self.calculate_time()
 		self.validate_delivery_date()
 
 		from erpnext.utilities.transaction_base import validate_uom_is_integer
@@ -63,6 +63,7 @@
 	def calculate_operating_cost(self):
 		self.planned_operating_cost, self.actual_operating_cost = 0.0, 0.0
 		for d in self.get("operations"):
+			d.planned_operating_cost = flt(d.hour_rate) * (flt(d.time_in_mins) / 60.0)
 			d.actual_operating_cost = flt(d.hour_rate) * (flt(d.actual_operation_time) / 60.0)
 
 			self.planned_operating_cost += flt(d.planned_operating_cost)
@@ -175,14 +176,20 @@
 		self.set('operations', [])
 
 		operations = frappe.db.sql("""select operation, description, workstation, idx,
-			hour_rate, time_in_mins, operating_cost as "planned_operating_cost", "Pending" as status
+			hour_rate, time_in_mins, 0 as "planned_operating_cost", "Pending" as status
 			from `tabBOM Operation` where parent = %s order by idx""", self.bom_no, as_dict=1)
 
 		self.set('operations', operations)
-
+		self.calculate_time()
+		
+	def calculate_time(self):
+		bom_qty = frappe.db.get_value("BOM", self.bom_no, "quantity")
+		
+		for d in self.get("operations"):
+			d.time_in_mins = d.time_in_mins / bom_qty * flt(self.qty)
+			
 		self.calculate_operating_cost()
 
-
 	def get_holidays(self, workstation):
 		holiday_list = frappe.db.get_value("Workstation", workstation, "holiday_list")