I was trying to include some custom fields in Accounts → Main Reports → General Ledger and sort on them and then noticed that the report does not sort as instructed in the original function.
In general_ledger.py there is this function
def get_gl_entries(filters):
group_by_condition = “group by voucher_type, voucher_no, account, cost_center”
if filters.get(“group_by_voucher”) else “group by name”
gl_entries = frappe.db.sql(“”“select posting_date, account, party_type, party,
sum(ifnull(debit, 0)) as debit, sum(ifnull(credit, 0)) as credit,
voucher_type, voucher_no, cost_center, remarks, against, is_opening
fromtabGL Entry
where company=%(company)s {conditions}
{group_by_condition}
order by posting_date, account”“”
.format(conditions=get_conditions(filters), group_by_condition=group_by_condition),
filters, as_dict=1)
return gl_entries
Despite of “order by” part, when I look at my journals they are not sorted that way but (probably) by the time they were created.
Am I misunderstanding something or how can this be?
Thanks.