diff --git a/inventory/models.py b/inventory/models.py index 223d8f40..e2653559 100644 --- a/inventory/models.py +++ b/inventory/models.py @@ -48,7 +48,7 @@ from imagekit.models import ImageSpecField from imagekit.processors import ResizeToFill # from plans.models import AbstractPlan # from simple_history.models import HistoricalRecords - +from plans.models import Invoice class Base(models.Model): id = models.UUIDField( @@ -1262,6 +1262,9 @@ class Dealer(models.Model, LocalizedNameMixin): def __str__(self): return self.name + @property + def invoices(self): + return Invoice.objects.filter(order__user=self.user) class StaffTypes(models.TextChoices): # MANAGER = "manager", _("Manager") diff --git a/inventory/signals.py b/inventory/signals.py index dfc90c1f..30ee0c29 100644 --- a/inventory/signals.py +++ b/inventory/signals.py @@ -502,7 +502,7 @@ def create_item_service(sender, instance, created, **kwargs): """ if created: entity = instance.dealer.entity - uom = entity.get_uom_all().get(name=str(instance.uom).lower()) + uom = entity.get_uom_all().filter(unit_abbr=instance.uom).first() cogs = ( entity.get_all_accounts() .filter(role=roles.COGS, active=True, role_default=True) diff --git a/inventory/utils.py b/inventory/utils.py index 7aca476f..8ffbfe09 100644 --- a/inventory/utils.py +++ b/inventory/utils.py @@ -1094,16 +1094,13 @@ class CarFinanceCalculator: total_vat_amount = total_price_discounted * self.vat_rate return { - "total_price_before_discount": round( - total_price, 2 - ), - "total_price": round(total_price_discounted, 2), - "total_vat_amount": round(total_vat_amount, 2), - "total_discount": round(Decimal(total_discount)), - "total_additionals": round(total_additionals, 2), - "grand_total": round( - total_price_discounted + total_vat_amount + total_additionals, 2 - ), + "total_price_discounted":total_price_discounted, + "total_price_before_discount":total_price, + "total_price": total_price_discounted, + "total_vat_amount": total_vat_amount, + "total_discount": Decimal(total_discount), + "total_additionals": total_additionals, + "grand_total":total_price_discounted + total_vat_amount + total_additionals, } def get_finance_data(self): @@ -1114,6 +1111,7 @@ class CarFinanceCalculator: self._get_quantity(item) for item in self.item_transactions ), "total_price": totals["total_price"], + "total_price_discounted": totals["total_price_discounted"], "total_price_before_discount": totals["total_price_before_discount"], "total_vat": totals["total_vat_amount"] + totals["total_price"], "total_vat_amount": totals["total_vat_amount"], diff --git a/inventory/views.py b/inventory/views.py index 39cb9a47..130ebb37 100644 --- a/inventory/views.py +++ b/inventory/views.py @@ -7204,6 +7204,7 @@ class ItemServiceCreateView( def form_valid(self, form): dealer = get_user_type(self.request) vat = models.VatRate.objects.get(dealer=dealer, is_active=True) + form.instance.dealer = dealer # if form.instance.taxable: # form.instance.price = (form.instance.price * vat.rate) + form.instance.price @@ -7253,7 +7254,11 @@ class ItemServiceUpdateView( def form_valid(self, form): dealer = get_user_type(self.request) vat = models.VatRate.objects.get(dealer=dealer, is_active=True) + uom = dealer.entity.get_uom_all().filter(unit_abbr=form.instance.uom).first() form.instance.dealer = dealer + form.instance.uom = uom.name + form.instance.item.uom = uom + # if form.instance.taxable: # form.instance.price = (form.instance.price * vat.rate) + form.instance.price return super().form_valid(form) @@ -10607,7 +10612,7 @@ def purchase_report_view(request,dealer_slug): po_quantity=0 for item in items: po_amount+=item["total"] - po_quantity+=item["q"] + po_quantity+=item["q"] total_po_amount+=po_amount total_po_cars+=po_quantity diff --git a/static/images/no_content/no_search_results.png b/static/images/no_content/no_search_results.png new file mode 100644 index 00000000..a360db49 Binary files /dev/null and b/static/images/no_content/no_search_results.png differ diff --git a/templates/account/signup-wizard.html b/templates/account/signup-wizard.html index 52dac1a7..e96b99c5 100644 --- a/templates/account/signup-wizard.html +++ b/templates/account/signup-wizard.html @@ -282,9 +282,9 @@ -
+ {% include 'footer.html' %} -
+ {% endblock content %} {% block customJS %} diff --git a/templates/crm/leads/lead_list.html b/templates/crm/leads/lead_list.html index fafcb832..926654d4 100644 --- a/templates/crm/leads/lead_list.html +++ b/templates/crm/leads/lead_list.html @@ -5,7 +5,8 @@ {{ _("Leads") |capfirst }} {% endblock title %} {% block content %} -{% if page_obj.object_list %} + +{% if page_obj.object_list or request.GET.q%}

