Chart of Account in version 11 is major barrier to upgrade for it

Hello;

The sorting problem for the chart of account in version 11 is the main barrier to upgrade for version 11.
This problem is appearing when we need to create the chart of account from .json file and not from .py file.

Below is the image for the Chart of Account at version 11 which is generated depending on .json file and the problem can be replicated by trying to french chart of account (as french chart of account will be generated from the file: ).

Can someone advise how this problem can be resolved if I need to modify the code?

Regards
Bilal

I see the problem and I admit the chart should sort by numbers.

In day to day usage I do not see any real problem. In fact how often do you actually access anything via the CoA tree? Most of transactions are done via some kind of Document (SINV, JE, PINV, …) where you only choose the right account from a drop down.

So, I would just live with a minor flaw for the time being and go on.

Have a look

+1 Agree, it must be sorted by account number, that is the point of account numbers

Thank you @lasalesi

It must be sorted by Account Number and then by account name if there is no account number.

@Helio_Jesus
Can you direct me where is the query that is used to order the chart of account?
And why this problem is appearing only if the chart of account was created from json file? Because if it is created from .py file, then the problem is not appearing!

Regards
Bilal

Sorry late reply but tahr fix should be under accounts… When time I’ll have a look but if you have v10 you can check the difference…
While the fix I linked was related to reports also with same issue…

fix for Trial_balance.py
def get_data(filters):
accounts = frappe.db.sql(""“select name, parent_account, account_name, root_type, report_type, lft, rgt
from tabAccount where company=%s order by account_name, lft”"", filters.company, as_dict=True)
company_currency = erpnext.get_company_currency(filters.company)

Hello;
I have created pull request to resolve this problem at this link:

Regards
Bilal

3 Likes