mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 00:14:50 +00:00
Update workstation.py
This commit is contained in:
@@ -60,9 +60,10 @@ def is_within_operating_hours(workstation, operation, from_datetime, to_datetime
|
|||||||
workstation = frappe.get_doc("Workstation", workstation)
|
workstation = frappe.get_doc("Workstation", workstation)
|
||||||
|
|
||||||
for working_hour in workstation.working_hours:
|
for working_hour in workstation.working_hours:
|
||||||
slot_length = (to_timedelta(working_hour.end_time or "") - to_timedelta(working_hour.start_time or "")).total_seconds()
|
if working_hour.start_time and working_hour.end_time:
|
||||||
if slot_length >= operation_length:
|
slot_length = (to_timedelta(working_hour.end_time or "") - to_timedelta(working_hour.start_time or "")).total_seconds()
|
||||||
return
|
if slot_length >= operation_length:
|
||||||
|
return
|
||||||
|
|
||||||
frappe.throw(_("Operation {0} longer than any available working hours in workstation {1}, break down the operation into multiple operations").format(operation, workstation.name), NotInWorkingHoursError)
|
frappe.throw(_("Operation {0} longer than any available working hours in workstation {1}, break down the operation into multiple operations").format(operation, workstation.name), NotInWorkingHoursError)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user