Skip to content

Commit

Permalink
Merge pull request #42774 from ruthra-kumar/loosen_account_currency_v…
Browse files Browse the repository at this point in the history
…alidation_on_groups

refactor: Loosen account currency validation on groups
  • Loading branch information
ruthra-kumar authored Aug 16, 2024
2 parents 5011b76 + 164498b commit c1a5a05
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 32 deletions.
16 changes: 0 additions & 16 deletions erpnext/setup/doctype/customer_group/customer_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def validate(self):

def validate_currency_for_receivable_and_advance_account(self):
for x in self.accounts:
company_default_currency = frappe.get_cached_value("Company", x.company, "default_currency")
receivable_account_currency = None
advance_account_currency = None

Expand All @@ -56,21 +55,6 @@ def validate_currency_for_receivable_and_advance_account(self):
"Account", x.advance_account, "account_currency"
)

if receivable_account_currency and receivable_account_currency != company_default_currency:
frappe.throw(
_("Receivable Account: {0} must be in Company default currency: {1}").format(
frappe.bold(x.account),
frappe.bold(company_default_currency),
)
)

if advance_account_currency and advance_account_currency != company_default_currency:
frappe.throw(
_("Advance Account: {0} must be in Company default currency: {1}").format(
frappe.bold(x.advance_account), frappe.bold(company_default_currency)
)
)

if (
receivable_account_currency
and advance_account_currency
Expand Down
16 changes: 0 additions & 16 deletions erpnext/setup/doctype/supplier_group/supplier_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def validate(self):

def validate_currency_for_payable_and_advance_account(self):
for x in self.accounts:
company_default_currency = frappe.get_cached_value("Company", x.company, "default_currency")
payable_account_currency = None
advance_account_currency = None

Expand All @@ -49,21 +48,6 @@ def validate_currency_for_payable_and_advance_account(self):
"Account", x.advance_account, "account_currency"
)

if payable_account_currency and payable_account_currency != company_default_currency:
frappe.throw(
_("Payable Account: {0} must be in Company default currency: {1}").format(
frappe.bold(x.account),
frappe.bold(company_default_currency),
)
)

if advance_account_currency and advance_account_currency != company_default_currency:
frappe.throw(
_("Advance Account: {0} must be in Company default currency: {1}").format(
frappe.bold(x.advance_account), frappe.bold(company_default_currency)
)
)

if (
payable_account_currency
and advance_account_currency
Expand Down

0 comments on commit c1a5a05

Please sign in to comment.