AttributeError: 'unicode' object has no attribute 'group_or_ledger'


#1

This is the error message:
Traceback (innermost last):
File “/home/erpnext/frappe-bench/apps/frappe/frappe/app.py”, line 49, in application
response = frappe.handler.handle()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/handler.py”, line 66, in handle
execute_cmd(cmd)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/handler.py”, line 89, in execute_cmd
ret = frappe.call(method, **frappe.form_dict)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 531, in call
return fn(*args, **newargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/handler.py”, line 19, in runserverobj
frappe.widgets.form.run_method.runserverobj(method, docs=docs, dt=dt, dn=dn, arg=arg, args=args)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/widgets/form/run_method.py”, line 35, in runserverobj
r = doc.run_method(method)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 453, in run_method
return Document.hook(fn)(self, *args, **kwargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 534, in composer
return composed(self, method, *args, **kwargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 517, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 447, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/erpnext/frappe-bench/apps/erpnext/erpnext/accounts/doctype/budget_allocation/budget_allocation.py”, line 93, in get_Budget
if str(ai.group_or_ledger()) == “Ledger”:
AttributeError: ‘unicode’ object has no attribute ‘group_or_ledger’

This is my code:

if str(ai.group_or_ledger) == "Ledger":
					bgColor = """ bgcolor="#FF0000" """
					normal = """font-weight: normal;"""
				
				
				indent = 20
				html +="""<tr><td style='"""+normal+"""text-indent: """+str(flt(indent)*flt(ai.indent))+"""px;white-space: nowrap;'>"""+str(ai.account_name)+"""</td>"""
				html += """"""

Thank you! I’ve been doing this for how many days.


#2

@sjflores
can you please share your whole code and can you tell me what you’re trying to do here?

sincerely,
@theorangemonkey001