How to add data in loop columns
def get_column():
departments = frappe.db.get_list('Department', pluck="name")
cols = [
{
'fieldname': 'account',
'label': _('Account'),
'fieldtype': 'Link',
'options': 'Account',
'width': 350,
},
{
'fieldname': 'total',
'label': _('Total'),
'options': 'Currency',
'width': 200,
},
]
for i, department in enumerate(departments):
cols.append(
{
'fieldname': f'department_{i}',
'label': _(department),
'fieldtype': 'Data',
'width': 120,
},
)
return cols