mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-04 14:08:29 +00:00
Merge pull request #41086 from ruthra-kumar/prevent_multi_currency_advance_in_separate_party
fix: prevent foreign currency accounts as advance accounts.
This commit is contained in:
@@ -139,6 +139,7 @@ class Company(NestedSet):
|
||||
self.validate_abbr()
|
||||
self.validate_default_accounts()
|
||||
self.validate_currency()
|
||||
self.validate_advance_account_currency()
|
||||
self.validate_coa_input()
|
||||
self.validate_perpetual_inventory()
|
||||
self.validate_provisional_account_for_non_stock_items()
|
||||
@@ -191,6 +192,29 @@ class Company(NestedSet):
|
||||
).format(frappe.bold(account[0]))
|
||||
frappe.throw(error_message)
|
||||
|
||||
def validate_advance_account_currency(self):
|
||||
if (
|
||||
self.default_advance_received_account
|
||||
and frappe.get_cached_value("Account", self.default_advance_received_account, "account_currency")
|
||||
!= self.default_currency
|
||||
):
|
||||
frappe.throw(
|
||||
_("'{0}' should be in company currency {1}.").format(
|
||||
frappe.bold("Default Advance Received Account"), frappe.bold(self.default_currency)
|
||||
)
|
||||
)
|
||||
|
||||
if (
|
||||
self.default_advance_paid_account
|
||||
and frappe.get_cached_value("Account", self.default_advance_paid_account, "account_currency")
|
||||
!= self.default_currency
|
||||
):
|
||||
frappe.throw(
|
||||
_("'{0}' should be in company currency {1}.").format(
|
||||
frappe.bold("Default Advance Paid Account"), frappe.bold(self.default_currency)
|
||||
)
|
||||
)
|
||||
|
||||
def validate_currency(self):
|
||||
if self.is_new():
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user