diff --git a/erpnext/edi/doctype/code_list/code_list.py b/erpnext/edi/doctype/code_list/code_list.py index e723157e7a0..b816f7dc3e7 100644 --- a/erpnext/edi/doctype/code_list/code_list.py +++ b/erpnext/edi/doctype/code_list/code_list.py @@ -116,7 +116,7 @@ def get_docnames_for(code_list: str, doctype: str, code: str) -> tuple[str]: & (CommonCode.code_list == code_list) ) .distinct() - .orderby(DynamicLink.idx) + .orderby(DynamicLink.link_name) ).run() return tuple(d[0] for d in docnames) if docnames else ()