From 4f33249e1cac61eda8e47359c497be48a499be61 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Mon, 13 Jul 2015 12:15:09 +0530 Subject: [PATCH] Fixes in Production Order --- .../doctype/production_order/production_order.js | 12 +++++++----- .../doctype/production_order/production_order.py | 10 ++-------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/erpnext/manufacturing/doctype/production_order/production_order.js b/erpnext/manufacturing/doctype/production_order/production_order.js index 971f007a1c..17fa202a4d 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.js +++ b/erpnext/manufacturing/doctype/production_order/production_order.js @@ -198,11 +198,13 @@ $.extend(cur_frm.cscript, { frappe.ui.form.trigger("Production Order", 'bom_no') }, - track_operations: function() { - return this.frm.call({ - doc: this.frm.doc, - method: "track_operation" - }); + track_operations: function(doc) { + if (doc.track_operations) { + frappe.ui.form.trigger("Production Order", 'bom_no') + } + else { + doc.operations =[]; + } }, show_time_logs: function(doc, cdt, cdn) { diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py index 52061a08e4..099efaab0d 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, now +from frappe.utils import flt, nowdate, get_datetime, getdate, date_diff, cint from frappe import _ from frappe.model.document import Document from erpnext.manufacturing.doctype.bom.bom import validate_bom_no @@ -329,12 +329,6 @@ class ProductionOrder(Document): 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): @@ -399,7 +393,7 @@ def get_events(start, end, filters=None): return data @frappe.whitelist() -def make_time_log(name, operation, from_time=now(), to_time=now(), qty=None, project=None, workstation=None, operation_id=None): +def make_time_log(name, operation, from_time=None, to_time=None, 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