diff --git a/inventory/models.py b/inventory/models.py index 4f20430a..b04c193a 100644 --- a/inventory/models.py +++ b/inventory/models.py @@ -2606,7 +2606,7 @@ class CustomGroup(models.Model): "activity", "opportunity", "vendor", - "customer" + "customer", "notes", "tasks", "activity", diff --git a/inventory/views.py b/inventory/views.py index f697bdb6..a04ea1bf 100644 --- a/inventory/views.py +++ b/inventory/views.py @@ -3864,6 +3864,15 @@ class BankAccountDetailView(LoginRequiredMixin, PermissionRequiredMixin, DetailV template_name = "ledger/bank_accounts/bank_account_detail.html" context_object_name = "bank_account" permission_required = ["django_ledger.view_bankaccountmodel"] + + def get_queryset(self): + dealer = get_object_or_404(models.Dealer, slug=self.kwargs["dealer_slug"]) + query=self.request.GET.get('q') + qs=self.model.objects.filter(entity=dealer.entity) + if query: + qs=apply_search_filters(qs,query) + return qs + return qs class BankAccountUpdateView( @@ -5584,14 +5593,23 @@ class LeadListView(LoginRequiredMixin, PermissionRequiredMixin, ListView): query = self.request.GET.get("q") qs = models.Lead.objects.filter(dealer=dealer).exclude(status="converted") if query: - qs = apply_search_filters(qs, query) + qs = qs.filter(Q(first_name__icontains=query) + | Q(last_name__icontains=query) + | Q(id_car_make__name__icontains=query) + | Q(id_car_model__name__icontains=query) + | Q(email__icontains=query) + | Q(phone_number__icontains=query) + | Q(next_action__icontains=query) + | Q(staff__name__icontains=query)) + if self.request.is_dealer: return qs staffmember = getattr(self.request.user, "staffmember", None) if staff := getattr(staffmember, "staff", None): return qs.filter(staff=staff) return models.Lead.objects.none() - + + class LeadDetailView(LoginRequiredMixin, PermissionRequiredMixin, DetailView): """ @@ -6654,12 +6672,15 @@ class OpportunityListView(LoginRequiredMixin,PermissionRequiredMixin, ListView): queryset = models.Opportunity.objects.filter(dealer=dealer, lead__staff=staff) # Search filter - search = self.request.GET.get("search") + search = self.request.GET.get("q") if search: queryset = queryset.filter( - Q(customer__customer_name__icontains=search) + Q(customer__first_name__icontains=search) + | Q(customer__last_name__icontains=search) | Q(customer__email__icontains=search) - ) + + ) + # Stage filter stage = self.request.GET.get("stage") @@ -6947,10 +6968,17 @@ class ItemServiceListView(LoginRequiredMixin, PermissionRequiredMixin, ListView) paginate_by = 30 permission_required = ["inventory.view_additionalservices"] - def get_queryset(self): dealer = get_user_type(self.request) - return models.AdditionalServices.objects.filter(dealer=dealer).all() + query=self.request.GET.get('q') + qs= models.AdditionalServices.objects.filter(dealer=dealer).all() + if query: + qs=apply_search_filters(qs,query) + return qs + + # def get_queryset(self): + # dealer = get_user_type(self.request) + # return models.AdditionalServices.objects.filter(dealer=dealer).all() class ItemExpenseCreateView(LoginRequiredMixin, PermissionRequiredMixin, CreateView): @@ -7068,9 +7096,18 @@ class ItemExpenseListView(LoginRequiredMixin, PermissionRequiredMixin, ListView) paginate_by = 30 permission_required = ["django_ledger.view_itemmodel"] + # def get_queryset(self): + # dealer = get_user_type(self.request) + # return dealer.entity.get_items_expenses() + def get_queryset(self): dealer = get_user_type(self.request) - return dealer.entity.get_items_expenses() + query=self.request.GET.get('q') + qs= dealer.entity.get_items_expenses() + if query: + qs=apply_search_filters(qs,query) + return qs + class BillListView(LoginRequiredMixin, PermissionRequiredMixin, ListView): @@ -7100,6 +7137,9 @@ class BillListView(LoginRequiredMixin, PermissionRequiredMixin, ListView): def get_queryset(self): dealer = get_user_type(self.request) qs = dealer.entity.get_bills() + query=self.request.GET.get('q') + if query: + qs=qs.filter(vendor__vendor_name__icontains=query) return qs def get_context_data(self, **kwargs): @@ -9917,10 +9957,21 @@ class PurchaseOrderListView(LoginRequiredMixin, PermissionRequiredMixin, ListVie template_name = "purchase_orders/po_list.html" permission_required = ["django_ledger.view_purchaseordermodel"] + # def get_queryset(self): + # dealer = get_object_or_404(models.Dealer, slug=self.kwargs["dealer_slug"]) + # return self.model.objects.filter(entity=dealer.entity) def get_queryset(self): dealer = get_object_or_404(models.Dealer, slug=self.kwargs["dealer_slug"]) - return self.model.objects.filter(entity=dealer.entity) - + query=self.request.GET.get("q") + qs=self.model.objects.filter(entity=dealer.entity) + if query: + qs=apply_search_filters(qs,query) + if self.request.is_dealer: + return qs + staffmember= staffmember = getattr(self.request.user, "staffmember", None) + if staff := getattr(staffmember, "staff", None): + return qs.filter(staff=staff) + return self.model.objects.none() # def get_queryset(self): # dealer = get_user_type(self.request) # entity = dealer.entity diff --git a/templates/bill/bill_detail.html b/templates/bill/bill_detail.html index 5de0d08e..e69548e8 100644 --- a/templates/bill/bill_detail.html +++ b/templates/bill/bill_detail.html @@ -36,210 +36,232 @@ {% endblock %} {% block content %} -
-
- -
-
-
- {% include 'bill/includes/card_bill.html' with dealer_slug=request.dealer.slug bill=bill entity_slug=view.kwargs.entity_slug style='bill-detail' %} - - -
-
-
+
- -
- {% if bill.is_configured %} -
-
-
-
-
-
- {% trans 'Cash Account' %}: - - {{ bill.cash_account.code }} - -
-

- {% currency_symbol %}{{ bill.get_amount_cash | absolute | currency_format }} -

-
-
- {% if bill.accrue %} -
-
-
- {% trans 'Prepaid Account' %}: - - {{ bill.prepaid_account.code }} - -
-

- {% currency_symbol %}{{ bill.get_amount_prepaid | currency_format }} -

-
-
-
-
-
- {% trans 'Accounts Payable' %}: - - {{ bill.unearned_account.code }} - -
-

- {% currency_symbol %}{{ bill.get_amount_unearned | currency_format }} -

-
-
-
-
-
- {% trans 'Accrued' %} {{ bill.get_progress | percentage }} -
-

- {% currency_symbol %}{{ bill.get_amount_earned | currency_format }} -

-
-
- {% else %} -
-
-
- {% trans 'You Still Owe' %} -
-

- {% currency_symbol %}{{ bill.get_amount_open | currency_format }} -

-
-
- {% endif %} -
-
-
- {% endif %} +
+
+
+
+
+ {% include 'bill/includes/card_bill.html' with dealer_slug=request.dealer.slug bill=bill entity_slug=view.kwargs.entity_slug style='bill-detail' %} - -
-
-
- -
{% trans 'Bill Items' %}
-
-
-
-
- - - - - - - - - - - - - {% for bill_item in itemtxs_qs %} - - - - - - - - - {% endfor %} - - - - - - - - - -
{% trans 'Item' %}{% trans 'Entity Unit' %}{% trans 'Unit Cost' %}{% trans 'Quantity' %}{% trans 'Total' %}{% trans 'PO' %}
-
-
-
{{ bill_item.item_model }}
-
+ -
- - {% if bill_item.entity_unit %} - {{ bill_item.entity_unit }} - {% endif %} - - - - {{ bill_item.unit_cost | currency_format }} - - - {{ bill_item.quantity }} - - - {{ bill_item.total_amount | currency_format }} - - - {% if bill_item.po_model_id %} - {% if perms.django_ledger.view_purchaseordermodel%} - - {% trans 'View PO' %} - - {% endif %} - {% endif %} -
{% trans 'Total' %} - - {% currency_symbol %}{{ total_amount__sum | currency_format }} - -
+
+
+
+ +
+
+ +
+
+
+ +
{% trans 'Bill Notes' %}
+
+
+ {% if perms.django_ledger.change_billmodel%} +
+ {% include 'bill/includes/card_markdown.html' with style='card_1' title='' notes_html=bill.notes_html %} +
+ {% endif %}
-
- -
-
-
- -
{% trans 'Bill Transactions' %}
-
-
-
- {% transactions_table bill %} -
-
- - -
-
-
- -
{% trans 'Bill Notes' %}
-
-
- {% if perms.django_ledger.change_billmodel%} -
- {% include 'bill/includes/card_markdown.html' with style='card_1' title='' notes_html=bill.notes_html %} -
- {% endif %} -
-
-
+ + +
+
+
+ {% if bill.is_configured %} +
+
+
+
+
+
+ {% trans 'Cash Account' %}: + + {{ bill.cash_account.code }} + +
+

+ {% currency_symbol %}{{ bill.get_amount_cash | absolute | currency_format }} +

+
+
+ {% if bill.accrue %} +
+
+
+ {% trans 'Prepaid Account' %}: + + {{ bill.prepaid_account.code }} + +
+

+ {% currency_symbol %}{{ bill.get_amount_prepaid | currency_format }} +

+
+
+
+
+
+ {% trans 'Accounts Payable' %}: + + {{ bill.unearned_account.code }} + +
+

+ {% currency_symbol %}{{ bill.get_amount_unearned | currency_format }} +

+
+
+
+
+
+ {% trans 'Accrued' %} {{ bill.get_progress | percentage }} +
+

+ {% currency_symbol %}{{ bill.get_amount_earned | currency_format }} +

+
+
+ {% else %} +
+
+
+ {% trans 'You Still Owe' %} +
+

+ {% currency_symbol %}{{ bill.get_amount_open | currency_format }} +

+
+
+ {% endif %} +
+
+
+ {% endif %} + + +
+ +
+ +
+
+
+ +
{% trans 'Bill Items' %}
+
+
+
+
+ + + + + + + + + + + + + {% for bill_item in itemtxs_qs %} + + + + + + + + + {% endfor %} + + + + + + + + + +
{% trans 'Item' %}{% trans 'Entity Unit' %}{% trans 'Unit Cost' %}{% trans 'Quantity' %}{% trans 'Total' %}{% trans 'PO' %}
+
+
+
{{ bill_item.item_model }}
+
+
+
+ + {% if bill_item.entity_unit %} + {{ bill_item.entity_unit }} + {% endif %} + + + + {{ bill_item.unit_cost | currency_format }} + + + {{ bill_item.quantity }} + + + {{ bill_item.total_amount | currency_format }} + + + {% if bill_item.po_model_id %} + {% if perms.django_ledger.view_purchaseordermodel%} + + {% trans 'View PO' %} + + {% endif %} + {% endif %} +
{% trans 'Total' %} + + {% currency_symbol %}{{ total_amount__sum | currency_format }} + +
+
+
+
+ + +
+ +
+ +
+
+
+ +
{% trans 'Bill Transactions' %}
+
+
+
+ {% transactions_table bill %} +
+
+ + +
+ +
+ +
+ + +
{% include "bill/includes/mark_as.html" %} {% endblock %} \ No newline at end of file diff --git a/templates/bill/bill_update.html b/templates/bill/bill_update.html index 0fb4e1a7..f9c2a90d 100644 --- a/templates/bill/bill_update.html +++ b/templates/bill/bill_update.html @@ -22,6 +22,21 @@ class="btn btn-phoenix-secondary w-100 mb-2"> {% trans 'Back to Bill Detail' %} + +
+ {% csrf_token %} + +
+ {{ form|crispy }} +
+ + + + + +
diff --git a/templates/crm/leads/lead_list.html b/templates/crm/leads/lead_list.html index 8c7911ce..42792e05 100644 --- a/templates/crm/leads/lead_list.html +++ b/templates/crm/leads/lead_list.html @@ -50,18 +50,20 @@
{{ _("Phone Number") }}
- -
-
- {{ _("Schedule") }} -
- +
- {{ _("Action")|capfirst }} + {{ _("Next Action")|capfirst }}
+ +
+
+ {{ _("Scheduled at") }} +
+ +
@@ -69,15 +71,16 @@
- + {% comment %}
{{ _("Opportunity")|capfirst }}
- + {% endcomment %} {{ _("Action") }} + {% for lead in leads %} @@ -103,7 +106,7 @@
- +
{{lead.full_name|capfirst}}
@@ -128,9 +131,9 @@ {{ lead.id_car_make.get_local_name }} - {{ lead.id_car_model.get_local_name }} {{ lead.year }} {{ lead.email }} - {{ lead.phone_number }} - - {{ lead.get_status|upper }} + {{ lead.phone_number }} + {{ lead.next_action|upper }} + {{ lead.next_action_date|upper }} {{ lead.staff|upper }} {% comment %} {% if lead.opportunity.stage == "prospect" %} @@ -145,13 +148,13 @@ {{ lead.opportunity.stage|upper }} {% endif %} {% endcomment %} - + {% comment %} {% if lead.opportunity %} Opportunity {{ lead.opportunity.lead}} {% endif %} - + {% endcomment %} {% if user == lead.staff.user or request.is_dealer %}
diff --git a/templates/crm/opportunities/opportunity_list.html b/templates/crm/opportunities/opportunity_list.html index 5e9a9e69..2412faa1 100644 --- a/templates/crm/opportunities/opportunity_list.html +++ b/templates/crm/opportunities/opportunity_list.html @@ -12,25 +12,22 @@
-
- - -
+ + + -
+
- {% if request.GET.q %} - - - - {% endif %} -
- +
+
+ {% include 'partials/search_box.html' %} +
diff --git a/templates/sales/sales_list.html b/templates/sales/sales_list.html index 91d891d0..1f3c978a 100644 --- a/templates/sales/sales_list.html +++ b/templates/sales/sales_list.html @@ -129,7 +129,7 @@

{{tx.customer.phone_number}}

- {% if tx.estimate %} + {% if tx.estimate and perms.django_ledger.view_estimatemodel%}

{{ tx.estimate.estimate_number}} @@ -147,7 +147,7 @@ {% endif %} - {% if tx.invoice %} + {% if tx.invoice and perms.django_ledger.view_invoicemodel%}

{{tx.invoice.invoice_number}}