From 8735f902a19c2624ae1095886aa86a775c39fd00 Mon Sep 17 00:00:00 2001 From: Faheedkhan Date: Wed, 25 Jun 2025 14:31:46 +0300 Subject: [PATCH 01/12] update --- templates/header.html | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/templates/header.html b/templates/header.html index eeb6a35e..00227175 100644 --- a/templates/header.html +++ b/templates/header.html @@ -99,6 +99,14 @@ {% endif %} + + {% if perms.django_ledger.view_invoicemodel %} {% endif %} - + -- 2.39.5 From 4f364e279866c361c34ca32bc7f375eed70d58e0 Mon Sep 17 00:00:00 2001 From: Faheedkhan Date: Wed, 25 Jun 2025 16:08:36 +0300 Subject: [PATCH 02/12] update --- templates/header.html | 21 +++++---- templates/purchase_orders/po_detail.html | 59 +++++++++++------------- 2 files changed, 37 insertions(+), 43 deletions(-) diff --git a/templates/header.html b/templates/header.html index 88723579..cadf5166 100644 --- a/templates/header.html +++ b/templates/header.html @@ -31,17 +31,11 @@ - + {% endif %} + @@ -476,7 +477,7 @@ - {% else %} + {% else %} diff --git a/templates/purchase_orders/po_detail.html b/templates/purchase_orders/po_detail.html index 79465d8b..b4b82328 100644 --- a/templates/purchase_orders/po_detail.html +++ b/templates/purchase_orders/po_detail.html @@ -7,17 +7,15 @@ {% block content %}
- +
-
{% include 'purchase_orders/includes/card_po.html' with dealer_slug=request.dealer.slug po_model=po_model entity_slug=entity_slug style='po-detail' %}
- {% trans 'PO List' %} @@ -25,9 +23,8 @@
- -
- + +
@@ -51,28 +48,24 @@
-
+
+ +
{% include "purchase_orders/includes/mark_as.html" %} {% endblock %} @@ -91,15 +84,15 @@ document.getElementById('POModalTitle').textContent = title; document.getElementById('POModalBody').innerHTML = ` -
- - ${buttonText} - - -
- `; +
+ + ${buttonText} + + +
+ `; modal.show(); }; -- 2.39.5 From aa1c283bddcfd4e8df6a1addd57a46c5242f2d68 Mon Sep 17 00:00:00 2001 From: Faheedkhan Date: Wed, 25 Jun 2025 18:08:44 +0300 Subject: [PATCH 03/12] update --- templates/crm/leads/lead_form.html | 2 +- templates/crm/leads/lead_tracking.html | 2 +- templates/crm/opportunities/opportunity_detail.html | 4 ++-- .../crm/opportunities/partials/opportunity_grid.html | 2 +- templates/header.html | 4 ++-- templates/ledger/bank_accounts/bank_account_list.html | 4 ++-- templates/ledger/coa_accounts/account_detail.html | 2 +- .../ledger/coa_accounts/partials/account_table.html | 2 +- templates/organizations/organization_form.html | 11 ++++++++++- templates/organizations/organization_list.html | 2 +- 10 files changed, 22 insertions(+), 13 deletions(-) diff --git a/templates/crm/leads/lead_form.html b/templates/crm/leads/lead_form.html index cd888aa2..2beec219 100644 --- a/templates/crm/leads/lead_form.html +++ b/templates/crm/leads/lead_form.html @@ -25,7 +25,7 @@ {% block content %}
-

{% if object %}{{ _("Update") }}{% else %}{{ _("Create") }}{% endif %}

+

{% if object %}{{ _("Update Lead") }}{% else %}{{ _("Create New Lead") }}{% endif %}

diff --git a/templates/crm/leads/lead_tracking.html b/templates/crm/leads/lead_tracking.html index cfef8140..9c153639 100644 --- a/templates/crm/leads/lead_tracking.html +++ b/templates/crm/leads/lead_tracking.html @@ -77,7 +77,7 @@
{{ _("New Leads")}} ({{new|length}})
{% for lead in new %} - + {% if opportunity.estimate %} - {{ _("View Quotation")}} + {{ _("View Quotation")}} {% else %}

{{ _("No Estimate") }}

{% endif %} diff --git a/templates/crm/opportunities/partials/opportunity_grid.html b/templates/crm/opportunities/partials/opportunity_grid.html index 6709ab4f..4579e465 100644 --- a/templates/crm/opportunities/partials/opportunity_grid.html +++ b/templates/crm/opportunities/partials/opportunity_grid.html @@ -119,7 +119,7 @@
- + {{ _("View Details") }} diff --git a/templates/header.html b/templates/header.html index 143f4342..9e198114 100644 --- a/templates/header.html +++ b/templates/header.html @@ -78,7 +78,7 @@ @@ -87,7 +87,7 @@ diff --git a/templates/ledger/bank_accounts/bank_account_list.html b/templates/ledger/bank_accounts/bank_account_list.html index 9c8187e1..32ca2474 100644 --- a/templates/ledger/bank_accounts/bank_account_list.html +++ b/templates/ledger/bank_accounts/bank_account_list.html @@ -8,7 +8,7 @@ {% include "partials/search_box.html" %} {% if page_obj.object_list %} @@ -36,7 +36,7 @@ {{ bank.account_type|capfirst }} - {% trans "Update" %} diff --git a/templates/ledger/coa_accounts/account_detail.html b/templates/ledger/coa_accounts/account_detail.html index c1082520..92b9ebef 100644 --- a/templates/ledger/coa_accounts/account_detail.html +++ b/templates/ledger/coa_accounts/account_detail.html @@ -99,7 +99,7 @@ diff --git a/templates/ledger/coa_accounts/partials/account_table.html b/templates/ledger/coa_accounts/partials/account_table.html index 41638aa6..5f1a0d67 100644 --- a/templates/ledger/coa_accounts/partials/account_table.html +++ b/templates/ledger/coa_accounts/partials/account_table.html @@ -39,7 +39,7 @@ diff --git a/templates/header.html b/templates/header.html index 84077403..90c52d8c 100644 --- a/templates/header.html +++ b/templates/header.html @@ -442,7 +442,7 @@ {% endif %} {% if request.is_dealer %}
-- 2.39.5 From c1d329af6440b42d4cda1860952a41d03bb0616d Mon Sep 17 00:00:00 2001 From: Faheedkhan Date: Thu, 26 Jun 2025 12:00:57 +0300 Subject: [PATCH 07/12] update --- templates/groups/group_detail.html | 8 ++++---- templates/groups/group_list.html | 4 ++-- templates/users/user_detail.html | 4 ++-- templates/users/user_list.html | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/templates/groups/group_detail.html b/templates/groups/group_detail.html index 1c2d9040..fc2e0b79 100644 --- a/templates/groups/group_detail.html +++ b/templates/groups/group_detail.html @@ -28,7 +28,7 @@ + href="{% url 'group_delete' request.dealer.slug group.id %}"> {% trans 'Yes' %}
@@ -74,7 +74,7 @@

Permissions

- Manage Permissions + Manage Permissions @@ -98,7 +98,7 @@
-
+

Groups

- Manage Groups + Manage Groups diff --git a/templates/users/user_list.html b/templates/users/user_list.html index cbb6be8c..d1c04464 100644 --- a/templates/users/user_list.html +++ b/templates/users/user_list.html @@ -12,8 +12,8 @@ @@ -53,7 +53,7 @@
+ href="{% url 'user_detail' request.dealer.slug user.slug %}"> {% trans 'view'|capfirst %} -- 2.39.5 From 49d90936fe416054ab9a638dccf133a207a1e15e Mon Sep 17 00:00:00 2001 From: Faheedkhan Date: Thu, 26 Jun 2025 12:34:39 +0300 Subject: [PATCH 08/12] update --- templates/header.html | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/templates/header.html b/templates/header.html index fb64e7e5..11d24de0 100644 --- a/templates/header.html +++ b/templates/header.html @@ -28,23 +28,6 @@ -<<<<<<< HEAD - - - {% endif %} {% endif %} -<<<<<<< HEAD - -======= {% if perms.django_ledger.view_purchaseordermodel %} {% endif %} ->>>>>>> c9fad7b79c346875a636122fdc7514814180dbc7 -- 2.39.5 From 83c4707886e40d4a75560b002c201b7e41bcea43 Mon Sep 17 00:00:00 2001 From: Faheedkhan Date: Thu, 26 Jun 2025 12:53:44 +0300 Subject: [PATCH 09/12] update --- inventory/urls.py | 2 +- templates/inventory/car_confirm_delete.html | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/inventory/urls.py b/inventory/urls.py index 0de89f7a..94b061ba 100644 --- a/inventory/urls.py +++ b/inventory/urls.py @@ -9,7 +9,7 @@ from django.conf.urls import handler403, handler400, handler404, handler500 urlpatterns = [ # main URLs path("", views.HomeView.as_view(), name="home"), - # path("/", views.HomeView.as_view(), name="home"), + path("/", views.HomeView.as_view(), name="home"), path("welcome/", views.WelcomeView.as_view(), name="welcome"), # Accounts URLs # path("login/", allauth_views.LoginView.as_view(template_name="account/login.html"), name="account_login"), diff --git a/templates/inventory/car_confirm_delete.html b/templates/inventory/car_confirm_delete.html index 1649407f..d210cb25 100644 --- a/templates/inventory/car_confirm_delete.html +++ b/templates/inventory/car_confirm_delete.html @@ -3,11 +3,13 @@ {% load i18n %} {% block title %}Delete Car{% endblock %} {% block content %} +

Delete Car

-

Are you sure you want to delete the car "{{ car }}"?

+

Are you sure you want to delete the car "{{ car }}"?

{% csrf_token %} - {% trans 'Cancel' %} + {% trans 'Cancel' %} +
{% endblock %} -- 2.39.5 From 51d0c11ffaca43a1d7cdcc2076d69209d5b95918 Mon Sep 17 00:00:00 2001 From: Faheedkhan Date: Thu, 26 Jun 2025 15:51:52 +0300 Subject: [PATCH 10/12] updated the po_detail.html missing tags --- inventory/views.py | 15 ++++++- templates/purchase_orders/po_detail.html | 43 +++++-------------- .../sales/estimates/estimate_detail.html | 27 ++++++------ 3 files changed, 38 insertions(+), 47 deletions(-) diff --git a/inventory/views.py b/inventory/views.py index 37e3adb4..9195727d 100644 --- a/inventory/views.py +++ b/inventory/views.py @@ -1573,12 +1573,25 @@ class CarDeleteView( model = models.Car template_name = "inventory/car_confirm_delete.html" - success_url = reverse_lazy("inventory_stats") + permission_required = ["inventory.delete_car"] def delete(self, request, *args, **kwargs): messages.success(request, _("Car deleted successfully")) return super().delete(request, *args, **kwargs) + def get_success_url(self): + """ + Returns the URL to redirect to after a successful car deletion. + It dynamically includes the dealer_slug from the URL. + """ + + dealer_slug = self.kwargs.get('dealer_slug') + if dealer_slug: + return reverse_lazy("car_list", kwargs={'dealer_slug': dealer_slug}) + else: + + messages.error(self.request, _("Could not determine dealer for redirection.")) + return reverse_lazy("home") class CarLocationCreateView(LoginRequiredMixin, PermissionRequiredMixin, CreateView): diff --git a/templates/purchase_orders/po_detail.html b/templates/purchase_orders/po_detail.html index 7455e398..672fa591 100644 --- a/templates/purchase_orders/po_detail.html +++ b/templates/purchase_orders/po_detail.html @@ -7,7 +7,7 @@ {% block content %}
- +
@@ -23,8 +23,7 @@
- -
+
@@ -47,42 +46,20 @@
-
-<<<<<<< HEAD -
- -
-
-
-
-

{{ po_model.po_title }}

-======= +
->>>>>>> c9fad7b79c346875a636122fdc7514814180dbc7 - -
- {% po_item_table1 po_items %} -
-
+
+
+ {% po_item_table1 po_items %}
-
-<<<<<<< HEAD + + +
- -
- -======= - - - {% trans 'PO List' %} - -
->>>>>>> c9fad7b79c346875a636122fdc7514814180dbc7 + {% include "purchase_orders/includes/mark_as.html" %} -
{% endblock %} diff --git a/templates/sales/estimates/estimate_detail.html b/templates/sales/estimates/estimate_detail.html index cf2ca8b9..a4df4d64 100644 --- a/templates/sales/estimates/estimate_detail.html +++ b/templates/sales/estimates/estimate_detail.html @@ -74,12 +74,6 @@
- {% if estimate.invoicemodel_set.first %} - - {{ _("View Invoice")}} - - {% endif %} - {% if estimate.status == 'draft' %} {% trans 'Send Quotation' %} @@ -87,16 +81,23 @@ {% elif estimate.status == 'approved' %} - {% if estimate.sale_orders.first %} - {% trans 'Create Invoice' %} - {{ _("Preview Sale Order") }} - {% else %} + {% if estimate.sale_orders.first %} + + + {{ _("Preview Sale Order") }} + + {% else %} {% trans 'Create Sale Order' %} {% comment %} {% endcomment %} - {% endif %} - {% elif estimate.status == 'in_review' %} - {% trans 'Preview' %} + {% endif %} + + + {% elif estimate.status == 'completed' %} + {{ _("Preview Sale Order") }} + + {{ _("View Invoice")}} {% endif %} + {% if estimate.can_cancel %} {% if perms.django_ledger.change_estimatemodel %} -- 2.39.5 From f09a18c7e981c337599cf6a8abb051ba5ae63905 Mon Sep 17 00:00:00 2001 From: Faheedkhan Date: Thu, 26 Jun 2025 17:59:31 +0300 Subject: [PATCH 11/12] update --- templates/sales/estimates/estimate_detail.html | 2 +- templates/users/user_detail.html | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/templates/sales/estimates/estimate_detail.html b/templates/sales/estimates/estimate_detail.html index a4df4d64..a63aa76a 100644 --- a/templates/sales/estimates/estimate_detail.html +++ b/templates/sales/estimates/estimate_detail.html @@ -83,7 +83,7 @@ {% if estimate.sale_orders.first %} - + {% trans 'Create Invoice' %} {{ _("Preview Sale Order") }} {% else %} diff --git a/templates/users/user_detail.html b/templates/users/user_detail.html index 89086383..3f4127d8 100644 --- a/templates/users/user_detail.html +++ b/templates/users/user_detail.html @@ -27,11 +27,7 @@

Groups

-<<<<<<< HEAD - Manage Groups -======= Manage Groups ->>>>>>> c9fad7b79c346875a636122fdc7514814180dbc7 -- 2.39.5 From 2b3834ac1010b534456ad018deb47200da599ce2 Mon Sep 17 00:00:00 2001 From: Faheedkhan Date: Thu, 26 Jun 2025 18:59:08 +0300 Subject: [PATCH 12/12] Update On po upload --- inventory/signals.py | 8 ++++++++ inventory/views.py | 8 +------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/inventory/signals.py b/inventory/signals.py index a37a1b4c..20a42738 100644 --- a/inventory/signals.py +++ b/inventory/signals.py @@ -13,6 +13,7 @@ from django_ledger.models import ( TransactionModel, LedgerModel, AccountModel, + PurchaseOrderModel ) from . import models from django.utils.timezone import now @@ -892,3 +893,10 @@ def update_finance_cost(sender, instance, created, **kwargs): # save_journal(instance,ledger,vendor) # else: # save_journal(instance,ledger,vendor) + +@receiver(post_save, sender=PurchaseOrderModel) +def create_po_item_upload(sender,instance,created,**kwargs): + if instance.po_status == "fulfilled": + for item in instance.get_itemtxs_data()[0]: + dealer = models.Dealer.objects.get(entity=instance.entity) + models.PoItemsUploaded.objects.create(dealer=dealer,po=instance, item=item, status="fulfilled") diff --git a/inventory/views.py b/inventory/views.py index 5f73ce2a..fbb24d4c 100644 --- a/inventory/views.py +++ b/inventory/views.py @@ -9535,13 +9535,7 @@ class PurchaseOrderMarkAsApprovedView(BasePurchaseOrderActionActionView): class PurchaseOrderMarkAsFulfilledView(BasePurchaseOrderActionActionView): action_name = "mark_as_fulfilled" - - def get(self, request, dealer_slug, entity_slug, po_pk, *args, **kwargs): - po = get_object_or_404(PurchaseOrderModel, pk=po_pk) - for item in po.get_itemtxs_data()[0]: - models.PoItemsUploaded.objects.create(po=po, item=item, status="fulfilled") - return super().get(request, dealer_slug, entity_slug, po_pk, *args, **kwargs) - + class PurchaseOrderMarkAsCanceledView(BasePurchaseOrderActionActionView): action_name = "mark_as_canceled" -- 2.39.5