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 erp.riadco.com.eg (8d46e6cf4d0aa64e)
Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 162, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 94, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, 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/core.py”, 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/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 217, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 31, in migrate
frappe.modules.patch_handler.run_all()
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 29, in run_all
if not run_single(patchmodule = patch):
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 63, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 83, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/patches/v9_0/set_schedule_date_for_material_request_and_purchase_order.py”, line 20, in execute
min_schedule_date = min([d.schedule_date for d in doc.items])
TypeError: can’t compare datetime.date 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, datetime.now().date()]) OR
min_dt = min()

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

Trace That Condition.
Thanks

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 erp.riadco.com.eg (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 - https://github.com/frappe/erpnext/pull/11334. You can pull it from hotfix.

We have released the fix, please update again.

Thanks you @tundebabzy @nabinhait

it works