more changes

This commit is contained in:
Herculino Trotta
2024-10-13 12:10:50 -03:00
parent 1717d8a94e
commit d20897a28a
33 changed files with 1552 additions and 153 deletions

View File

@@ -119,18 +119,18 @@ class Transaction(models.Model):
def exchanged_amount(self):
if self.account.exchange_currency:
converted_amount = convert(
converted_amount, prefix, suffix, decimal_places = convert(
self.amount,
self.account.exchange_currency,
self.account.currency,
to_currency=self.account.exchange_currency,
from_currency=self.account.currency,
date=self.date,
)
if converted_amount:
return {
"amount": converted_amount,
"suffix": self.account.exchange_currency.suffix,
"prefix": self.account.exchange_currency.prefix,
"decimal_places": self.account.exchange_currency.decimal_places,
"prefix": prefix,
"suffix": suffix,
"decimal_places": decimal_places,
}
return None

View File

@@ -38,7 +38,7 @@ def transaction_add(request):
return HttpResponse(
status=204,
headers={"HX-Trigger": "transaction_updated, hide_offcanvas, toast"},
headers={"HX-Trigger": "updated, hide_offcanvas, toast"},
)
else:
form = TransactionForm(
@@ -69,7 +69,7 @@ def transaction_edit(request, transaction_id, **kwargs):
return HttpResponse(
status=204,
headers={"HX-Trigger": "transaction_updated, hide_offcanvas, toast"},
headers={"HX-Trigger": "updated, hide_offcanvas, toast"},
)
else:
form = TransactionForm(instance=transaction)
@@ -102,7 +102,7 @@ def transaction_delete(request, transaction_id, **kwargs):
return HttpResponse(
status=204,
headers={"HX-Trigger": "transaction_updated, toast"},
headers={"HX-Trigger": "updated, toast"},
)
@@ -127,7 +127,7 @@ def transactions_transfer(request):
messages.success(request, _("Transfer added successfully"))
return HttpResponse(
status=204,
headers={"HX-Trigger": "transaction_updated, toast, hide_offcanvas"},
headers={"HX-Trigger": "updated, toast, hide_offcanvas"},
)
else:
form = TransferForm(
@@ -175,7 +175,7 @@ class AddInstallmentPlanView(View):
return HttpResponse(
status=204,
headers={"HX-Trigger": "transaction_updated, hide_offcanvas, toast"},
headers={"HX-Trigger": "updated, hide_offcanvas, toast"},
)
return render(request, self.template_name, {"form": form})