Skip to content

Commit

Permalink
handle expenses by others
Browse files Browse the repository at this point in the history
If I payed nothing on an expense, don't make a transaction from my real accounts, only from the balance account.
  • Loading branch information
Sha-yol committed Nov 11, 2024
1 parent 525d90c commit 4fb84d5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions strategies/sw_balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@ def create_transactions(self, exp: Expense, myshare: ExpenseUser, data: list[str
balance_txn['type'] = "withdrawal"
balance_txn['description'] = f"Balance transfer for: {paid_txn['description']}"
balance_txn = self._apply_transaction_amount(balance_txn, exp, -float(balance))

return [paid_txn, balance_txn]
txns = [paid_txn, balance_txn]
if float(paid_txn['amount']) == 0: # I payed nothing; only balance transaction is needed
txns = [balance_txn]
return txns

0 comments on commit 4fb84d5

Please sign in to comment.