feat: show account group on account reconciliation form

This commit is contained in:
Herculino Trotta
2024-10-20 11:55:52 -03:00
parent 1909184d55
commit b77e48ef42
3 changed files with 4 additions and 2 deletions

View File

@@ -122,6 +122,7 @@ class AccountBalanceForm(forms.Form):
self.currency_prefix = self.initial.get("prefix", "")
self.currency_decimal_places = self.initial.get("decimal_places", 2)
self.account_name = self.initial.get("account_name", "")
self.account_group = self.initial.get("account_group", None)
self.current_balance = self.initial.get("current_balance", 0)
self.helper = FormHelper()

View File

@@ -31,13 +31,14 @@ def account_reconciliation(request):
initial_data = [
{
"account_id": account.id,
"account_group": account.group,
"account_name": account.name,
"decimal_places": account.currency.decimal_places,
"suffix": account.currency.suffix,
"prefix": account.currency.prefix,
"current_balance": get_account_balance(account),
}
for account in Account.objects.all().select_related("currency")
for account in Account.objects.all().select_related("currency", "group")
]
if request.method == "POST":

View File

@@ -16,7 +16,7 @@
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse"
data-bs-target="#flush-collapse-{{ forloop.counter0 }}" aria-expanded="false"
aria-controls="flush-collapseOne">
{{ form.account_name }}
{% if form.account_group %}<span class="badge !tw-bg-blue-300 !tw-text-blue-800 me-2">{{ form.account_group.name }}</span>{% endif %}{{ form.account_name }}
</button>
</h2>
<div id="flush-collapse-{{ forloop.counter0 }}" class="accordion-collapse collapse">