mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-25 22:21:31 +01:00
fix: child acc will inherit acc currency if explicitly specified
(cherry picked from commit abe691c03d)
This commit is contained in:
@@ -201,8 +201,11 @@ class Account(NestedSet):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def validate_account_currency(self):
|
def validate_account_currency(self):
|
||||||
|
self.currency_explicitly_specified = True
|
||||||
|
|
||||||
if not self.account_currency:
|
if not self.account_currency:
|
||||||
self.account_currency = frappe.get_cached_value("Company", self.company, "default_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")
|
gl_currency = frappe.db.get_value("GL Entry", {"account": self.name}, "account_currency")
|
||||||
|
|
||||||
@@ -248,8 +251,10 @@ class Account(NestedSet):
|
|||||||
{
|
{
|
||||||
"company": company,
|
"company": company,
|
||||||
# parent account's currency should be passed down to child account's curreny
|
# 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
|
# if currency explicitly specified by user, child will inherit. else, default currency will be used.
|
||||||
"account_currency": erpnext.get_company_currency(company),
|
"account_currency": self.account_currency
|
||||||
|
if self.currency_explicitly_specified
|
||||||
|
else erpnext.get_company_currency(company),
|
||||||
"parent_account": parent_acc_name_map[company],
|
"parent_account": parent_acc_name_map[company],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user