in a custom report’s print format .this {{ frappe.get_all (“Bank Account”, filters={‘bank’:bank}, “bank_account_no”) }} is fetching correctly but showing [object object] in the html template. how to achieve this ?
i have also tried with js function and it is showing same output
{% var bank = filters.bank_name; %}
our Bank Account No.: <strong>
{{ frappe.get_all ("Bank Account", filters={'bank':bank}, "bank_account_no") }}
</strong>
in the name of maintained with your bank.</p>
@Usama_Naveed something like this ? it is printing correctly but for some reason it is not showing up empty in my html template ? i have used filters.bank_name which is a filter in the report it showed up correctly
def execute(filters=None):
if not filters:
filters = {}
# Default to the current month and year if not provided
if not filters.get("month"):
filters["month"] = datetime.datetime.now().month
if not filters.get("year"):
filters["year"] = datetime.datetime.now().year
if filters.get("bank_name"):
name_of_bank = filters.get('bank_name')
bank_account_no = frappe.db.get_value("Bank Account", {"bank": name_of_bank}, "bank_account_no")
if bank_account_no:
filters["bank_account"] = bank_account_no
print('>>>>>>>>>>>>>>>>>>.11')
print(filters["bank_account"])
else:
filters["bank_account"] = "N/A" # Handle missing bank account case
else:
filters["bank_account"] = "N/A"
columns = get_columns()
data = get_data(filters)
return columns, data