Please Help me System down

Error While updating Please help me the system is down

Executing erpnext.patches.v9_0.set_schedule_date_for_material_request_and_purchase_order in (8d46e6cf4d0aa64e)
Traceback (most recent call last):
File “/usr/lib/python2.7/”, line 162, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib/python2.7/”, line 72, in _run_code
exec code in run_globals
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/”, line 94, in
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/”, line 18, in main
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/”, line 722, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/”, line 697, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/”, line 217, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 31, in migrate
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/”, line 29, in run_all
if not run_single(patchmodule = patch):
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/”, line 63, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/”, line 83, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/patches/v9_0/”, line 20, in execute
min_schedule_date = min([d.schedule_date for d in doc.items])
TypeError: can’t compare to NoneType

Hello @Mahmoud_Ghoneem,

Please check below condition.
min_schedule_date = min([d.schedule_date for d in doc.items])

In above condition, you compared doc items with schedule_date in that condition some values are getting None.
For Example :
from datetime import datetime
min_dt = min([None,]) OR
min_dt = min([, None])

it will gives error
TypeError: can’t compare to NoneType
because can’t compare to NoneType.

Trace That Condition.

i cant access the system coz its updating and cant update till patch can be run

the patch is

Executing erpnext.patches.v9_0.set_schedule_date_for_material_request_and_purchase_order in (8d46e6cf4d0aa64e)

So Sorry for repost

Please help my entire company is down now ??

So sorry for this. I’m looking into this now. In the meantime, please open an issue about this on github

Hi @Mahmoud_Ghoneem
The fix to this problem has been merged but not yet live. If you are a tech guy, here is the PR - [fix] check for null date fields by saurabh6790 · Pull Request #11334 · frappe/erpnext · GitHub. You can pull it from hotfix.

We have released the fix, please update again.

Thanks you @tundebabzy @nabinhait

it works