From 0ee526e8065e81a60e8eeacc4697118ddc559c4b Mon Sep 17 00:00:00 2001 From: Faheed Date: Thu, 18 Sep 2025 19:37:40 +0300 Subject: [PATCH] estimateforcarform queryset update --- inventory/forms.py | 2 +- inventory/views.py | 2 +- templates/inventory/car_detail.html | 2 +- templates/purchase_orders/includes/card_po.html | 2 +- templates/purchase_orders/po_confirm_delete.html | 6 ++++-- templates/purchase_orders/po_delete.html | 6 ++++-- templates/sales/estimates/sale_order_form.html | 3 ++- 7 files changed, 14 insertions(+), 9 deletions(-) diff --git a/inventory/forms.py b/inventory/forms.py index d5a34498..52c69ed6 100644 --- a/inventory/forms.py +++ b/inventory/forms.py @@ -2268,7 +2268,7 @@ class CarDealershipRegistrationForm(forms.ModelForm): class CarDetailsEstimateCreate(forms.Form): customer = forms.ModelChoiceField( - queryset=Customer.objects.all(), + queryset=Customer.objects.filter(active=True), required=True, label="Customer", widget=forms.Select(attrs={"class": "form-control"}), diff --git a/inventory/views.py b/inventory/views.py index 2a3326c4..1f3b1de4 100644 --- a/inventory/views.py +++ b/inventory/views.py @@ -5005,7 +5005,7 @@ def create_estimate(request, dealer_slug, slug=None): customer = opportunity.customer print(customer) form.fields["customer"].queryset = models.Customer.objects.filter( - pk=customer.pk + pk=customer.pk ) form.initial["customer"] = customer diff --git a/templates/inventory/car_detail.html b/templates/inventory/car_detail.html index e6c88c50..a0c300fd 100644 --- a/templates/inventory/car_detail.html +++ b/templates/inventory/car_detail.html @@ -75,7 +75,7 @@ {% endif %} - {% if car.ready %} + {% if car.ready and car.status != 'sold' %}
- {% trans "Cancel" %}
{% endblock %} + diff --git a/templates/purchase_orders/po_delete.html b/templates/purchase_orders/po_delete.html index bfd337aa..28f22968 100644 --- a/templates/purchase_orders/po_delete.html +++ b/templates/purchase_orders/po_delete.html @@ -18,8 +18,8 @@ Purchase Order {{ po_model.po_number }}?{% endblocktrans %}

- {% trans "All transactions associated with this Purchase Order will be deleted. - If you want to void the PO instead," %} {% trans "click here" %}

@@ -33,3 +33,5 @@
{% endblock %} + + diff --git a/templates/sales/estimates/sale_order_form.html b/templates/sales/estimates/sale_order_form.html index 80d7cefe..0d834097 100644 --- a/templates/sales/estimates/sale_order_form.html +++ b/templates/sales/estimates/sale_order_form.html @@ -28,7 +28,7 @@ {% trans 'Save' %} - {% trans "Cancel" %} @@ -40,3 +40,4 @@ {% endblock content %} +