workstation and operation time made editable in production order. Cost recalculation logic added
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.js b/erpnext/manufacturing/doctype/production_order/production_order.js
index f7ebaa9..dde7b21 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.js
+++ b/erpnext/manufacturing/doctype/production_order/production_order.js
@@ -176,7 +176,47 @@
 	} else msgprint(__("Please enter Production Item first"));
 });
 
-frappe.ui.form.on("Production Order", "additional_operating_cost", function(frm) {
+
+var calculate_total_cost = function(frm) {
 	var variable_cost = frm.doc.actual_operating_cost ? flt(frm.doc.actual_operating_cost) : flt(frm.doc.planned_operating_cost)
 	frm.set_value("total_operating_cost", (flt(frm.doc.additional_operating_cost) + variable_cost))
-})
+}
+
+frappe.ui.form.on("Production Order", "additional_operating_cost", function(frm) {
+	calculate_total_cost(frm);
+});
+
+frappe.ui.form.on("Production Order Operation", "workstation", function(frm, cdt, cdn) {
+	var d = locals[cdt][cdn];
+	frappe.call({
+		"method": "frappe.client.get",
+		args: {
+			doctype: "Workstation",
+			name: d.workstation
+		},
+		callback: function (data) {
+			frappe.model.set_value(d.doctype, d.name, "hour_rate", data.message.hour_rate);
+			calculate_cost(frm.doc);
+			calculate_total_cost(frm);
+		}
+	})
+});
+
+var calculate_cost = function(doc) {
+	if (doc.operations){
+		var op = doc.operations;
+		doc.planned_operating_cost = 0.0;
+		for(var i=0;i<op.length;i++) {
+			planned_operating_cost = flt(flt(op[i].hour_rate) * flt(op[i].time_in_mins) / 60, 2);
+			frappe.model.set_value('Production Order Operation',op[i].name, "planned_operating_cost", planned_operating_cost);
+
+			doc.planned_operating_cost += planned_operating_cost;
+		}
+		refresh_field('planned_operating_cost');
+	}
+}
+
+frappe.ui.form.on("Production Order Operation", "time_in_mins", function(frm, cdt, cdn) {
+	calculate_cost(frm.doc);
+	calculate_total_cost(frm)
+});
\ No newline at end of file
diff --git a/erpnext/manufacturing/doctype/production_order_operation/production_order_operation.json b/erpnext/manufacturing/doctype/production_order_operation/production_order_operation.json
index f495b0b..cd62ad2 100644
--- a/erpnext/manufacturing/doctype/production_order_operation/production_order_operation.json
+++ b/erpnext/manufacturing/doctype/production_order_operation/production_order_operation.json
@@ -117,7 +117,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
-   "read_only": 1, 
+   "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -173,7 +173,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
-   "read_only": 1, 
+   "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -282,7 +282,7 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2014-12-23 15:42:34.892964", 
+ "modified": "2015-02-13 16:26:30.441657", 
  "modified_by": "Administrator", 
  "module": "Manufacturing", 
  "name": "Production Order Operation",