Holiday List name changed and workstation filter added to time log
diff --git a/erpnext/hr/doctype/holiday_list/holiday_list.json b/erpnext/hr/doctype/holiday_list/holiday_list.json
index 48e0844..af68b47 100644
--- a/erpnext/hr/doctype/holiday_list/holiday_list.json
+++ b/erpnext/hr/doctype/holiday_list/holiday_list.json
@@ -1,5 +1,6 @@
{
"allow_import": 1,
+ "autoname": "field:holiday_list_name",
"creation": "2013-01-10 16:34:14",
"docstatus": 0,
"doctype": "DocType",
@@ -13,7 +14,8 @@
"oldfieldname": "holiday_list_name",
"oldfieldtype": "Data",
"permlevel": 0,
- "reqd": 1
+ "reqd": 1,
+ "unique": 1
},
{
"fieldname": "is_default",
@@ -72,7 +74,7 @@
],
"icon": "icon-calendar",
"idx": 1,
- "modified": "2014-05-09 02:16:38.887266",
+ "modified": "2014-11-25 15:42:22.419054",
"modified_by": "Administrator",
"module": "HR",
"name": "Holiday List",
diff --git a/erpnext/hr/doctype/holiday_list/holiday_list.py b/erpnext/hr/doctype/holiday_list/holiday_list.py
index 496c930..b1dec84 100644
--- a/erpnext/hr/doctype/holiday_list/holiday_list.py
+++ b/erpnext/hr/doctype/holiday_list/holiday_list.py
@@ -11,9 +11,6 @@
from frappe.model.document import Document
class HolidayList(Document):
- def autoname(self):
- self.name = make_autoname(self.fiscal_year + "/" + self.holiday_list_name + "/.###")
-
def validate(self):
self.update_default_holiday_list()
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.js b/erpnext/manufacturing/doctype/production_order/production_order.js
index c383cdd..fbc3cc9 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.js
+++ b/erpnext/manufacturing/doctype/production_order/production_order.js
@@ -58,9 +58,9 @@
bom_no: function() {
return this.frm.call({
doc: this.frm.doc,
- method: "get_production_order_operations",
+ method: "set_production_order_operations",
callback: function(r) {
- if(!r.exc) refresh_field("get_production_order_operations");
+ if(!r.exc) refresh_field("production_order_operations");
}
});
},
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py
index e9e5d8b..aa204f0 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.py
+++ b/erpnext/manufacturing/doctype/production_order/production_order.py
@@ -145,7 +145,7 @@
from erpnext.stock.utils import update_bin
update_bin(args)
- def get_production_order_operations(self):
+ def set_production_order_operations(self):
self.set('production_order_operations', [])
operations = frappe.db.sql("""select operation, opn_description, workstation, hour_rate, time_in_mins,
operating_cost, fixed_cycle_cost from `tabBOM Operation` where parent = %s""", self.bom_no, as_dict=1)
@@ -230,5 +230,6 @@
time_log.operation= operation
time_log.qty= qty
time_log.workstation= workstation
- time_log.calculate_total_hours()
+ if from_time and to_time :
+ time_log.calculate_total_hours()
return time_log
\ No newline at end of file
diff --git a/erpnext/manufacturing/doctype/production_order/test_production_order.py b/erpnext/manufacturing/doctype/production_order/test_production_order.py
index fd407e6..799cfac 100644
--- a/erpnext/manufacturing/doctype/production_order/test_production_order.py
+++ b/erpnext/manufacturing/doctype/production_order/test_production_order.py
@@ -67,7 +67,7 @@
})
- prod_order.get_production_order_operations()
+ prod_order.set_production_order_operations()
prod_order.production_order_operations[0].update({
"planned_start_time": "2014-11-25 00:00:00",
"planned_end_time": "2014-11-25 10:00:00"
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 b6d42c7..5e12c80 100644
--- a/erpnext/manufacturing/doctype/production_order_operation/production_order_operation.json
+++ b/erpnext/manufacturing/doctype/production_order_operation/production_order_operation.json
@@ -262,6 +262,7 @@
"precision": ""
},
{
+ "allow_on_submit": 1,
"fieldname": "make_time_log",
"fieldtype": "Button",
"label": "Make Time Log",
@@ -276,7 +277,7 @@
"is_submittable": 0,
"issingle": 0,
"istable": 1,
- "modified": "2014-11-13 16:47:31.015973",
+ "modified": "2014-11-25 13:34:10.697445",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Production Order Operation",
diff --git a/erpnext/manufacturing/doctype/workstation/test_workstation.py b/erpnext/manufacturing/doctype/workstation/test_workstation.py
index 1df661b..24d2334 100644
--- a/erpnext/manufacturing/doctype/workstation/test_workstation.py
+++ b/erpnext/manufacturing/doctype/workstation/test_workstation.py
@@ -7,9 +7,9 @@
test_dependencies = ["Warehouse"]
test_records = frappe.get_test_records('Workstation')
-
class TestWorkstation(unittest.TestCase):
def test_validate_timings(self):
wks = frappe.get_doc("Workstation", "_Test Workstation 1")
self.assertEqual(1,wks.check_workstation_for_operation_time("2013-02-01 05:00:00", "2013-02-02 20:00:00"))
+ self.assertEqual(None,wks.check_workstation_for_operation_time("2013-02-03 10:00:00", "2013-02-03 20:00:00"))
diff --git a/erpnext/projects/doctype/time_log/time_log.py b/erpnext/projects/doctype/time_log/time_log.py
index 84430e9..ffbd8f3 100644
--- a/erpnext/projects/doctype/time_log/time_log.py
+++ b/erpnext/projects/doctype/time_log/time_log.py
@@ -4,7 +4,7 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+import frappe, json
from frappe import _
from frappe.utils import cstr, cint, comma_and
@@ -135,23 +135,31 @@
parent=%s and operation = %s""", (idx, production_order, operation), as_dict=1)[0]
@frappe.whitelist()
-def get_events(start, end):
+def get_events(start, end, filters=None):
from frappe.desk.reportview import build_match_conditions
if not frappe.has_permission("Time Log"):
frappe.msgprint(_("No Permission"), raise_exception=1)
match = build_match_conditions("Time Log")
- data = frappe.db.sql("""select name, from_time, to_time,
- activity_type, task, project from `tabTime Log`
- where from_time between '%(start)s' and '%(end)s' or to_time between '%(start)s' and '%(end)s'
- %(match)s""" % {
- "start": start,
- "end": end,
- "match": match and (" and " + match) or ""
- }, as_dict=True, update={"allDay": 0})
+
+ conditions = build_match_conditions("Time Log")
+ conditions = conditions and (" and " + conditions) or ""
+ if filters:
+ filters = json.loads(filters)
+ for key in filters:
+ if filters[key]:
+ conditions += " and " + key + ' = "' + filters[key].replace('"', '\"') + '"'
+ data = frappe.db.sql("""select name, from_time, to_time,
+ activity_type, task, project, production_order, workstation from `tabTime Log`
+ where ( from_time between %(start)s and %(end)s or to_time between %(start)s and %(end)s )
+ {conditions}""".format(conditions=conditions), {
+ "start": start,
+ "end": end
+ }, as_dict=True, update={"allDay": 0})
+
for d in data:
- d.title = d.name + ": " + (d.activity_type or "[Activity Type not set]")
+ d.title = d.name + ": " + (d.activity_type or d.production_order or "")
if d.task:
d.title += " for Task: " + d.task
if d.project:
diff --git a/erpnext/projects/doctype/time_log/time_log_calendar.js b/erpnext/projects/doctype/time_log/time_log_calendar.js
index 5b947ef..1808c0c 100644
--- a/erpnext/projects/doctype/time_log/time_log_calendar.js
+++ b/erpnext/projects/doctype/time_log/time_log_calendar.js
@@ -9,5 +9,14 @@
"title": "title",
"allDay": "allDay"
},
+ gantt: true,
+ filters: [
+ {
+ "fieldtype": "Link",
+ "fieldname": "workstation",
+ "options": "Workstation",
+ "label": __("Workstation")
+ },
+ ],
get_events_method: "erpnext.projects.doctype.time_log.time_log.get_events"
}
\ No newline at end of file