Fixed the fill_txn_from_post() utility so that it works on new transactions without any record in the accounting application.
This commit is contained in:
parent
65bfdf3a88
commit
b6f5bbaf9e
@ -407,9 +407,15 @@ def fill_txn_from_post(txn_type, txn, post):
|
||||
records.append(record)
|
||||
if txn_type != "transfer":
|
||||
if txn_type == "expense":
|
||||
if len(txn.credit_records) > 0:
|
||||
record = txn.credit_records[0]
|
||||
else:
|
||||
record = Record(is_credit=True, transaction=txn)
|
||||
else:
|
||||
if len(txn.debit_records) > 0:
|
||||
record = txn.debit_records[0]
|
||||
else:
|
||||
record = Record(is_credit=False, transaction=txn)
|
||||
record.ord = 1
|
||||
record.account = Account.objects.get(code=Account.CASH)
|
||||
record.summary = None
|
||||
|
Loading…
Reference in New Issue
Block a user