mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-03 12:19:12 +00:00
fix: Validation for journal entry with 0 debit and credit values
This commit is contained in:
@@ -34,6 +34,7 @@ class JournalEntry(AccountsController):
|
|||||||
self.validate_entries_for_advance()
|
self.validate_entries_for_advance()
|
||||||
self.validate_multi_currency()
|
self.validate_multi_currency()
|
||||||
self.set_amounts_in_company_currency()
|
self.set_amounts_in_company_currency()
|
||||||
|
self.validate_debit_credit_amount()
|
||||||
self.validate_total_debit_and_credit()
|
self.validate_total_debit_and_credit()
|
||||||
self.validate_against_jv()
|
self.validate_against_jv()
|
||||||
self.validate_reference_doc()
|
self.validate_reference_doc()
|
||||||
@@ -369,6 +370,11 @@ class JournalEntry(AccountsController):
|
|||||||
if flt(d.debit > 0): d.against_account = ", ".join(list(set(accounts_credited)))
|
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)))
|
if flt(d.credit > 0): d.against_account = ", ".join(list(set(accounts_debited)))
|
||||||
|
|
||||||
|
def validate_debit_credit_amount(self):
|
||||||
|
for d in self.get('accounts'):
|
||||||
|
if not flt(d.debit) and not flt(d.credit):
|
||||||
|
frappe.throw(_("Row {0}: Both Debit and Credit values cannot be zero").format(d.idx))
|
||||||
|
|
||||||
def validate_total_debit_and_credit(self):
|
def validate_total_debit_and_credit(self):
|
||||||
self.set_total_debit_credit()
|
self.set_total_debit_credit()
|
||||||
if self.difference:
|
if self.difference:
|
||||||
|
|||||||
Reference in New Issue
Block a user