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/”, line 60, in application
response = frappe.api.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 55, in handle
return frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 21, in handle
data = execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 56, in execute_cmd
return, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 1036, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 511, in wrapper_fn
retval = fn(*args, **get_newargs(fn, kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/”, line 200, in run
result = generate_report_result(report, filters, user)
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/”, 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/”, line 18, in execute
fifo_queue = sorted(item_dict[“fifo_queue”], key=lambda x: x[1])
TypeError: unorderable types: NoneType() < NoneType()

Version details?