From 2bdb7483b43acd56f2ecae475f4c6fd26afde23f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 10 Jun 2008 12:19:46 +0200 Subject: [PATCH] Add error message for missing debit/credit account on payment journal for issue105 --- invoice.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/invoice.py b/invoice.py index 4273459b62..b354ed2a06 100644 --- a/invoice.py +++ b/invoice.py @@ -916,6 +916,9 @@ class Invoice(OSV): if invoice.account.id == journal.debit_account.id: raise ExceptORM('Error', 'Debit account on journal is ' \ 'the same than the invoice account!') + if not journal.debit_account: + raise ExceptORM('Error', 'The debit account on journal is ' \ + 'missing!') else: lines.append({ 'name': description, @@ -938,6 +941,9 @@ class Invoice(OSV): if invoice.account.id == journal.debit_account.id: raise ExceptORM('Error', 'Credit account on journal is ' \ 'the same than the invoice account!') + if not journal.credit_account: + raise ExceptORM('Error', 'The credit account on journal is ' \ + 'missing!') period_id = period_obj.find(cursor, user, date=date, context=context)