ordered the txns based on debit listed first
This commit is contained in:
parent
9d6bd24937
commit
8f5472ec52
@ -412,8 +412,8 @@ def transactions_table(object_type: Union[JournalEntryModel, BillModel, InvoiceM
|
|||||||
output_field=IntegerField()
|
output_field=IntegerField()
|
||||||
)
|
)
|
||||||
).order_by(
|
).order_by(
|
||||||
'timestamp', # Primary sort: chronological (oldest first)
|
'-timestamp', # Primary sort: chronological (oldest first)
|
||||||
'debit_credit_sort_order', # Secondary sort: Debits (0) before Credits (1)
|
'-debit_credit_sort_order', # Secondary sort: Debits (0) before Credits (1)
|
||||||
'pk' # Optional: Tie-breaker for consistent order
|
'pk' # Optional: Tie-breaker for consistent order
|
||||||
)
|
)
|
||||||
elif isinstance(object_type, InvoiceModel):
|
elif isinstance(object_type, InvoiceModel):
|
||||||
@ -529,4 +529,5 @@ def get_vehicle_type_name(car_serie):
|
|||||||
elif 'liftback' in serie_lower:
|
elif 'liftback' in serie_lower:
|
||||||
return 'liftback'
|
return 'liftback'
|
||||||
else:
|
else:
|
||||||
return 'sedan'
|
return 'sedan'
|
||||||
|
|
||||||
@ -67,6 +67,7 @@ from django.views.generic import (
|
|||||||
ArchiveIndexView,
|
ArchiveIndexView,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from django.db.models import Case, Value, IntegerField, When
|
||||||
|
|
||||||
# Django Ledger
|
# Django Ledger
|
||||||
from django_ledger.io import roles
|
from django_ledger.io import roles
|
||||||
@ -8123,6 +8124,7 @@ class JournalEntryListView(LoginRequiredMixin, ListView):
|
|||||||
model = JournalEntryModel
|
model = JournalEntryModel
|
||||||
context_object_name = "journal_entries"
|
context_object_name = "journal_entries"
|
||||||
template_name = "ledger/journal_entry/journal_entry_list.html"
|
template_name = "ledger/journal_entry/journal_entry_list.html"
|
||||||
|
ordering=['-timestamp']
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
qs = super().get_queryset()
|
qs = super().get_queryset()
|
||||||
@ -8229,11 +8231,17 @@ def JournalEntryTransactionsView(request, pk):
|
|||||||
:rtype: django.http.HttpResponse
|
:rtype: django.http.HttpResponse
|
||||||
"""
|
"""
|
||||||
journal = JournalEntryModel.objects.filter(pk=pk).first()
|
journal = JournalEntryModel.objects.filter(pk=pk).first()
|
||||||
transactions = (
|
# transactions = (
|
||||||
TransactionModel.objects.filter(journal_entry=journal)
|
# TransactionModel.objects.filter(journal_entry=journal)
|
||||||
.order_by("account__code")
|
# .order_by("account__code")
|
||||||
.all()
|
# .all()
|
||||||
)
|
# )
|
||||||
|
qs=TransactionModel.objects.filter(journal_entry=journal).all()
|
||||||
|
transactions=qs.annotate(
|
||||||
|
debit_credit_sort_order=Case(When(tx_type='debit',then=Value(0)),
|
||||||
|
When(tx_type='credit',then=Value(1)),
|
||||||
|
output_field=IntegerField())
|
||||||
|
).order_by('debit_credit_sort_order')
|
||||||
return render(
|
return render(
|
||||||
request,
|
request,
|
||||||
"ledger/journal_entry/journal_entry_transactions.html",
|
"ledger/journal_entry/journal_entry_transactions.html",
|
||||||
|
|||||||
@ -9,9 +9,9 @@
|
|||||||
<form action="" method="post">
|
<form action="" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<div class="col-12 col-xl-8">
|
<div class="col-12 col-xl-8">
|
||||||
<div class="border-bottom mb-4">
|
<div class=" mb-4">
|
||||||
|
|
||||||
<div class="row gx-3 mb-6 gy-6 gy-sm-3">
|
<div class="row gx-3 mb-4 gy-6 gy-sm-3">
|
||||||
<div class="col-12 col-sm-8">
|
<div class="col-12 col-sm-8">
|
||||||
<h4 class="mb-4">Default Invoice Accounts</h4>
|
<h4 class="mb-4">Default Invoice Accounts</h4>
|
||||||
<div class="form-icon-container mb-3">
|
<div class="form-icon-container mb-3">
|
||||||
@ -25,7 +25,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row gx-3 mb-6 gy-6 gy-sm-3">
|
<div class="row gx-3 mb-4 gy-6 gy-sm-3">
|
||||||
<div class="col-12 col-sm-8">
|
<div class="col-12 col-sm-8">
|
||||||
<h4 class="mb-4">Default Bill Accounts</h4>
|
<h4 class="mb-4">Default Bill Accounts</h4>
|
||||||
<div class="form-icon-container mb-3">
|
<div class="form-icon-container mb-3">
|
||||||
|
|||||||
@ -231,19 +231,24 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
{% endif %}
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="d-flex justify-content-end mt-3">
|
||||||
</div>
|
<div class="d-flex">
|
||||||
<div class="d-flex justify-content-end mt-3">
|
|
||||||
<div class="d-flex">
|
|
||||||
{% if is_paginated %}
|
{% if is_paginated %}
|
||||||
{% include 'partials/pagination.html' %}
|
{% include 'partials/pagination.html' %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<tr>
|
||||||
|
<td colspan="6" class="text-center">{% trans "No Lead Yet" %}</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@ -9,14 +9,14 @@
|
|||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<!-- Form Header -->
|
<!-- Form Header -->
|
||||||
|
|
||||||
<h4 class="mb-3">{{ _("Update Dealer Information") }}</h4>
|
<h3 class="mb-3">{{ _("Update Dealer Information") }}</h3>
|
||||||
|
|
||||||
<form method="post" enctype="multipart/form-data" class="needs-validation" novalidate>
|
<form method="post" enctype="multipart/form-data" class="needs-validation" novalidate>
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form|crispy }}
|
{{ form|crispy }}
|
||||||
<div class="gap-2 mt-3">
|
<div class="gap-2 mt-3">
|
||||||
<button type="submit" class="btn btn-phoenix-success btn-sm">
|
<button type="submit" class="btn btn-phoenix-success btn-sm me-2">
|
||||||
<i class="fa fa-save"></i> {{ _("Save") }}
|
<i class="fa fa-save me-1"></i> {{ _("Save") }}
|
||||||
</button>
|
</button>
|
||||||
<a href="{{request.META.HTTP_REFERER}}" class="btn btn-sm btn-phoenix-danger"><i class="fa-solid fa-ban me-1"></i>{% trans "Cancel" %}</a>
|
<a href="{{request.META.HTTP_REFERER}}" class="btn btn-sm btn-phoenix-danger"><i class="fa-solid fa-ban me-1"></i>{% trans "Cancel" %}</a>
|
||||||
|
|
||||||
|
|||||||
@ -7,16 +7,17 @@
|
|||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<form action="{% url 'billing_info' %}{% if request.GET.next %}?next={{ request.GET.next }}{% endif %}" method="post" class="form">
|
<form action="{% url 'billing_info' %}{% if request.GET.next %}?next={{ request.GET.next }}{% endif %}" method="post" class="form">
|
||||||
|
|
||||||
<legend>{% trans "Provide billing data"|upper %}</legend>
|
{% comment %} <legend>{% trans "Provide billing data"|upper %}</legend> {% endcomment %}
|
||||||
|
<h3>{% trans "Provide billing data"|upper %}</h3>
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form|crispy }}
|
{{ form|crispy }}
|
||||||
{% if object %}
|
|
||||||
<a class="btn btn-sm btn-phoenix-danger" href="{% url 'billing_info_delete' %}"><i class="fa-solid fa-trash me-1"></i> {{ _("Delete") }}</a>
|
<button type="submit" class="btn btn-sm btn-phoenix-success me-2">
|
||||||
{% endif %}
|
|
||||||
<button type="submit" class="btn btn-sm btn-phoenix-success">
|
|
||||||
<i class="fa fa-save me-1"></i>{{ _("Save") }}
|
<i class="fa fa-save me-1"></i>{{ _("Save") }}
|
||||||
</button>
|
</button>
|
||||||
|
{% if object %}
|
||||||
|
<a class="btn btn-sm btn-phoenix-danger " href="{% url 'billing_info_delete' %}"><i class="fa-solid fa-trash me-1"></i> {{ _("Delete") }}</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -107,7 +107,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="row g-4 mt-4">
|
<div class="row g-4 mt-4">
|
||||||
<div class="col">
|
<div class="col ms-6">
|
||||||
<p class="fs-5 mb-2">{% trans 'Exterior Colors' %}</p>
|
<p class="fs-5 mb-2">{% trans 'Exterior Colors' %}</p>
|
||||||
<div class="color-options-container">
|
<div class="color-options-container">
|
||||||
{% for color in form.fields.exterior.queryset %}
|
{% for color in form.fields.exterior.queryset %}
|
||||||
|
|||||||
@ -42,7 +42,7 @@
|
|||||||
{% if purchase_orders %}
|
{% if purchase_orders %}
|
||||||
{% for po in purchase_orders %}
|
{% for po in purchase_orders %}
|
||||||
<tr class="hover-actions-trigger btn-reveal-trigger position-static">
|
<tr class="hover-actions-trigger btn-reveal-trigger position-static">
|
||||||
<td class="align-middle product white-space-nowrap">{{ po.po_number }}</td>
|
<td class="align-middle product white-space-nowrap ps-1">{{ po.po_number }}</td>
|
||||||
<td class="align-middle product white-space-nowrap">{{ po.po_title }}</td>
|
<td class="align-middle product white-space-nowrap">{{ po.po_title }}</td>
|
||||||
<td class="align-middle product white-space-nowrap">
|
<td class="align-middle product white-space-nowrap">
|
||||||
<span class="">
|
<span class="">
|
||||||
|
|||||||
@ -10,9 +10,9 @@
|
|||||||
{% if po.po_status == 'draft' %}
|
{% if po.po_status == 'draft' %}
|
||||||
<h4 class="ms-2 text-warning mb-0">{{ po.po_status|capfirst }}</h4>
|
<h4 class="ms-2 text-warning mb-0">{{ po.po_status|capfirst }}</h4>
|
||||||
{% elif po.po_status == 'in_review' %}
|
{% elif po.po_status == 'in_review' %}
|
||||||
<h4 class="ms-2 text-primary mb-0">{{ po.po_status|capfirst }}</h4>
|
<h4 class="ms-2 text-secondary mb-0">{{ po.po_status|capfirst }}</h4>
|
||||||
{% elif po.po_status == 'approved' %}
|
{% elif po.po_status == 'approved' %}
|
||||||
<h4 class="ms-2 text-info mb-0">{{ po.po_status|capfirst }}</h4>
|
<h4 class="ms-2 text-success mb-0">{{ po.po_status|capfirst }}</h4>
|
||||||
{% elif po.po_status == 'fulfilled' %}
|
{% elif po.po_status == 'fulfilled' %}
|
||||||
<h4 class="ms-2 text-success mb-0">{{ po.po_status|capfirst }}</h4>
|
<h4 class="ms-2 text-success mb-0">{{ po.po_status|capfirst }}</h4>
|
||||||
{% elif po.po_status == 'void' %}
|
{% elif po.po_status == 'void' %}
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
<a href="{% url 'user_create' %}" class="btn btn-sm btn-phoenix-primary me-4"><i class="fa-solid fa-user-tie me-1"></i> {% trans "Add New Staff" %}</a>
|
<a href="{% url 'user_create' %}" class="btn btn-sm btn-phoenix-primary me-4"><i class="fa-solid fa-user-tie me-1"></i> {% trans "Add New Staff" %}</a>
|
||||||
<a href="{% url 'group_list' %}" class="btn btn-sm btn-phoenix-success"><i class="fa-solid fa-user-group me-1"></i> {% trans "Manage Groups & Permissions" %}</a>
|
<a href="{% url 'group_list' %}" class="btn btn-sm btn-phoenix-success"><i class="fa-solid fa-user-group me-1"></i> {% trans "Manage Groups & Permissions" %}</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="alert alert-outline-info d-flex align-items-center" role="alert">
|
<div class="alert alert-outline-warning d-flex align-items-center" role="alert">
|
||||||
<i class="fa-solid fa-circle-info fs-6"></i>
|
<i class="fa-solid fa-circle-info fs-6"></i>
|
||||||
<p class="mb-0 flex-1">{{ _("No Active Subscription,please activate your subscription.") }}<a href="{% url 'pricing_page' %}" class="ms-3 text-body-primary fs-9">Manage Subscription</a></p>
|
<p class="mb-0 flex-1">{{ _("No Active Subscription,please activate your subscription.") }}<a href="{% url 'pricing_page' %}" class="ms-3 text-body-primary fs-9">Manage Subscription</a></p>
|
||||||
<button class="btn-close" type="button" data-bs-dismiss="alert" aria-label="Close"></button>
|
<button class="btn-close" type="button" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||||
|
|||||||
2
templates/vendors/vendors_list.html
vendored
2
templates/vendors/vendors_list.html
vendored
@ -72,7 +72,7 @@
|
|||||||
<th class="sort white-space-nowrap align-middle"
|
<th class="sort white-space-nowrap align-middle"
|
||||||
scope="col"
|
scope="col"
|
||||||
data-sort="date"
|
data-sort="date"
|
||||||
style="width:15%">{{ _("Create date") }}</th>
|
style="width:15%">{{ _("Created date") }}</th>
|
||||||
<th class="sort white-space-nowrap align-middle" scope="col"></th>
|
<th class="sort white-space-nowrap align-middle" scope="col"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user