From 8a097c862713f93c5ab7eaeafca7da3d2063bb7f Mon Sep 17 00:00:00 2001 From: Rohan Date: Wed, 18 Sep 2019 20:05:49 +0530 Subject: [PATCH] fix: only set times if job card is filled (#19107) --- erpnext/manufacturing/doctype/job_card/job_card.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/erpnext/manufacturing/doctype/job_card/job_card.py b/erpnext/manufacturing/doctype/job_card/job_card.py index a8faa13241..9d2e620e58 100644 --- a/erpnext/manufacturing/doctype/job_card/job_card.py +++ b/erpnext/manufacturing/doctype/job_card/job_card.py @@ -105,7 +105,6 @@ class JobCard(Document): for_quantity, time_in_mins = 0, 0 from_time_list, to_time_list = [], [] - for d in frappe.get_all('Job Card', filters = {'docstatus': 1, 'operation_id': self.operation_id}): doc = frappe.get_doc('Job Card', d.name) @@ -125,8 +124,8 @@ class JobCard(Document): if data.name == self.operation_id: data.completed_qty = for_quantity data.actual_operation_time = time_in_mins - data.actual_start_time = min(from_time_list) - data.actual_end_time = max(to_time_list) + data.actual_start_time = min(from_time_list) if from_time_list else None + data.actual_end_time = max(to_time_list) if to_time_list else None wo.flags.ignore_validate_update_after_submit = True wo.update_operation_status()