Error when making production order

Hello I get this message when I try to make a production order. “Server Error: Please check your server logs or contact tech support.” and then it gives me all this code:

Traceback (innermost last):
File “/home/frappe/press/benches/1504280937/apps/frappe/frappe/desk/form/save.py”, line 18, in savedocs
doc.save()
File “/home/frappe/press/benches/1504280937/apps/frappe/frappe/model/document.py”, line 238, in save
self.run_post_save_methods()
File “/home/frappe/press/benches/1504280937/apps/frappe/frappe/model/document.py”, line 563, in run_post_save_methods
self.run_method(“on_submit”)
File “/home/frappe/press/benches/1504280937/apps/frappe/frappe/model/document.py”, line 508, in run_method
return Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/press/benches/1504280937/apps/frappe/frappe/model/document.py”, line 621, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/press/benches/1504280937/apps/frappe/frappe/model/document.py”, line 604, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/press/benches/1504280937/apps/frappe/frappe/model/document.py”, line 502, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/press/benches/1504280937/apps/erpnext/erpnext/manufacturing/doctype/production_order/production_order.py”, line 146, in on_submit
self.make_time_logs()
File “/home/frappe/press/benches/1504280937/apps/erpnext/erpnext/manufacturing/doctype/production_order/production_order.py”, line 216, in make_time_logs
self.check_operation_fits_in_working_hours(d)
File “/home/frappe/press/benches/1504280937/apps/erpnext/erpnext/manufacturing/doctype/production_order/production_order.py”, line 279, in check_operation_fits_in_working_hours
check_if_within_operating_hours(d.workstation, d.operation, d.planned_start_time, d.planned_end_time)
File “/home/frappe/press/benches/1504280937/apps/erpnext/erpnext/manufacturing/doctype/workstation/workstation.py”, line 56, in check_if_within_operating_hours
is_within_operating_hours(workstation, operation, from_datetime, to_datetime)
File “/home/frappe/press/benches/1504280937/apps/erpnext/erpnext/manufacturing/doctype/workstation/workstation.py”, line 63, in is_within_operating_hours
slot_length = (get_datetime(working_hour.end_time) - get_datetime(working_hour.start_time)).total_seconds()
TypeError: unsupported operand type(s) for -: ‘datetime.timedelta’ and ‘datetime.datetime’

Traceback (innermost last):
File “/home/frappe/press/benches/1504280937/apps/frappe/frappe/app.py”, line 51, in application
response = frappe.handler.handle()
File “/home/frappe/press/benches/1504280937/apps/frappe/frappe/handler.py”, line 62, in handle
execute_cmd(cmd)
File “/home/frappe/press/benches/1504280937/apps/frappe/frappe/handler.py”, line 85, in execute_cmd
ret = frappe.call(method, **frappe.form_dict)
File “/home/frappe/press/benches/1504280937/apps/frappe/frappe/init.py”, line 734, in call
return fn(*args, **newargs)
File “/home/frappe/press/benches/1504280937/apps/frappe/frappe/desk/form/save.py”, line 18, in savedocs
doc.save()
File “/home/frappe/press/benches/1504280937/apps/frappe/frappe/model/document.py”, line 238, in save
self.run_post_save_methods()
File “/home/frappe/press/benches/1504280937/apps/frappe/frappe/model/document.py”, line 563, in run_post_save_methods
self.run_method(“on_submit”)
File “/home/frappe/press/benches/1504280937/apps/frappe/frappe/model/document.py”, line 508, in run_method
return Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/press/benches/1504280937/apps/frappe/frappe/model/document.py”, line 621, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/press/benches/1504280937/apps/frappe/frappe/model/document.py”, line 604, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/press/benches/1504280937/apps/frappe/frappe/model/document.py”, line 502, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/press/benches/1504280937/apps/erpnext/erpnext/manufacturing/doctype/production_order/production_order.py”, line 146, in on_submit
self.make_time_logs()
File “/home/frappe/press/benches/1504280937/apps/erpnext/erpnext/manufacturing/doctype/production_order/production_order.py”, line 216, in make_time_logs
self.check_operation_fits_in_working_hours(d)
File “/home/frappe/press/benches/1504280937/apps/erpnext/erpnext/manufacturing/doctype/production_order/production_order.py”, line 279, in check_operation_fits_in_working_hours
check_if_within_operating_hours(d.workstation, d.operation, d.planned_start_time, d.planned_end_time)
File “/home/frappe/press/benches/1504280937/apps/erpnext/erpnext/manufacturing/doctype/workstation/workstation.py”, line 56, in check_if_within_operating_hours
is_within_operating_hours(workstation, operation, from_datetime, to_datetime)
File “/home/frappe/press/benches/1504280937/apps/erpnext/erpnext/manufacturing/doctype/workstation/workstation.py”, line 63, in is_within_operating_hours
slot_length = (get_datetime(working_hour.end_time) - get_datetime(working_hour.start_time)).total_seconds()
TypeError: unsupported operand type(s) for -: ‘datetime.timedelta’ and ‘datetime.datetime’

Can anyone please tell me how to fix this or what I am doing wrong?

Please help.

Hello,

I was unable to replicate the issue. Production Order worked fine in my case. Can you please give me some more details on what values you entered. Especially the Working Hours section in the Workstation associated with the Production Order Operation.

I fixed it. The issue was the working hours on all the workstations were set to start at 00:00:00. When I changed it to 00:00:01 it worked and went through. This might be a bug that is worth fixing though.

Tried the same with all workstations set to 00:00:00 yet could not replicate.
system gives you error stating break down the operation into multiple operations which is an expected behaviour.

Do let us know if it gives you an error again.