Fixes in Production Order

This commit is contained in:
Neil Trini Lasrado 2015-07-13 12:15:09 +05:30
parent 5da4d857c9
commit 4f33249e1c
2 changed files with 9 additions and 13 deletions

View File

@ -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) {

View File

@ -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