Skip to content

Commit

Permalink
fix: advance account validation in company master
Browse files Browse the repository at this point in the history
(cherry picked from commit 1ad065f)
  • Loading branch information
ruthra-kumar authored and mergify[bot] committed Apr 23, 2024
1 parent fb4a75c commit dd67b0e
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions erpnext/setup/doctype/company/company.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def validate(self):
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()
Expand Down Expand Up @@ -192,6 +193,29 @@ def validate_default_accounts(self):
).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
Expand Down

0 comments on commit dd67b0e

Please sign in to comment.