Description of the issue
journal_entry.py’s self.set_against_account validation PREVENTS making a journal entry with thousands of items.
Context information (for bug reports)
lines 358 to 366 of erpnext/accounts/doctype/journal_entry/journal_entry.py file
def set_against_account(self): accounts_debited, accounts_credited = ,  for d in self.get("accounts"): if flt(d.debit > 0): accounts_debited.append(d.party or d.account) if flt(d.credit) > 0: accounts_credited.append(d.party or d.account) for d in self.get("accounts"): if flt(d.debit > 0): d.against_account = ", ".join(list(set(accounts_credited))) if flt(d.credit > 0): d.against_account = ", ".join(list(set(accounts_debited)))
While this looks like a a cute idea for providing info for every accounting entry, this is a SHOW STOPPER for an accounting entry (like opening balance, or closing entries, or other entries that require thousands of journal entry accounts in one entry).
Looking at the code above, you will realize that this UNNECESSARILY provides duplicate info for each entry, CONSUMES compute power, SLOWS DOWN processing, and in my case, stops me from making journal entries that require 2000 to 3000 journal entries. I commented out the code and the processing went so much faster.
I think it is better to DROP THIS set_against_accounts because it uncessary BLOATS the database, slows down processing, and prevents ENTERPRISE level accounting. Or maybe, it can be provided as an option where a checkbox in the settings will determine if this info is needed.