Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Loosen account currency validation on groups #42774

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading