From 81459f17d61ba14a94109ec6f86bf473397d24d6 Mon Sep 17 00:00:00 2001
From: ismail <=>
Date: Thu, 22 May 2025 18:09:47 +0300
Subject: [PATCH] update
---
inventory/views.py | 41 ++-
templates/crm/leads/lead_list.html | 45 +--
.../crm/opportunities/opportunity_list.html | 7 +
templates/customers/customer_list.html | 10 +-
templates/items/expenses/expenses_list.html | 57 +---
templates/items/service/service_list.html | 49 +---
.../bank_accounts/bank_account_list.html | 44 +--
.../ledger/coa_accounts/account_list.html | 43 +--
templates/ledger/ledger/ledger_list.html | 54 +---
.../organizations/organization_list.html | 12 +-
templates/partials/search_box.html | 7 +-
templates/sales/estimates/estimate_list.html | 10 +-
templates/sales/invoices/invoice_list.html | 10 +-
templates/sales/orders/order_list.html | 10 +-
templates/sales/payments/payment_list.html | 10 +-
templates/sales/sales_list.html | 16 +-
templates/vendors/vendors_list.html | 277 +++++++++---------
17 files changed, 283 insertions(+), 419 deletions(-)
diff --git a/inventory/views.py b/inventory/views.py
index 0fbeeb78..af6aaa63 100644
--- a/inventory/views.py
+++ b/inventory/views.py
@@ -1886,7 +1886,7 @@ class CustomerListView(LoginRequiredMixin, PermissionRequiredMixin, ListView):
model = models.Customer
home_label = _("customers")
context_object_name = "customers"
- paginate_by = 10
+ paginate_by = 1
template_name = "customers/customer_list.html"
ordering = ["-created"]
permission_required = ["django_ledger.view_customermodel"]
@@ -2153,7 +2153,7 @@ class VendorListView(LoginRequiredMixin, ListView):
model = models.Vendor
context_object_name = "vendors"
- paginate_by = 10
+ paginate_by = 30
template_name = "vendors/vendors_list.html"
def get_queryset(self):
@@ -2784,7 +2784,7 @@ class OrganizationListView(LoginRequiredMixin, ListView):
model = models.Organization
template_name = "organizations/organization_list.html"
context_object_name = "organizations"
- paginate_by = 10
+ paginate_by = 30
def get_queryset(self):
query = self.request.GET.get("q")
@@ -3099,7 +3099,7 @@ class BankAccountListView(LoginRequiredMixin, PermissionRequiredMixin, ListView)
model = BankAccountModel
template_name = "ledger/bank_accounts/bank_account_list.html"
context_object_name = "bank_accounts"
- paginate_by = 10
+ paginate_by = 30
permission_required = ["inventory.view_carfinance"]
def get_queryset(self):
@@ -3289,7 +3289,7 @@ class AccountListView(LoginRequiredMixin, PermissionRequiredMixin, ListView):
model = AccountModel
template_name = "ledger/coa_accounts/account_list.html"
context_object_name = "accounts"
- paginate_by = 10
+ paginate_by = 30
permission_required = ["inventory.view_carfinance"]
def get_queryset(self):
@@ -3507,7 +3507,7 @@ def sales_list_view(request):
transactions = ItemTransactionModel.objects.for_entity(
entity_slug=entity.slug, user_model=dealer.user
).order_by("created")
- paginator = Paginator(transactions, 10)
+ paginator = Paginator(transactions, 30)
page_number = request.GET.get("page")
page_obj = paginator.get_page(page_number)
txs = get_item_transactions(page_obj)
@@ -4072,7 +4072,7 @@ class InvoiceListView(LoginRequiredMixin, PermissionRequiredMixin, ListView):
model = InvoiceModel
template_name = "sales/invoices/invoice_list.html"
context_object_name = "invoices"
- paginate_by = 20
+ paginate_by = 30
permission_required = ["django_ledger.view_invoicemodel"]
def get_queryset(self):
@@ -4512,8 +4512,16 @@ def PaymentListView(request):
"""
dealer = get_user_type(request)
entity = dealer.entity
+
journals = JournalEntryModel.objects.filter(ledger__entity=entity).all()
- return render(request, "sales/payments/payment_list.html", {"journals": journals})
+
+ paginator = Paginator(journals, 30)
+ page_number = request.GET.get("page")
+ page_obj = paginator.get_page(page_number)
+
+ return render(
+ request, "sales/payments/payment_list.html", {"page_obj": page_obj}
+ )
@login_required
@@ -4657,18 +4665,21 @@ class LeadListView(LoginRequiredMixin, PermissionRequiredMixin, ListView):
model = models.Lead
template_name = "crm/leads/lead_list.html"
context_object_name = "leads"
- paginate_by = 10
+ paginate_by = 30
permission_required = ["inventory.view_lead"]
def get_queryset(self):
+ query = self.request.GET.get("q")
dealer = get_user_type(self.request)
qs = models.Lead.objects.filter(dealer=dealer)
if self.request.is_dealer:
return qs
staffmember = getattr(self.request.user, "staffmember", None)
if staffmember and getattr(staffmember, "staff", None):
- return qs.filter(staff=staffmember.staff)
- return models.Lead.objects.none()
+ qs = qs.filter(staff=staffmember.staff)
+ if query:
+ return apply_search_filters(qs, query)
+ return qs
class LeadDetailView(LoginRequiredMixin, PermissionRequiredMixin, DetailView):
@@ -5442,7 +5453,7 @@ class OpportunityListView(LoginRequiredMixin, ListView):
model = models.Opportunity
template_name = "crm/opportunities/opportunity_list.html"
context_object_name = "opportunities"
- paginate_by = 10
+ paginate_by = 30
def get_queryset(self):
dealer = get_user_type(self.request)
@@ -5735,7 +5746,7 @@ class ItemServiceListView(LoginRequiredMixin, PermissionRequiredMixin, ListView)
model = models.AdditionalServices
template_name = "items/service/service_list.html"
context_object_name = "services"
- paginate_by = 20
+ paginate_by = 30
permission_required = ["django_ledger.view_itemmodel"]
def get_queryset(self):
@@ -5848,7 +5859,7 @@ class ItemExpenseListView(LoginRequiredMixin, PermissionRequiredMixin, ListView)
model = ItemModel
template_name = "items/expenses/expenses_list.html"
context_object_name = "expenses"
- paginate_by = 20
+ paginate_by = 30
permission_required = ["django_ledger.view_itemmodel"]
def get_queryset(self):
@@ -6277,6 +6288,7 @@ class OrderListView(LoginRequiredMixin, PermissionRequiredMixin, ListView):
model = models.SaleOrder
template_name = "sales/orders/order_list.html"
context_object_name = "orders"
+ paginate_by = 30
permission_required = ["inventory.view_saleorder"]
def get_queryset(self):
@@ -7374,6 +7386,7 @@ class LedgerModelListView(LoginRequiredMixin, ListView, ArchiveIndexView):
show_current = False
show_visible = False
allow_empty = True
+ paginate_by = 30
def get_queryset(self):
qs = super().get_queryset()
diff --git a/templates/crm/leads/lead_list.html b/templates/crm/leads/lead_list.html
index 4241ea59..6081489f 100644
--- a/templates/crm/leads/lead_list.html
+++ b/templates/crm/leads/lead_list.html
@@ -289,47 +289,14 @@
-
-
-
- {% if is_paginated %}
-
- {% endif %}
+
+
+ {% if is_paginated %}
+ {% include 'partials/pagination.html' %}
+ {% endif %}
+
-
{% endblock %}
diff --git a/templates/crm/opportunities/opportunity_list.html b/templates/crm/opportunities/opportunity_list.html
index c13b8e50..3454e203 100644
--- a/templates/crm/opportunities/opportunity_list.html
+++ b/templates/crm/opportunities/opportunity_list.html
@@ -90,4 +90,11 @@
{% include 'crm/opportunities/partials/opportunity_grid.html' %}
+
+
+ {% if is_paginated %}
+ {% include 'partials/pagination.html' %}
+ {% endif %}
+
+
{% endblock %}
\ No newline at end of file
diff --git a/templates/customers/customer_list.html b/templates/customers/customer_list.html
index 15ecfad9..c4488dfa 100644
--- a/templates/customers/customer_list.html
+++ b/templates/customers/customer_list.html
@@ -109,8 +109,12 @@
{% endif %}
-
- {% include 'partials/pagination.html' %}
-
+
+
+ {% if is_paginated %}
+ {% include 'partials/pagination.html' %}
+ {% endif %}
+
+
{% include 'modal/delete_modal.html' %}
{% endblock %}
\ No newline at end of file
diff --git a/templates/items/expenses/expenses_list.html b/templates/items/expenses/expenses_list.html
index 00a5f724..f296a6dc 100644
--- a/templates/items/expenses/expenses_list.html
+++ b/templates/items/expenses/expenses_list.html
@@ -4,36 +4,14 @@
{% block title %}{{ _("Expenses") }}{% endblock title %}
{% block content %}
-
+
-
-
-
-
+ {% include "partials/search_box.html" %}
{% if page_obj.object_list %}
-
-
{{ page_obj.start_index }} {{ _("to") }} {{ page_obj.end_index }} {{ _("Items of")}} {{ page_obj.paginator.count }}
-
-
- {% if is_paginated %}
- {% include 'partials/pagination.html' %}
- {% endif %}
-
-
-
-
-
-
-
+
+
+ {% if is_paginated %}
+ {% include 'partials/pagination.html' %}
+ {% endif %}
+
+
{% endif %}
-
-
{% endblock %}
\ No newline at end of file
diff --git a/templates/items/service/service_list.html b/templates/items/service/service_list.html
index 5c2b0f30..edbe50d9 100644
--- a/templates/items/service/service_list.html
+++ b/templates/items/service/service_list.html
@@ -4,37 +4,14 @@
{% block title %}{{ _("Services") }}{% endblock title %}
{% block content %}
-
-
-
-
-
- {% if page_obj.object_list %}
+ {% include "partials/search_box.html" %}
+ {% if page_obj.object_list %}
-
-
{{ page_obj.start_index }} {{ _("to") }} {{ page_obj.end_index }} {{ _("Items of")}} {{ page_obj.paginator.count }}
-
-
- {% if is_paginated %}
- {% include 'partials/pagination.html' %}
- {% endif %}
-
-
+
+
+ {% if is_paginated %}
+ {% include 'partials/pagination.html' %}
+ {% endif %}
+
-
{% endif %}
-
-
{% endblock %}
\ No newline at end of file
diff --git a/templates/ledger/bank_accounts/bank_account_list.html b/templates/ledger/bank_accounts/bank_account_list.html
index 63417445..f2bf1514 100644
--- a/templates/ledger/bank_accounts/bank_account_list.html
+++ b/templates/ledger/bank_accounts/bank_account_list.html
@@ -10,35 +10,11 @@
{% trans "Bank Accounts" %}
{% trans "Add Bank Account" %}
-
-
-
-
-
+ {% include "partials/search_box.html" %}
{% if page_obj.object_list %}
- {{ page_obj.start_index }} {{ _("to") }} {{ page_obj.end_index }} {{ _("Items of")}} {{ page_obj.paginator.count }}
-
-
- {% if is_paginated %}
- {% include 'partials/pagination.html' %}
- {% endif %}
-
-
+
+
+ {% if is_paginated %}
+ {% include 'partials/pagination.html' %}
+ {% endif %}
+
{% endif %}
diff --git a/templates/ledger/coa_accounts/account_list.html b/templates/ledger/coa_accounts/account_list.html
index 2dd35aab..857af6e1 100644
--- a/templates/ledger/coa_accounts/account_list.html
+++ b/templates/ledger/coa_accounts/account_list.html
@@ -14,28 +14,7 @@
{% trans "Accounts" %}
{% trans 'New Account' %}
-
-
-
+ {% include "partials/search_box.html" %}
{% if page_obj.object_list %}
- {{ page_obj.start_index }} {{ _("to") }} {{ page_obj.end_index }} {{ _("Items of")}} {{ page_obj.paginator.count }}
-
-
- {% if is_paginated %}
- {% include 'partials/pagination.html' %}
- {% endif %}
-
-
+
+
+ {% if is_paginated %}
+ {% include 'partials/pagination.html' %}
+ {% endif %}
+
{% endif %}
diff --git a/templates/ledger/ledger/ledger_list.html b/templates/ledger/ledger/ledger_list.html
index db9b6138..a03ade5b 100644
--- a/templates/ledger/ledger/ledger_list.html
+++ b/templates/ledger/ledger/ledger_list.html
@@ -4,41 +4,18 @@
{% block title %}{{ _("Ledger") }}{% endblock title %}
{% block content %}
-
-
+
+
-
-
-
-
-
-
{{ page_obj.start_index }} {{ _("to") }} {{ page_obj.end_index }} {{ _("Items of")}} {{ page_obj.paginator.count }}
-
-
- {% if is_paginated %}
- {% include 'partials/pagination.html' %}
- {% endif %}
-
-
+
+
+ {% if is_paginated %}
+ {% include 'partials/pagination.html' %}
+ {% endif %}
+
-
-
-
-
{% endblock %}
\ No newline at end of file
diff --git a/templates/organizations/organization_list.html b/templates/organizations/organization_list.html
index 63988909..90a747ed 100644
--- a/templates/organizations/organization_list.html
+++ b/templates/organizations/organization_list.html
@@ -131,11 +131,13 @@
-
- {% if is_paginated %}
- {% include 'partials/pagination.html' %}
- {% endif %}
-
+
+
+ {% if is_paginated %}
+ {% include 'partials/pagination.html' %}
+ {% endif %}
+
+
{% endblock %}
diff --git a/templates/partials/search_box.html b/templates/partials/search_box.html
index 4916a3e9..2df2d000 100644
--- a/templates/partials/search_box.html
+++ b/templates/partials/search_box.html
@@ -3,7 +3,6 @@
-
{% if request.GET.q %}
@@ -20,13 +19,11 @@
clearButton.addEventListener("click", function(event) {
event.preventDefault();
searchInput.value = ""; // Clear input field
-
// Remove query parameter without reloading the page
const newUrl = window.location.pathname;
history.replaceState(null, "", newUrl);
+ window.location.reload();
});
}
});
-
-
-
+
\ No newline at end of file
diff --git a/templates/sales/estimates/estimate_list.html b/templates/sales/estimates/estimate_list.html
index c1d7fd43..0d85ef28 100644
--- a/templates/sales/estimates/estimate_list.html
+++ b/templates/sales/estimates/estimate_list.html
@@ -59,10 +59,12 @@
-
- {% if is_paginated %}
- {% include 'partials/pagination.html' %}
- {% endif %}
+
+
+ {% if is_paginated %}
+ {% include 'partials/pagination.html' %}
+ {% endif %}
+
diff --git a/templates/sales/invoices/invoice_list.html b/templates/sales/invoices/invoice_list.html
index 2dec1276..9c75f047 100644
--- a/templates/sales/invoices/invoice_list.html
+++ b/templates/sales/invoices/invoice_list.html
@@ -71,10 +71,12 @@
-
- {% if is_paginated %}
- {% include 'partials/pagination.html' %}
- {% endif %}
+
+
+ {% if is_paginated %}
+ {% include 'partials/pagination.html' %}
+ {% endif %}
+
{% endblock %}
\ No newline at end of file
diff --git a/templates/sales/orders/order_list.html b/templates/sales/orders/order_list.html
index 865da764..54b47220 100644
--- a/templates/sales/orders/order_list.html
+++ b/templates/sales/orders/order_list.html
@@ -37,10 +37,12 @@
-
- {% if is_paginated %}
- {% include 'partials/pagination.html' %}
- {% endif %}
+
+
+ {% if is_paginated %}
+ {% include 'partials/pagination.html' %}
+ {% endif %}
+
diff --git a/templates/sales/payments/payment_list.html b/templates/sales/payments/payment_list.html
index 166b685c..a173ccf9 100644
--- a/templates/sales/payments/payment_list.html
+++ b/templates/sales/payments/payment_list.html
@@ -24,7 +24,7 @@
- {% for journal in journals %}
+ {% for journal in page_obj %}
| {{ forloop.counter }} |
{{ journal.je_number }} |
@@ -53,8 +53,12 @@
-
+
+
+ {% if is_paginated %}
+ {% include 'partials/pagination.html' %}
+ {% endif %}
+
-
{% endblock %}
\ No newline at end of file
diff --git a/templates/sales/sales_list.html b/templates/sales/sales_list.html
index 960735ab..016918a5 100644
--- a/templates/sales/sales_list.html
+++ b/templates/sales/sales_list.html
@@ -214,17 +214,13 @@
- {{ page_obj.start_index }} {{ _("to") }} {{ page_obj.end_index }} {{ _("Items of")}} {{ page_obj.paginator.count }}
-
-
- {% if is_paginated %}
- {% include 'partials/pagination.html' %}
- {% endif %}
-
-
+
+
+ {% if is_paginated %}
+ {% include 'partials/pagination.html' %}
+ {% endif %}
+
-
-
diff --git a/templates/vendors/vendors_list.html b/templates/vendors/vendors_list.html
index 21c891d7..4271fb03 100644
--- a/templates/vendors/vendors_list.html
+++ b/templates/vendors/vendors_list.html
@@ -1,147 +1,154 @@
{% extends 'base.html' %}
{% load i18n %}
{% load static %}
-{% block title %}{{ _('Vendors')|capfirst }}{% endblock title %}
-{% block vendors %}{{ _("Vendors")|capfirst }}{% endblock %}
-
+{% block title %}
+ {{ _("Vendors") |capfirst }}
+{% endblock title %}
+{% block vendors %}{{ _("Vendors") |capfirst }}{% endblock %}
{% block content %}
-
-