From abe691c03d833e9d2ed230daf2640da040b1be1e Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sat, 6 May 2023 10:40:41 +0530 Subject: [PATCH] fix: child acc will inherit acc currency if explicitly specified --- erpnext/accounts/doctype/account/account.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/account/account.py b/erpnext/accounts/doctype/account/account.py index 0404d1c677..e94b7cf4c2 100644 --- a/erpnext/accounts/doctype/account/account.py +++ b/erpnext/accounts/doctype/account/account.py @@ -204,8 +204,11 @@ class Account(NestedSet): ) def validate_account_currency(self): + self.currency_explicitly_specified = True + if not self.account_currency: self.account_currency = frappe.get_cached_value("Company", self.company, "default_currency") + self.currency_explicitly_specified = False gl_currency = frappe.db.get_value("GL Entry", {"account": self.name}, "account_currency") @@ -251,8 +254,10 @@ class Account(NestedSet): { "company": company, # parent account's currency should be passed down to child account's curreny - # if it is None, it picks it up from default company currency, which might be unintended - "account_currency": erpnext.get_company_currency(company), + # if currency explicitly specified by user, child will inherit. else, default currency will be used. + "account_currency": self.account_currency + if self.currency_explicitly_specified + else erpnext.get_company_currency(company), "parent_account": parent_acc_name_map[company], } )