diff --git a/inventory/models.py b/inventory/models.py index 48b3c6b5..80ecd91a 100644 --- a/inventory/models.py +++ b/inventory/models.py @@ -3,7 +3,7 @@ import uuid from datetime import datetime from django.conf import settings from django.contrib.auth.models import Permission -from inventory.validators import SaudiPhoneNumberValidator, vat_rate_validator +from inventory.validators import SaudiPhoneNumberValidator from decimal import Decimal from django.urls import reverse from django.utils.text import slugify @@ -206,7 +206,7 @@ class UnitOfMeasure(models.TextChoices): class VatRate(models.Model): dealer = models.ForeignKey("Dealer", on_delete=models.CASCADE) - rate = models.DecimalField(max_digits=5, decimal_places=2, default=Decimal("0.15"),validators=[vat_rate_validator]) + rate = models.DecimalField(max_digits=5, decimal_places=2, default=Decimal("0.15")) is_active = models.BooleanField(default=True) created_at = models.DateTimeField(auto_now_add=True) diff --git a/inventory/views.py b/inventory/views.py index 1d2b5f40..928792a3 100644 --- a/inventory/views.py +++ b/inventory/views.py @@ -2357,7 +2357,6 @@ def dealer_vat_rate_update(request, slug): redirect("dealer_detail", slug=slug) return redirect("dealer_detail", slug=slug) - class DealerUpdateView( diff --git a/templates/crm/opportunities/opportunity_form.html b/templates/crm/opportunities/opportunity_form.html index 4eb2fcef..f264fdd4 100644 --- a/templates/crm/opportunities/opportunity_form.html +++ b/templates/crm/opportunities/opportunity_form.html @@ -1,7 +1,6 @@ {% extends 'base.html' %} {% load i18n static widget_tweaks custom_filters %} {% block title %} - {# Check if an 'object' exists in the context #} {% if object %} {% trans 'Update Opportunity' %} {% else %} @@ -27,99 +26,112 @@ +
{% csrf_token %} - {% if form.non_field_errors %}
{{ form.non_field_errors }}
{% endif %} - -
- - {{ form.lead|add_class:"form-control" }} - {% if form.lead.errors %}
{{ form.lead.errors }}
{% endif %} -
- -
- - {{ form.car|add_class:"form-control" }} - {% if form.car.errors %}
{{ form.car.errors }}
{% endif %} -
- -
- - {{ form.stage|add_class:"form-control" }} - {% if form.stage.errors %}
{{ form.stage.errors }}
{% endif %} -
- - {% comment %}
- -
- - {{ form.amount|add_class:"form-control" }} + {% if form.non_field_errors %} +
{{ form.non_field_errors }}
+ {% endif %} + +
{% trans "Main Information" %}
+
+
+ + {{ form.lead|add_class:"form-control form-select" }} + {% if form.lead.errors %}
{{ form.lead.errors }}
{% endif %}
- {% if form.amount.errors %}
{{ form.amount.errors }}
{% endif %} -
{% endcomment %} - - {% comment %}
- -
- - - {{ form.probability.value|default:'50' }}% - +
+ + {{ form.car|add_class:"form-control form-select" }} + {% if form.car.errors %}
{{ form.car.errors }}
{% endif %} +
+
+ + {{ form.stage|add_class:"form-control form-select" }} + {% if form.stage.errors %}
{{ form.stage.errors }}
{% endif %} +
+
+ +
+ {{ form.expected_close_date|add_class:"form-control" }} + +
+ {% if form.expected_close_date.errors %} +
{{ form.expected_close_date.errors }}
+ {% endif %}
- {% if form.probability.errors %}
{{ form.probability.errors }}
{% endif %}
- -
- -
- - {{ form.expected_revenue|add_class:"form-control" }} -
- {% if form.expected_revenue.errors %} -
{{ form.expected_revenue.errors }}
- {% endif %} -
{% endcomment %} - + {% comment %}
- -
- {{ form.expected_close_date|add_class:"form-control" }} - +
{% trans "Financial Information" %}
+
+
+ +
+ SAR + {{ form.amount|add_class:"form-control border-start-0" }} +
+ {% if form.amount.errors %} +
{{ form.amount.errors }}
+ {% endif %} +
+
+ +
+ + + {{ form.probability.value|default:'50' }}% + +
+ {% if form.probability.errors %} +
{{ form.probability.errors }}
+ {% endif %} +
+
+ +
+ SAR + {{ form.expected_revenue|add_class:"form-control" }} +
+ {% if form.expected_revenue.errors %} +
{{ form.expected_revenue.errors }}
+ {% endif %} +
- {% if form.expected_close_date.errors %} -
{{ form.expected_close_date.errors }}
- {% endif %}
- -
+ {% endcomment %} +
@@ -135,17 +147,20 @@
+

{% trans "Opportunity Guidelines" %}

- -{% endblock %} + +{% endblock %} \ No newline at end of file diff --git a/templates/inventory/car_detail.html b/templates/inventory/car_detail.html index 7cc24ee3..4b8b0c68 100644 --- a/templates/inventory/car_detail.html +++ b/templates/inventory/car_detail.html @@ -262,7 +262,11 @@ {% if car.marked_price %} {% trans "Cost Price"|capfirst %} + {% if request.is_dealer or request.is_accountant or request.manager%} {{ car.cost_price|floatformat:2 }} + {% else %} + {{ car.cost_price|floatformat:2 }} + {% endif %} {% trans "Marked Price"|capfirst %} @@ -270,7 +274,7 @@ - {% if perms.django_ledger.view_ledgermodel %} + {% if perms.django_ledger.change_ledgermodel %} {% if not car.get_transfer %} - {% trans "Save and Add Another" %} + {% trans "Add to Inventory" %} - + {% endcomment %}