Closed muchai closed 2 years ago
@muchai versions which are affected?
ERPNext: v13.14.1 (version-13)
Tested on the said version on FC. Wasn't able to reproduce.
eg:
Am I missing any filter that may cause the error? Else we'll need to close the issue.
You're right. Just tested on another site, and it works well. Let me check for any data issues in the site with the error. Albeit, the site with error, is till in version ERPNext: v13.14.1 (version-13)
Not sure, will look it more keenly. Thing is, it's a multi-company environment. In one company, the report displays correctly. In one, it returns the error above. The companies share items.
This issue has been automatically marked as inactive because it has not had recent activity and it wasn't validated by maintainer team. It will be closed within a week if no further activity occurs.
@muchai I am guessing this is a case of bad data or a rename gone wrong.
This fetches all item_codes so it's very weird if it doesn't find it i.e. None
is returned.
One way to figure out would be to run this query (doable from "System Console" also):
frappe.db.sql("""SELECT
so_item.item_code, so_item.parent as sales_order
FROM
`tabSales Order Item` so_item
LEFT JOIN
`tabItem` ti on so_item.item_code = ti.item_code
WHERE
COALESCE(ti.item_code, '') = ''""")
e.g. I faked data corruption by changing item_code in database
Leaving this issue closed since it's more about data than a bug.
@ankush Thanks for the query. Will test it. Currently merging (via open balances) these two companies, into one.
Traceback (most recent call last): File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 68, 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 31, in handle data = execute_cmd(cmd) File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 67, in execute_cmd return frappe.call(method, frappe.form_dict) File "/home/frappe/frappe-bench/apps/frappe/frappe/init.py", line 1207, in call return fn(*args, *newargs) File "/home/frappe/frappe-bench/apps/frappe/frappe/init.py", line 623, in wrapper_fn retval = fn(args, get_newargs(fn, kwargs)) File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/query_report.py", line 236, in run result = generate_report_result(report, filters, user, custom_columns) File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/query_report.py", line 78, in generate_report_result res = report.execute_script_report(filters) File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/report/report.py", line 125, in execute_script_report res = self.execute_module(filters) File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/report/report.py", line 142, in execute_module return frappe.get_attr(method_name)(frappe._dict(filters)) File "/home/frappe/frappe-bench/apps/erpnext/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.py", line 18, in execute data = get_data(filters) File "/home/frappe/frappe-bench/apps/erpnext/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.py", line 161, in get_data "item_name": item_record.item_name, AttributeError: 'NoneType' object has no attribute 'item_name'