against_manufacturing renamed to for_manufacturing

This commit is contained in:
Neil Trini Lasrado 2015-03-24 17:51:31 +05:30
parent bccec29415
commit 3fcd89f63e
7 changed files with 17 additions and 15 deletions

View File

@ -373,7 +373,7 @@ def get_events(start, end, filters=None):
@frappe.whitelist() @frappe.whitelist()
def make_time_log(name, operation, from_time, to_time, qty=None, project=None, workstation=None, operation_id=None): def make_time_log(name, operation, from_time, to_time, qty=None, project=None, workstation=None, operation_id=None):
time_log = frappe.new_doc("Time Log") time_log = frappe.new_doc("Time Log")
time_log.against_manufacturing = 1 time_log.for_manufacturing = 1
time_log.from_time = from_time time_log.from_time = from_time
time_log.to_time = to_time time_log.to_time = to_time
time_log.production_order = name time_log.production_order = name

View File

@ -36,7 +36,7 @@ class TestTimeLog(unittest.TestCase):
time_log = frappe.get_doc({ time_log = frappe.get_doc({
"doctype": "Time Log", "doctype": "Time Log",
"against_manufacturing": 1, "for_manufacturing": 1,
"production_order": prod_order.name, "production_order": prod_order.name,
"qty": 1, "qty": 1,
"from_time": "2014-12-26 00:00:00", "from_time": "2014-12-26 00:00:00",
@ -54,7 +54,7 @@ class TestTimeLog(unittest.TestCase):
time_log = frappe.get_doc({ time_log = frappe.get_doc({
"doctype": "Time Log", "doctype": "Time Log",
"against_manufacturing": 1, "for_manufacturing": 1,
"production_order": prod_order.name, "production_order": prod_order.name,
"operation": prod_order.operations[0].operation, "operation": prod_order.operations[0].operation,
"operation_id": prod_order.operations[0].name, "operation_id": prod_order.operations[0].name,

View File

@ -5,7 +5,7 @@ frappe.provide("erpnext.projects");
frappe.ui.form.on("Time Log", "onload", function(frm) { frappe.ui.form.on("Time Log", "onload", function(frm) {
frm.set_query("task", erpnext.queries.task); frm.set_query("task", erpnext.queries.task);
if (frm.doc.against_manufacturing) { if (frm.doc.for_manufacturing) {
frappe.ui.form.trigger("Time Log", "production_order"); frappe.ui.form.trigger("Time Log", "production_order");
} }
}); });

View File

@ -75,15 +75,15 @@
"read_only": 0 "read_only": 0
}, },
{ {
"fieldname": "against_manufacturing", "fieldname": "for_manufacturing",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Against Manufacturing", "label": "For Manufacturing",
"permlevel": 0, "permlevel": 0,
"precision": "", "precision": "",
"read_only": 1 "read_only": 1
}, },
{ {
"depends_on": "eval:!doc.against_manufacturing", "depends_on": "eval:!doc.for_manufacturing",
"fieldname": "activity_type", "fieldname": "activity_type",
"fieldtype": "Link", "fieldtype": "Link",
"in_list_view": 0, "in_list_view": 0,
@ -94,7 +94,7 @@
"reqd": 0 "reqd": 0
}, },
{ {
"depends_on": "eval:!doc.against_manufacturing", "depends_on": "eval:!doc.for_manufacturing",
"fieldname": "task", "fieldname": "task",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Task", "label": "Task",
@ -103,7 +103,7 @@
"read_only": 0 "read_only": 0
}, },
{ {
"depends_on": "eval:doc.against_manufacturing", "depends_on": "eval:doc.for_manufacturing",
"fieldname": "section_break_11", "fieldname": "section_break_11",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"permlevel": 0, "permlevel": 0,
@ -242,7 +242,7 @@
"icon": "icon-time", "icon": "icon-time",
"idx": 1, "idx": 1,
"is_submittable": 1, "is_submittable": 1,
"modified": "2015-03-24 07:10:31.412669", "modified": "2015-03-24 08:10:31.412670",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Projects", "module": "Projects",
"name": "Time Log", "name": "Time Log",

View File

@ -103,9 +103,11 @@ class TimeLog(Document):
self.hours = flt(time_diff_in_seconds(self.to_time, self.from_time)) / 3600 self.hours = flt(time_diff_in_seconds(self.to_time, self.from_time)) / 3600
def validate_time_log_for(self): def validate_time_log_for(self):
if not self.against_manufacturing: if not self.for_manufacturing:
for fld in ["production_order", "operation", "workstation", "completed_qty"]: for fld in ["production_order", "operation", "workstation", "completed_qty"]:
self.set(fld, None) self.set(fld, None)
else:
self.activity_type=None
def check_workstation_timings(self): def check_workstation_timings(self):
"""Checks if **Time Log** is between operating hours of the **Workstation**.""" """Checks if **Time Log** is between operating hours of the **Workstation**."""
@ -122,7 +124,7 @@ class TimeLog(Document):
def update_production_order(self): def update_production_order(self):
"""Updates `start_date`, `end_date`, `status` for operation in Production Order.""" """Updates `start_date`, `end_date`, `status` for operation in Production Order."""
if self.against_manufacturing and self.production_order: if self.for_manufacturing and self.production_order:
if not self.operation_id: if not self.operation_id:
frappe.throw(_("Operation ID not set")) frappe.throw(_("Operation ID not set"))
@ -185,7 +187,7 @@ class TimeLog(Document):
(self.production_order, self.operation_id), as_dict=1)[0] (self.production_order, self.operation_id), as_dict=1)[0]
def validate_manufacturing(self): def validate_manufacturing(self):
if self.against_manufacturing: if self.for_manufacturing:
if not self.production_order: if not self.production_order:
frappe.throw(_("Production Order is Mandatory")) frappe.throw(_("Production Order is Mandatory"))
if not self.operation: if not self.operation:

View File

@ -3,7 +3,7 @@
// render // render
frappe.listview_settings['Time Log'] = { frappe.listview_settings['Time Log'] = {
add_fields: ["status", "billable", "activity_type", "task", "project", "hours", "against_manufacturing"], add_fields: ["status", "billable", "activity_type", "task", "project", "hours", "for_manufacturing"],
selectable: true, selectable: true,
onload: function(me) { onload: function(me) {
me.page.add_menu_item(__("Make Time Log Batch"), function() { me.page.add_menu_item(__("Make Time Log Batch"), function() {

View File

@ -35,7 +35,7 @@ def create_time_log():
"from_time": "2013-01-02 10:00:00.000000", "from_time": "2013-01-02 10:00:00.000000",
"to_time": "2013-01-02 11:00:00.000000", "to_time": "2013-01-02 11:00:00.000000",
"docstatus": 0, "docstatus": 0,
"against_manufacturing": 0 "for_manufacturing": 0
}) })
time_log.insert() time_log.insert()
time_log.submit() time_log.submit()