From cd1816cc5a4ceab62823c7a29d96b9a94a1e96f2 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Mon, 6 Apr 2015 12:41:44 +0530 Subject: [PATCH] removed unnecesssary functions. Production related feilds made mandatory in TIme Log --- erpnext/projects/doctype/time_log/time_log.js | 43 +------------------ .../projects/doctype/time_log/time_log.json | 8 ++-- erpnext/projects/doctype/time_log/time_log.py | 14 ------ .../stock/doctype/stock_entry/stock_entry.py | 2 +- 4 files changed, 6 insertions(+), 61 deletions(-) diff --git a/erpnext/projects/doctype/time_log/time_log.js b/erpnext/projects/doctype/time_log/time_log.js index 91971f3b2d2..a49b1f1c047 100644 --- a/erpnext/projects/doctype/time_log/time_log.js +++ b/erpnext/projects/doctype/time_log/time_log.js @@ -41,45 +41,4 @@ frappe.ui.form.on("Time Log", "to_time", function(frm) { if(frm._setting_hours) return; frm.set_value("hours", moment(cur_frm.doc.to_time).diff(moment(cur_frm.doc.from_time), "hours")); -}); - -cur_frm.set_query("production_order", function(doc) { - return { - "filters": { - "docstatus": 1 - } - }; -}); - -cur_frm.add_fetch('task','project','project'); - -$.extend(cur_frm.cscript, { - production_order: function(doc) { - if (doc.production_order){ - var operations = []; - frappe.model.with_doc("Production Order", doc.production_order, function(pro) { - doc = frappe.get_doc("Production Order",pro); - $.each(doc.operations , function(i, row){ - operations[i] = row.operation; - }); - frappe.meta.get_docfield("Time Log", "operation", me.frm.doc.name).options = "\n" + operations.join("\n"); - refresh_field("operation"); - }) - } - }, - - operation: function(doc) { - return frappe.call({ - method: "erpnext.projects.doctype.time_log.time_log.get_workstation", - args: { - "production_order": doc.production_order, - "operation": doc.operation - }, - callback: function(r) { - if(!r.exc) { - cur_frm.set_value("workstation", r.message) - } - } - }); - } -}); +}); \ No newline at end of file diff --git a/erpnext/projects/doctype/time_log/time_log.json b/erpnext/projects/doctype/time_log/time_log.json index 6ef576f7f79..20b5c0c296c 100644 --- a/erpnext/projects/doctype/time_log/time_log.json +++ b/erpnext/projects/doctype/time_log/time_log.json @@ -117,7 +117,7 @@ "options": "Production Order", "permlevel": 0, "precision": "", - "read_only": 0 + "read_only": 1 }, { "depends_on": "", @@ -127,7 +127,7 @@ "options": "Operation", "permlevel": 0, "precision": "", - "read_only": 0 + "read_only": 1 }, { "depends_on": "", @@ -155,7 +155,7 @@ "options": "Workstation", "permlevel": 0, "precision": "", - "read_only": 0 + "read_only": 1 }, { "depends_on": "", @@ -242,7 +242,7 @@ "icon": "icon-time", "idx": 1, "is_submittable": 1, - "modified": "2015-03-24 08:10:31.412670", + "modified": "2015-04-06 02:47:16.187046", "modified_by": "Administrator", "module": "Projects", "name": "Time Log", diff --git a/erpnext/projects/doctype/time_log/time_log.py b/erpnext/projects/doctype/time_log/time_log.py index a499c8f7887..c385c0935bb 100644 --- a/erpnext/projects/doctype/time_log/time_log.py +++ b/erpnext/projects/doctype/time_log/time_log.py @@ -206,20 +206,6 @@ class TimeLog(Document): self.operation = None self.quantity = None -@frappe.whitelist() -def get_workstation(production_order, operation): - """Returns workstation name from Production Order against an associated Operation. - - :param production_order string - :param operation string - """ - if operation: - idx, operation = operation.split('. ',1) - - workstation = frappe.db.sql("""select workstation from `tabProduction Order Operation` where idx=%s and - parent=%s and operation = %s""", (idx, production_order, operation)) - return workstation[0][0] if workstation else "" - @frappe.whitelist() def get_events(start, end, filters=None): """Returns events for Gantt / Calendar view rendering. diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index bd2d945ca84..b9dbc9aa08d 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -474,7 +474,7 @@ class StockEntry(StockController): pro_doc = frappe.get_doc("Production Order", self.production_order) _validate_production_order(pro_doc) pro_doc.run_method("update_status") - if self.purpose == "Manufacture": + if self.purpose in ["Manufacture", "Material Transfer for Manufacture"]: pro_doc.run_method("update_production_order_qty") self.update_planned_qty(pro_doc)