Fix posting of unreconciled StatementLines to ledger

This commit is contained in:
RunasSudo 2023-01-04 18:37:26 +11:00
parent 13123deebe
commit e3900589e6
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

View File

@ -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'