Error while viewing Profit and Loss Statement filtered by Project

Hi, I have tried to view Profit & Loss Statement with Project, and it showed Error:

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 55, in application
response = frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 20, in handle
data = execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 55, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1007, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 489, in wrapper_fn
retval = fn(*args, **get_newargs(fn, kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/query_report.py”, line 174, in run
result = generate_report_result(report, filters, user)
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/query_report.py”, line 65, in generate_report_result
res = frappe.get_attr(method_name)(frappe._dict(filters))
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py”, line 16, in execute
ignore_closing_entries=True, ignore_accumulated_values_for_fy= True)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/report/financial_statements.py”, line 148, in get_data
gl_entries_by_account, ignore_closing_entries=ignore_closing_entries
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/report/financial_statements.py”, line 342, in set_gl_entries_by_account
additional_conditions = get_additional_conditions(from_date, ignore_closing_entries, filters)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/report/financial_statements.py”, line 385, in get_additional_conditions
filters.project = [d.strip() for d in projects.strip().split(‘,’) if d]
TypeError: a bytes-like object is required, not ‘str’

Does anyone have the similar problem and how to fix it? Thank you

Hi,

I get a similar error. has anybody figured out the reason for this error please?

Thank you.

@Max3 @minhtran
Hi
Have you get solution on it. I had same error. If you got solution please let me know.
Thank you

Solved this error

Edit below line

projects = frappe.safe_encode(filters.get(“project”))

from "apps/erpnext/erpnext/accounts/report/financial_statements.py” to

projects = filters.get(“project”)

1 Like

Hi,

For some reason, I am not able to find the “projects = frappe.safe_encode(filters.get(“project”)) " line within the 'financial_statements.py” file.

I’m also having the same problem permission problem with this report
apps/erpnext/erpnext/stock/report/stock_ageing/stock_ageing.py. I need to stop the non-accounts users from adding the Last purchase price as a column to the stock ageing report.

I’m on V13.13.0.

Any help is really appreciated. Thanks.