Skip to content

Commit fd037ad

Browse files
committed
handle expenses by others
If I payed nothing on an expense, don't make a transaction from my real accounts, only from the balance account.
1 parent b888b92 commit fd037ad

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

strategies/sw_balance.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,7 @@ def create_transactions(self, exp: Expense, myshare: ExpenseUser, data: list[str
2626
balance_txn['type'] = "withdrawal"
2727
balance_txn['description'] = f"Balance transfer for: {paid_txn['description']}"
2828
balance_txn = self._apply_transaction_amount(balance_txn, exp, -float(balance))
29-
30-
return [paid_txn, balance_txn]
29+
txns = [paid_txn, balance_txn]
30+
if float(paid_txn['amount']) == 0: # I payed nothing; only balance transaction is needed
31+
txns = [balance_txn]
32+
return txns

0 commit comments

Comments
 (0)