From c7a97cfb314d97904b5ec1911537e83866cc1fa4 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 17 Jul 2023 11:35:32 +0530 Subject: [PATCH] chore: add validation for account type of party type and account (#36141) chore: add validation for account type of party type and account (#36141) chore: add validation to check if account type of party type and account match (cherry picked from commit 305c37917ffe7188c9270f8f5ca8b37301990889) Co-authored-by: Anand Baburajan --- erpnext/accounts/doctype/journal_entry/journal_entry.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 0411fd1104e..594339591f5 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -396,6 +396,15 @@ class JournalEntry(AccountsController): d.idx, d.account ) ) + elif ( + d.party_type + and frappe.db.get_value("Party Type", d.party_type, "account_type") != account_type + ): + frappe.throw( + _("Row {0}: Account {1} and Party Type {2} have different account types").format( + d.idx, d.account, d.party_type + ) + ) def check_credit_limit(self): customers = list(