From b93c18bd4a0320a22fb03b9f41b92675ee246f19 Mon Sep 17 00:00:00 2001 From: Prateek <40106895+prateekkaramchandani@users.noreply.github.com> Date: Fri, 17 Feb 2023 20:25:13 +0530 Subject: [PATCH] fix: use max function to get default company address --- erpnext/setup/doctype/company/company.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index 07ee2890c46..fcdf245659b 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -808,7 +808,7 @@ def get_default_company_address(name, sort_key="is_primary_address", existing_ad return existing_address if out: - return min(out, key=lambda x: x[1])[0] # find min by sort_key + return max(out, key=lambda x: x[1])[0] # find max by sort_key else: return None