Holiday List name changed and workstation filter added to time log
This commit is contained in:
parent
812cd8a8ce
commit
5ec7542519
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"allow_import": 1,
|
"allow_import": 1,
|
||||||
|
"autoname": "field:holiday_list_name",
|
||||||
"creation": "2013-01-10 16:34:14",
|
"creation": "2013-01-10 16:34:14",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
@ -13,7 +14,8 @@
|
|||||||
"oldfieldname": "holiday_list_name",
|
"oldfieldname": "holiday_list_name",
|
||||||
"oldfieldtype": "Data",
|
"oldfieldtype": "Data",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"reqd": 1
|
"reqd": 1,
|
||||||
|
"unique": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "is_default",
|
"fieldname": "is_default",
|
||||||
@ -72,7 +74,7 @@
|
|||||||
],
|
],
|
||||||
"icon": "icon-calendar",
|
"icon": "icon-calendar",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"modified": "2014-05-09 02:16:38.887266",
|
"modified": "2014-11-25 15:42:22.419054",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Holiday List",
|
"name": "Holiday List",
|
||||||
|
@ -11,9 +11,6 @@ from frappe import throw, _
|
|||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
|
||||||
class HolidayList(Document):
|
class HolidayList(Document):
|
||||||
def autoname(self):
|
|
||||||
self.name = make_autoname(self.fiscal_year + "/" + self.holiday_list_name + "/.###")
|
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
self.update_default_holiday_list()
|
self.update_default_holiday_list()
|
||||||
|
|
||||||
|
@ -58,9 +58,9 @@ $.extend(cur_frm.cscript, {
|
|||||||
bom_no: function() {
|
bom_no: function() {
|
||||||
return this.frm.call({
|
return this.frm.call({
|
||||||
doc: this.frm.doc,
|
doc: this.frm.doc,
|
||||||
method: "get_production_order_operations",
|
method: "set_production_order_operations",
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
if(!r.exc) refresh_field("get_production_order_operations");
|
if(!r.exc) refresh_field("production_order_operations");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -145,7 +145,7 @@ class ProductionOrder(Document):
|
|||||||
from erpnext.stock.utils import update_bin
|
from erpnext.stock.utils import update_bin
|
||||||
update_bin(args)
|
update_bin(args)
|
||||||
|
|
||||||
def get_production_order_operations(self):
|
def set_production_order_operations(self):
|
||||||
self.set('production_order_operations', [])
|
self.set('production_order_operations', [])
|
||||||
operations = frappe.db.sql("""select operation, opn_description, workstation, hour_rate, time_in_mins,
|
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)
|
operating_cost, fixed_cycle_cost from `tabBOM Operation` where parent = %s""", self.bom_no, as_dict=1)
|
||||||
@ -230,5 +230,6 @@ def make_time_log(name, operation, from_time=None, to_time=None, qty=None, proje
|
|||||||
time_log.operation= operation
|
time_log.operation= operation
|
||||||
time_log.qty= qty
|
time_log.qty= qty
|
||||||
time_log.workstation= workstation
|
time_log.workstation= workstation
|
||||||
time_log.calculate_total_hours()
|
if from_time and to_time :
|
||||||
|
time_log.calculate_total_hours()
|
||||||
return time_log
|
return time_log
|
@ -67,7 +67,7 @@ class TestProductionOrder(unittest.TestCase):
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
prod_order.get_production_order_operations()
|
prod_order.set_production_order_operations()
|
||||||
prod_order.production_order_operations[0].update({
|
prod_order.production_order_operations[0].update({
|
||||||
"planned_start_time": "2014-11-25 00:00:00",
|
"planned_start_time": "2014-11-25 00:00:00",
|
||||||
"planned_end_time": "2014-11-25 10:00:00"
|
"planned_end_time": "2014-11-25 10:00:00"
|
||||||
|
@ -262,6 +262,7 @@
|
|||||||
"precision": ""
|
"precision": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_on_submit": 1,
|
||||||
"fieldname": "make_time_log",
|
"fieldname": "make_time_log",
|
||||||
"fieldtype": "Button",
|
"fieldtype": "Button",
|
||||||
"label": "Make Time Log",
|
"label": "Make Time Log",
|
||||||
@ -276,7 +277,7 @@
|
|||||||
"is_submittable": 0,
|
"is_submittable": 0,
|
||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"modified": "2014-11-13 16:47:31.015973",
|
"modified": "2014-11-25 13:34:10.697445",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Manufacturing",
|
"module": "Manufacturing",
|
||||||
"name": "Production Order Operation",
|
"name": "Production Order Operation",
|
||||||
|
@ -7,9 +7,9 @@ import unittest
|
|||||||
test_dependencies = ["Warehouse"]
|
test_dependencies = ["Warehouse"]
|
||||||
test_records = frappe.get_test_records('Workstation')
|
test_records = frappe.get_test_records('Workstation')
|
||||||
|
|
||||||
|
|
||||||
class TestWorkstation(unittest.TestCase):
|
class TestWorkstation(unittest.TestCase):
|
||||||
|
|
||||||
def test_validate_timings(self):
|
def test_validate_timings(self):
|
||||||
wks = frappe.get_doc("Workstation", "_Test Workstation 1")
|
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(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"))
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# For license information, please see license.txt
|
# For license information, please see license.txt
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe, json
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.utils import cstr, cint, comma_and
|
from frappe.utils import cstr, cint, comma_and
|
||||||
|
|
||||||
@ -135,23 +135,31 @@ def get_workstation(production_order, operation):
|
|||||||
parent=%s and operation = %s""", (idx, production_order, operation), as_dict=1)[0]
|
parent=%s and operation = %s""", (idx, production_order, operation), as_dict=1)[0]
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_events(start, end):
|
def get_events(start, end, filters=None):
|
||||||
from frappe.desk.reportview import build_match_conditions
|
from frappe.desk.reportview import build_match_conditions
|
||||||
if not frappe.has_permission("Time Log"):
|
if not frappe.has_permission("Time Log"):
|
||||||
frappe.msgprint(_("No Permission"), raise_exception=1)
|
frappe.msgprint(_("No Permission"), raise_exception=1)
|
||||||
|
|
||||||
match = build_match_conditions("Time Log")
|
match = build_match_conditions("Time Log")
|
||||||
|
|
||||||
|
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,
|
data = frappe.db.sql("""select name, from_time, to_time,
|
||||||
activity_type, task, project from `tabTime Log`
|
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'
|
where ( from_time between %(start)s and %(end)s or to_time between %(start)s and %(end)s )
|
||||||
%(match)s""" % {
|
{conditions}""".format(conditions=conditions), {
|
||||||
"start": start,
|
"start": start,
|
||||||
"end": end,
|
"end": end
|
||||||
"match": match and (" and " + match) or ""
|
}, as_dict=True, update={"allDay": 0})
|
||||||
}, as_dict=True, update={"allDay": 0})
|
|
||||||
|
|
||||||
for d in data:
|
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:
|
if d.task:
|
||||||
d.title += " for Task: " + d.task
|
d.title += " for Task: " + d.task
|
||||||
if d.project:
|
if d.project:
|
||||||
|
@ -9,5 +9,14 @@ frappe.views.calendar["Time Log"] = {
|
|||||||
"title": "title",
|
"title": "title",
|
||||||
"allDay": "allDay"
|
"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"
|
get_events_method: "erpnext.projects.doctype.time_log.time_log.get_events"
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user