Skip to content

Commit

Permalink
Merge pull request #133
Browse files Browse the repository at this point in the history
fix(transactions): transaction convert value doesn't take into account currency's exchange currency
  • Loading branch information
eitchtee authored Feb 3, 2025
2 parents 2f3207b + 80edf55 commit 996e0ee
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions app/apps/transactions/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,20 @@ def exchanged_amount(self):
"suffix": suffix,
"decimal_places": decimal_places,
}
elif self.account.currency.exchange_currency:
converted_amount, prefix, suffix, decimal_places = convert(
self.amount,
to_currency=self.account.currency.exchange_currency,
from_currency=self.account.currency,
date=self.date,
)
if converted_amount:
return {
"amount": converted_amount,
"prefix": prefix,
"suffix": suffix,
"decimal_places": decimal_places,
}

return None

Expand Down

0 comments on commit 996e0ee

Please sign in to comment.