Reports in newly installed v12 are showing python errors

Hi all.

I have installed v12 on my VPS a months back, now we are realizing that reports are not working smoothly. Some basic reports works fine but when we apply filters or select check (like group by or showing only …), it popups error.

Following error popups when we open stock ageing report and click checkbox (Show warehouse wise stock).

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 60, in application
response = frappe.api.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/api.py”, line 55, in handle
return frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 21, in handle
data = execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 56, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1036, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 511, in wrapper_fn
retval = fn(*args, **get_newargs(fn, kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/query_report.py”, line 200, in run
result = generate_report_result(report, filters, user)
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/query_report.py”, line 75, in generate_report_result
res = frappe.get_attr(method_name)(frappe._dict(filters))
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/report/stock_ageing/stock_ageing.py”, line 18, in execute
fifo_queue = sorted(item_dict[“fifo_queue”], key=lambda x: x[1])
TypeError: unorderable types: NoneType() < NoneType()

Version details?