From f2a0161709e791bb6b487c50728860c3712b89d2 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 12 Jun 2015 18:58:36 -0400 Subject: [PATCH] [fix] Don't create Time Logs against Production Order if Workstation is not specified in Operations --- .../doctype/production_order/production_order.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py index 6de0d7b46d..ca5f6d972c 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.py +++ b/erpnext/manufacturing/doctype/production_order/production_order.py @@ -217,12 +217,14 @@ class ProductionOrder(Document): for i, d in enumerate(self.operations): self.set_operation_start_end_time(i, d) + if not d.workstation: + continue + time_log = make_time_log(self.name, d.operation, d.planned_start_time, d.planned_end_time, flt(self.qty) - flt(d.completed_qty), self.project_name, d.workstation, operation_id=d.name) - if d.workstation: - # validate operating hours if workstation [not mandatory] is specified - self.check_operation_fits_in_working_hours(d) + # validate operating hours if workstation [not mandatory] is specified + self.check_operation_fits_in_working_hours(d) original_start_time = time_log.from_time while True: