Skip to content

Commit

Permalink
fix: child acc will inherit acc currency if explicitly specified
Browse files Browse the repository at this point in the history
(cherry picked from commit abe691c)
  • Loading branch information
ruthra-kumar authored and mergify[bot] committed May 8, 2023
1 parent 1226f32 commit 72255fa
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions erpnext/accounts/doctype/account/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,11 @@ def validate_balance_must_be_debit_or_credit(self):
)

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")

Expand Down Expand Up @@ -248,8 +251,10 @@ def create_account_for_child_company(self, parent_acc_name_map, descendants, par
{
"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],
}
)
Expand Down

0 comments on commit 72255fa

Please sign in to comment.