diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 12db5753a1f3c114eaaaa333f30b4feb9604c5bb..436b2c3907883386f0c16f84317f0001c0d90b26 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -157,6 +157,20 @@ class JournalEntry(AccountsController): if not self.title: self.title = self.get_title() + def validate_advance_accounts(self): + journal_accounts = set([x.account for x in self.accounts]) + advance_accounts = set() + advance_accounts.add( + frappe.get_cached_value("Company", self.company, "default_advance_received_account") + ) + advance_accounts.add(frappe.get_cached_value("Company", self.company, "default_advance_paid_account")) + if advance_accounts_used := journal_accounts & advance_accounts: + frappe.msgprint( + _( + "Making Journal Entries against advance accounts: {0} is not recommended. These Journals won't be available for Reconciliation." + ).format(frappe.bold(comma_and(advance_accounts_used))) + ) + def validate_for_repost(self): validate_docs_for_voucher_types(["Journal Entry"]) validate_docs_for_deferred_accounting([self.name], []) @@ -444,7 +458,7 @@ class JournalEntry(AccountsController): self.voucher_type == "Depreciation Entry" and d.reference_type == "Asset" and d.reference_name - and d.account_type == "Depreciation" + and frappe.get_cached_value("Account", d.account, "root_type") == "Expense" and d.debit ): asset = frappe.get_doc("Asset", d.reference_name)