Job Card exception: Row 1: From time must be less than to time

Hello!

I have a problem at job cards section. When i want to start the job, i get this error: Row 1: From time must be less than to time. But my Time log is empty. How can i solve this bug? I use ERPNext: v12.10.1 (version-12) and Frappe Framework: v12.8.4 (version-12). It is possible to be already solved in a newer version?

EDIT_1:
Here is an image with the error:

This appear when i press the start button. Mean while the time log is empty:

And the error log in console is:

Traceback (most recent call last):
  File "/home/bench/erpnext/apps/frappe/frappe/desk/form/save.py", line 22, in savedocs
    doc.save()
  File "/home/bench/erpnext/apps/frappe/frappe/model/document.py", line 273, in save
    return self._save(*args, **kwargs)
  File "/home/bench/erpnext/apps/frappe/frappe/model/document.py", line 309, in _save
    self.run_before_save_methods()
  File "/home/bench/erpnext/apps/frappe/frappe/model/document.py", line 896, in run_before_save_methods
    self.run_method("validate")
  File "/home/bench/erpnext/apps/frappe/frappe/model/document.py", line 797, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/bench/erpnext/apps/frappe/frappe/model/document.py", line 1071, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/bench/erpnext/apps/frappe/frappe/model/document.py", line 1054, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/bench/erpnext/apps/frappe/frappe/model/document.py", line 791, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/bench/erpnext/apps/erpnext/erpnext/manufacturing/doctype/job_card/job_card.py", line 14, in validate
    self.validate_time_logs()
  File "/home/bench/erpnext/apps/erpnext/erpnext/manufacturing/doctype/job_card/job_card.py", line 24, in validate_time_logs
    frappe.throw(_("Row {0}: From time must be less than to time").format(d.idx))
  File "/home/bench/erpnext/apps/frappe/frappe/__init__.py", line 376, in throw
    msgprint(msg, raise_exception=exc, title=title, indicator='red', is_minimizable=is_minimizable)
  File "/home/bench/erpnext/apps/frappe/frappe/__init__.py", line 355, in msgprint
    _raise_exception()
  File "/home/bench/erpnext/apps/frappe/frappe/__init__.py", line 315, in _raise_exception
    raise raise_exception(msg)
frappe.exceptions.ValidationError: Row 1: From time must be less than to time

request.js:355 Traceback (most recent call last):
  File "/home/bench/erpnext/apps/frappe/frappe/app.py", line 64, in application
    response = frappe.api.handle()
  File "/home/bench/erpnext/apps/frappe/frappe/api.py", line 59, in handle
    return frappe.handler.handle()
  File "/home/bench/erpnext/apps/frappe/frappe/handler.py", line 24, in handle
    data = execute_cmd(cmd)
  File "/home/bench/erpnext/apps/frappe/frappe/handler.py", line 63, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "/home/bench/erpnext/apps/frappe/frappe/__init__.py", line 1054, in call
    return fn(*args, **newargs)
  File "/home/bench/erpnext/apps/frappe/frappe/desk/form/save.py", line 22, in savedocs
    doc.save()
  File "/home/bench/erpnext/apps/frappe/frappe/model/document.py", line 273, in save
    return self._save(*args, **kwargs)
  File "/home/bench/erpnext/apps/frappe/frappe/model/document.py", line 309, in _save
    self.run_before_save_methods()
  File "/home/bench/erpnext/apps/frappe/frappe/model/document.py", line 896, in run_before_save_methods
    self.run_method("validate")
  File "/home/bench/erpnext/apps/frappe/frappe/model/document.py", line 797, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/bench/erpnext/apps/frappe/frappe/model/document.py", line 1071, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/bench/erpnext/apps/frappe/frappe/model/document.py", line 1054, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/bench/erpnext/apps/frappe/frappe/model/document.py", line 791, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/bench/erpnext/apps/erpnext/erpnext/manufacturing/doctype/job_card/job_card.py", line 14, in validate
    self.validate_time_logs()
  File "/home/bench/erpnext/apps/erpnext/erpnext/manufacturing/doctype/job_card/job_card.py", line 24, in validate_time_logs
    frappe.throw(_("Row {0}: From time must be less than to time").format(d.idx))
  File "/home/bench/erpnext/apps/frappe/frappe/__init__.py", line 376, in throw
    msgprint(msg, raise_exception=exc, title=title, indicator='red', is_minimizable=is_minimizable)
  File "/home/bench/erpnext/apps/frappe/frappe/__init__.py", line 355, in msgprint
    _raise_exception()
  File "/home/bench/erpnext/apps/frappe/frappe/__init__.py", line 315, in _raise_exception
    raise raise_exception(msg)
frappe.exceptions.ValidationError: Row 1: From time must be less than to time

I don’t know if it is relevant but i also have this 404 error:

DevTools failed to load SourceMap: Could not load content for http://<mydomain>/assets/js/awesomplete.min.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE

Hello,

Can you send a screenshot of the time log table of your job card? Also, when are you getting this error exactly? I checked in the exact same version and could not replicate the issue.

I updated the question

Any news here? I tryed to deploy with docker, but i have the same problem … I saw that it is al old issue. See here.

Any update? Because I had the sampe problem here…

Hi,

Could you send us a GIF so that we follow the exact steps to replicate the issue? Could not replicate the issue in my test instance.

Here’s the screenshot
Before i clicked start job, clicked start at the first time, second time, and lastly when i click add row.

You have to specify the time taking for the job execution in the Time Log section and quantity executed for you to be able to submit job card

If you see your last screenshot, the “To Time” column is empty. You need to mention the “To Time” too. The collective “Completed Qty” of all the rows should be equal to the Qty to Manufacture as set in the Work Order.

Could you fill in the time log table in the Job Card and submit and let us know if the issue persists?

This issue has been identified and I was told fix will be released shortly.

is the fix already available?
where please let me know.

Having the same problem here on v13.7

Same problem v13.8

I fixed in erpnext source code, changing line 47 below:

- if get_datetime(d.from_time) > get_datetime(d.to_time):
+ if d.from_time and d.to_time and get_datetime(d.from_time) > get_datetime(d.to_time):

1 Like

Yeay it works thanks!

I got the same issue again in the latest version (hosted on Frappe Cloud). I cross-checked the source code; seems like this fix is not yet published. Have you created a PR?

Got the same issue on version v13.19.0