{{ _("Leads") |capfirst }} diff --git a/templates/crm/opportunities/opportunity_list.html b/templates/crm/opportunities/opportunity_list.html index 5991dbec..c1f17a56 100644 --- a/templates/crm/opportunities/opportunity_list.html +++ b/templates/crm/opportunities/opportunity_list.html @@ -5,7 +5,7 @@ {{ _("Opportunities") }} {% endblock title %} {% block content %} - {% if opportunities %} + {% if opportunities or request.GET.q%}

diff --git a/templates/customers/customer_list.html b/templates/customers/customer_list.html index be208c67..e532fd84 100644 --- a/templates/customers/customer_list.html +++ b/templates/customers/customer_list.html @@ -6,7 +6,7 @@ {% endblock title %} {% block vendors %}{{ _("Customers") |capfirst }}{% endblock %} {% block content %} -{% if customers %} +{% if customers or request.GET.q%}

{{ _("Customers") |capfirst }} diff --git a/templates/customers/view_customer.html b/templates/customers/view_customer.html index cbd38052..4dbb73ed 100644 --- a/templates/customers/view_customer.html +++ b/templates/customers/view_customer.html @@ -11,7 +11,7 @@
-

{% trans 'Customer details' %}

+

{% trans 'Customer details' %}
  • @@ -127,20 +127,16 @@
    + -
    +
    - + - - - - - - + + + @@ -148,44 +144,69 @@ {% for lead in leads %} - + + {% for estimate in lead.customer.customer_model.estimatemodel_set.all %} +

    #{{forloop.counter }}{{estimate}}

    + + + +
    {% trans 'Leads'|upper %}{% trans 'Opportunities'|upper %}{% trans 'Estimates'|upper %}{% trans 'Sale orders'|upper %}{% trans 'Invoices'|upper %}{% trans 'Car'|upper %}{% trans 'Leads'|upper %}{% trans 'Opportunities'|upper %}{% trans 'Estimates'|upper %}
    {{lead}} ({{ forloop.counter }}){{lead.opportunity}} ({{ forloop.counter }}){{lead.opportunity}} ({{ forloop.counter }}) - - {% for estimate in lead.customer.customer_model.estimatemodel_set.all %} - -
    - {% endfor %} -
    + + + + + + + + + + + + - - + + + + +
    {% trans 'Sale orders'|upper %}{% trans 'Invoices'|upper %}{% trans 'Car VIN'|upper %}
    + {% for sale_order in estimate.sale_orders.all %} + + + {% endfor %} + - {% for estimate in lead.customer.customer_model.estimatemodel_set.all %} - -
    - {% endfor %} -
    - {% for invoice in lead.customer.customer_model.invoicemodel_set.all %} + + {% for invoice in estimate.invoicemodel_set.all %} - {% if invoice.is_paid %} - - - - {%else%} - - - - {% endif %} + {% if invoice.is_paid %} + + + + {%else%} + + + + {% endif %} -
    - {% endfor %} + + {% endfor %} +
    + + + + + + + +
    +
    + {% endfor %} - - {% for estimate in lead.customer.customer_model.invoicemodel_set.all %} - -
    - {% endfor %} - + + + + diff --git a/templates/dealers/dealer_detail.html b/templates/dealers/dealer_detail.html index 525520b7..45a078b9 100644 --- a/templates/dealers/dealer_detail.html +++ b/templates/dealers/dealer_detail.html @@ -7,6 +7,7 @@

    {% trans 'Profile' %}

    +
    diff --git a/templates/empty-illustration-page.html b/templates/empty-illustration-page.html index f6e687be..31d704ac 100644 --- a/templates/empty-illustration-page.html +++ b/templates/empty-illustration-page.html @@ -37,31 +37,33 @@ /* No specific styles for .btn-add-new or .message-box are needed here as per previous updates */ -
    + +
    - {% if image %} + {% if image %} {% static image as final_image_path %} - {% else %} - {% static 'images/no_content/no_item.jpg' as final_image_path %} - {% endif %} + {% else %} + {% static 'images/no_content/no_item.jpg' as final_image_path %} + {% endif %} No-empty-state-image -

    +

    {% blocktrans %}No {{ value}} Yet{% endblocktrans %} -

    +

    -

    +

    {% blocktrans %}It looks like you haven't added any {{ value }} to your account. Click the button below to get started and add your first {{ value }}!{% endblocktrans %} -

    +

    - + {% blocktrans %}Create New {{value}}{% endblocktrans %} - -
    + + +

    diff --git a/templates/groups/group_list.html b/templates/groups/group_list.html index 6d16d103..85110d8a 100644 --- a/templates/groups/group_list.html +++ b/templates/groups/group_list.html @@ -7,7 +7,7 @@ {% endblock title %} {% block content %} -{% if groups %} +{% if groups or request.GET.q%}
    diff --git a/templates/inventory/car_list_view.html b/templates/inventory/car_list_view.html index 18dca3c1..ffa5d3e2 100644 --- a/templates/inventory/car_list_view.html +++ b/templates/inventory/car_list_view.html @@ -25,7 +25,7 @@ {% endblock customCSS %} {% block content %} - {% if cars%} + {% if cars or request.GET.q%}
    diff --git a/templates/items/expenses/expenses_list.html b/templates/items/expenses/expenses_list.html index 7e015a4f..0f34ce85 100644 --- a/templates/items/expenses/expenses_list.html +++ b/templates/items/expenses/expenses_list.html @@ -6,7 +6,7 @@ {% block content %} -{% if expenses %} +{% if expenses or request.GET.q %}

    {% trans "Expenses" %}

    diff --git a/templates/items/service/service_list.html b/templates/items/service/service_list.html index 8b637f47..0de3164a 100644 --- a/templates/items/service/service_list.html +++ b/templates/items/service/service_list.html @@ -5,7 +5,7 @@ {% endblock title %} {% block content %} -{% if services %} +{% if services or request.GET.q %}

    {% trans "Services" %}

    diff --git a/templates/ledger/bills/bill_list.html b/templates/ledger/bills/bill_list.html index c3041657..383167c2 100644 --- a/templates/ledger/bills/bill_list.html +++ b/templates/ledger/bills/bill_list.html @@ -11,7 +11,7 @@ {% endblock %} {% block content %} -{% if bills %} +{% if bills or request.GET.q%}

    {% trans "Bills" %}

    diff --git a/templates/ledger/coa_accounts/account_list.html b/templates/ledger/coa_accounts/account_list.html index b3f5730a..6c49cae8 100644 --- a/templates/ledger/coa_accounts/account_list.html +++ b/templates/ledger/coa_accounts/account_list.html @@ -12,7 +12,7 @@ {% block content %} -{% if accounts%} +{% if accounts or request.GET.q%}

    {% trans "Accounts" %}

    diff --git a/templates/ledger/journal_entry/journal_entry_list.html b/templates/ledger/journal_entry/journal_entry_list.html index ccc34484..0f43d8ef 100644 --- a/templates/ledger/journal_entry/journal_entry_list.html +++ b/templates/ledger/journal_entry/journal_entry_list.html @@ -5,7 +5,7 @@ {% endblock title %} {% block content %} -{% if journal_entries %} +{% if journal_entries or request.GET.q%} + {% if unit_model and entity %} +
    {% period_navigation 'unit-cf' %}
    {% elif entity %} -
    {% period_navigation 'entity-cf' %}
    +
    {% period_navigation 'entity-cf' %}
    {% elif ledger %} -
    {% period_navigation 'ledger-cf' %}
    +
    {% period_navigation 'ledger-cf' %}
    {% elif unit_model %} -
    {% period_navigation 'unit-cf' %}
    - {% endif %} - {% endblock %} +
    {% period_navigation 'unit-cf' %}
    + {% endif %} + {% endblock period_navigation %} {% block content %}
    diff --git a/templates/ledger/reports/purchase_report.html b/templates/ledger/reports/purchase_report.html index be2a0f0b..e72b97e2 100644 --- a/templates/ledger/reports/purchase_report.html +++ b/templates/ledger/reports/purchase_report.html @@ -70,10 +70,10 @@ {% for po in data %} {{po.po_number}} - {{po.po_created}} + {{po.po_created|date}} {{po.po_status}} {{po.po_amount}} - {{po.date_fulfilled}} + {{po.po_fulfilled_date}} staff {{po.po_quantity}} diff --git a/templates/message-illustration.html b/templates/message-illustration.html index d763d8ba..720992ff 100644 --- a/templates/message-illustration.html +++ b/templates/message-illustration.html @@ -71,7 +71,7 @@