mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-17 22:12:12 +00:00
fix: timeout error for work order
(cherry picked from commitb4ceda6f2c) (cherry picked from commit122b966a7b)
This commit is contained in:
committed by
Mergify
parent
246f4373b5
commit
d6614f2848
@@ -309,6 +309,9 @@ class JobCard(Document):
|
|||||||
return overlap
|
return overlap
|
||||||
|
|
||||||
def get_time_logs(self, args, doctype, open_job_cards=None):
|
def get_time_logs(self, args, doctype, open_job_cards=None):
|
||||||
|
if get_datetime(args.from_time) >= get_datetime(args.to_time):
|
||||||
|
args.to_time = add_to_date(args.from_time, minutes=args.remaining_time_in_mins)
|
||||||
|
|
||||||
jc = frappe.qb.DocType("Job Card")
|
jc = frappe.qb.DocType("Job Card")
|
||||||
jctl = frappe.qb.DocType(doctype)
|
jctl = frappe.qb.DocType(doctype)
|
||||||
|
|
||||||
@@ -354,8 +357,10 @@ class JobCard(Document):
|
|||||||
else:
|
else:
|
||||||
query = query.where(jc.name.isin(open_job_cards))
|
query = query.where(jc.name.isin(open_job_cards))
|
||||||
|
|
||||||
if doctype != "Job Card Time Log":
|
if doctype == "Job Card Time Log":
|
||||||
query = query.where(jc.total_time_in_mins == 0)
|
query = query.where(jc.docstatus < 2)
|
||||||
|
else:
|
||||||
|
query = query.where((jc.docstatus == 0) & (jc.total_time_in_mins == 0))
|
||||||
|
|
||||||
time_logs = query.run(as_dict=True)
|
time_logs = query.run(as_dict=True)
|
||||||
|
|
||||||
@@ -412,7 +417,13 @@ class JobCard(Document):
|
|||||||
def schedule_time_logs(self, row):
|
def schedule_time_logs(self, row):
|
||||||
row.remaining_time_in_mins = row.time_in_mins
|
row.remaining_time_in_mins = row.time_in_mins
|
||||||
while row.remaining_time_in_mins > 0:
|
while row.remaining_time_in_mins > 0:
|
||||||
args = frappe._dict({"from_time": row.planned_start_time, "to_time": row.planned_end_time})
|
args = frappe._dict(
|
||||||
|
{
|
||||||
|
"from_time": row.planned_start_time,
|
||||||
|
"to_time": row.planned_end_time,
|
||||||
|
"remaining_time_in_mins": row.remaining_time_in_mins,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
self.validate_overlap_for_workstation(args, row)
|
self.validate_overlap_for_workstation(args, row)
|
||||||
self.check_workstation_time(row)
|
self.check_workstation_time(row)
|
||||||
|
|||||||
Reference in New Issue
Block a user