From 934d63de16c49cc95b8e9366d2b7a7e2f6dd87db Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Wed, 11 Feb 2015 16:12:47 +0530 Subject: [PATCH 1/2] journal entry - accounts table cannot be blank - validation added --- erpnext/accounts/doctype/journal_entry/journal_entry.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 9930d8d38b..ca7e993d54 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -39,6 +39,7 @@ class JournalEntry(AccountsController): self.check_credit_days() self.validate_expense_claim() self.validate_credit_debit_note() + self.validate_accounts() def on_submit(self): self.check_credit_limit() @@ -450,6 +451,10 @@ class JournalEntry(AccountsController): }) if count: frappe.throw(_("{0} already made against stock entry {1}".format(self.voucher_type, self.stock_entry))) + + def validate_accounts(self): + if not self.accounts: + frappe.throw("Accounts table cannot be blank.") @frappe.whitelist() def get_default_bank_cash_account(company, voucher_type, mode_of_payment=None): From 802d717a9eaa215f3feba2578018495473c90c86 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Wed, 11 Feb 2015 17:27:58 +0530 Subject: [PATCH 2/2] fixes --- erpnext/accounts/doctype/journal_entry/journal_entry.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index ca7e993d54..05f2e5953a 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -39,7 +39,7 @@ class JournalEntry(AccountsController): self.check_credit_days() self.validate_expense_claim() self.validate_credit_debit_note() - self.validate_accounts() + self.validate_empty_accounts_table() def on_submit(self): self.check_credit_limit() @@ -452,8 +452,8 @@ class JournalEntry(AccountsController): if count: frappe.throw(_("{0} already made against stock entry {1}".format(self.voucher_type, self.stock_entry))) - def validate_accounts(self): - if not self.accounts: + def validate_empty_accounts_table(self): + if not self.get('accounts'): frappe.throw("Accounts table cannot be blank.") @frappe.whitelist()