From e3900589e6ead2513e68375d91dcf6c7dbebf7e0 Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Wed, 4 Jan 2023 18:37:26 +1100 Subject: [PATCH] Fix posting of unreconciled StatementLines to ledger --- drcr/statements/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drcr/statements/models.py b/drcr/statements/models.py index 06c8ccc..ef80972 100644 --- a/drcr/statements/models.py +++ b/drcr/statements/models.py @@ -35,9 +35,9 @@ class StatementLine(db.Model): return Amount(self.quantity, self.commodity) def into_transaction(self): - if len(self.reconciliations) > 0: + if self.reconciliation: # Will already be accounted for in a StatementLineTransaction - raise Exception('Should not call into_transaction on a StatementLine with associated StatementLinePosting') + raise Exception('Should not call into_transaction on a reconciled StatementLine') # Not classified unclassified_name = 'Unclassified Statement Line Debits' if -self.quantity >= 0 else 'Unclassified Statement Line Credits'