chore: remove unused code and fields related to workstation from Timesheet Detail

This commit is contained in:
Rucha Mahabal 2022-02-17 16:59:14 +05:30
parent 47ff968253
commit bef46e2b64
2 changed files with 10 additions and 60 deletions

View File

@ -177,7 +177,7 @@ class Timesheet(Document):
from_time = get_datetime(args.from_time)
to_time = get_datetime(args.to_time)
query = (
existing = (
frappe.qb.from_(timesheet)
.join(timelog)
.on(timelog.parent == timesheet.name)
@ -186,20 +186,14 @@ class Timesheet(Document):
(timelog.name != (args.name or "No Name"))
& (timesheet.name != (args.parent or "No Name"))
& (timesheet.docstatus < 2)
& (timesheet[fieldname] == value)
& (
((from_time > timelog.from_time) & (from_time < timelog.to_time))
| ((to_time > timelog.from_time) & (to_time < timelog.to_time))
| ((from_time <= timelog.from_time) & (to_time >= timelog.to_time))
)
)
)
if fieldname == "workstation":
query = query.where(timelog[fieldname] == value)
else:
query = query.where(timesheet[fieldname] == value)
existing = query.run(as_dict=True)
).run(as_dict=True)
if self.check_internal_overlap(fieldname, args):
return self
@ -217,12 +211,10 @@ class Timesheet(Document):
args_from_time = get_datetime(args.from_time)
args_to_time = get_datetime(args.to_time)
if ((fieldname != 'workstation' or args.get(fieldname) == time_log.get(fieldname)) and
args.idx != time_log.idx and (
if (args.get(fieldname) == time_log.get(fieldname)) and (args.idx != time_log.idx) and (
(args_from_time > from_time and args_from_time < to_time)
or (args_to_time > from_time and args_to_time < to_time)
or (args_from_time <= from_time and args_to_time >= to_time)
)
):
return True
return False

View File

@ -14,12 +14,6 @@
"to_time",
"hours",
"completed",
"section_break_7",
"completed_qty",
"workstation",
"column_break_12",
"operation",
"operation_id",
"project_details",
"project",
"project_name",
@ -83,43 +77,6 @@
"fieldtype": "Check",
"label": "Completed"
},
{
"fieldname": "section_break_7",
"fieldtype": "Section Break"
},
{
"depends_on": "eval:parent.work_order",
"fieldname": "completed_qty",
"fieldtype": "Float",
"label": "Completed Qty"
},
{
"depends_on": "eval:parent.work_order",
"fieldname": "workstation",
"fieldtype": "Link",
"label": "Workstation",
"options": "Workstation",
"read_only": 1
},
{
"fieldname": "column_break_12",
"fieldtype": "Column Break"
},
{
"depends_on": "eval:parent.work_order",
"fieldname": "operation",
"fieldtype": "Link",
"label": "Operation",
"options": "Operation",
"read_only": 1
},
{
"depends_on": "eval:parent.work_order",
"fieldname": "operation_id",
"fieldtype": "Data",
"hidden": 1,
"label": "Operation Id"
},
{
"fieldname": "project_details",
"fieldtype": "Section Break"
@ -267,7 +224,7 @@
"idx": 1,
"istable": 1,
"links": [],
"modified": "2021-05-18 12:19:33.205940",
"modified": "2022-02-17 16:53:34.878798",
"modified_by": "Administrator",
"module": "Projects",
"name": "Timesheet Detail",
@ -275,5 +232,6 @@
"permissions": [],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "ASC"
"sort_order": "ASC",
"states": []
}