When i try to generate account receivable report using api its return data but when i pass filter party_type = ‘Customer’ and party = party_name is return error.
My Code
def get_receivable_report_content(name):
filters = {‘company’: ‘My Private Limited’, ‘ageing_based_on’: ‘Due Date’, ‘range1’: ‘30’, ‘range2’: ‘60’, ‘range3’: ‘90’, ‘range4’: ‘120’, ‘party_type’: ‘Customer’, ‘party’: ‘India-02’}
“”“Returns file in for the report in given format”“”
report = frappe.get_doc("Report", "Accounts Receivable")
filters = frappe.parse_json(filters) if filters else {}
columns, data = report.get_data(
limit= 100,
user= frappe.session.user,
filters= filters,
as_dict=True,
ignore_prepared_report=True,
are_default_filters=False,
)
Error
Traceback (most recent call last):
File “apps/frappe/frappe/app.py”, line 95, in application
response = frappe.api.handle()
File “apps/frappe/frappe/api.py”, line 54, in handle
return frappe.handler.handle()
File “apps/frappe/frappe/handler.py”, line 47, in handle
data = execute_cmd(cmd)
File “apps/frappe/frappe/handler.py”, line 85, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “apps/frappe/frappe/init.py”, line 1622, in call
return fn(*args, **newargs)
File “apps/vijay_whatsapp/vijay_whatsapp/report.py”, line 15, in get_receivable_report_content
columns, data = report.get_data(
File “apps/frappe/frappe/core/doctype/report/report.py”, line 169, in get_data
columns, result = self.run_query_report(
File “apps/frappe/frappe/core/doctype/report/report.py”, line 184, in run_query_report
data = frappe.desk.query_report.run(
File “apps/frappe/frappe/init.py”, line 802, in wrapper_fn
retval = fn(*args, **get_newargs(fn, kwargs))
File “apps/frappe/frappe/desk/query_report.py”, line 239, in run
result = generate_report_result(report, filters, user, custom_columns, is_tree, parent_field)
File “apps/frappe/frappe/init.py”, line 802, in wrapper_fn
retval = fn(*args, **get_newargs(fn, kwargs))
File “apps/frappe/frappe/desk/query_report.py”, line 89, in generate_report_result
res = get_report_result(report, filters) or []
File “apps/frappe/frappe/desk/query_report.py”, line 70, in get_report_result
res = report.execute_script_report(filters)
File “apps/frappe/frappe/core/doctype/report/report.py”, line 131, in execute_script_report
res = self.execute_module(filters)
File “apps/frappe/frappe/core/doctype/report/report.py”, line 148, in execute_module
return frappe.get_attr(method_name)(frappe.dict(filters))
File “apps/erpnext/erpnext/accounts/report/accounts_receivable/accounts_receivable.py”, line 40, in execute
return ReceivablePayableReport(filters).run(args)
File “apps/erpnext/erpnext/accounts/report/accounts_receivable/accounts_receivable.py”, line 62, in run
self.get_data()
File “apps/erpnext/erpnext/accounts/report/accounts_receivable/accounts_receivable.py”, line 88, in get_data
self.get_ple_entries()
File “apps/erpnext/erpnext/accounts/report/accounts_receivable/accounts_receivable.py”, line 737, in get_ple_entries
.where(Criterion.all(self.qb_selection_filter))
File “env/lib/python3.10/site-packages/pypika/utils.py”, line 50, in copy
result = func(self_copy, args, *kwargs)
File “env/lib/python3.10/site-packages/pypika/queries.py”, line 930, in where
if not self.validate_table(criterion):
File “env/lib/python3.10/site-packages/pypika/queries.py”, line 1155, in validate_table
for field in term.fields():
File “env/lib/python3.10/site-packages/pypika/terms.py”, line 57, in fields
return set(self.find(Field))
File “env/lib/python3.10/site-packages/pypika/terms.py”, line 37, in find
return [node for node in self.nodes_() if isinstance(node, type)]
File “env/lib/python3.10/site-packages/pypika/terms.py”, line 37, in
return [node for node in self.nodes_() if isinstance(node, type)]
File “env/lib/python3.10/site-packages/pypika/terms.py”, line 743, in nodes_
yield from self.left.nodes_()
File “env/lib/python3.10/site-packages/pypika/terms.py”, line 743, in nodes_
yield from self.left.nodes_()
File “env/lib/python3.10/site-packages/pypika/terms.py”, line 742, in nodes_
yield from self.right.nodes_()
File “env/lib/python3.10/site-packages/pypika/terms.py”, line 795, in nodes_
yield from self.container.nodes_()
AttributeError: ‘str’ object has no attribute ‘nodes_’