From 2671db939a51741d19ee62166cc7ef0105a12fbb Mon Sep 17 00:00:00 2001 From: Marwan Alwali Date: Mon, 24 Feb 2025 14:35:10 +0300 Subject: [PATCH] update --- inventory/__pycache__/views.cpython-311.pyc | Bin 217619 -> 217645 bytes .../custom_filters.cpython-311.pyc | Bin 15110 -> 15532 bytes inventory/templatetags/custom_filters.py | 9 ++- inventory/views.py | 8 +-- templates/customers/note_form.html | 10 +--- templates/customers/view_customer.html | 55 ++++++++++++------ templates/dashboards/manager.html | 6 +- templates/ledger/reports/dashboard-copy.html | 1 - .../sales/estimates/estimate_detail.html | 6 +- 9 files changed, 59 insertions(+), 36 deletions(-) diff --git a/inventory/__pycache__/views.cpython-311.pyc b/inventory/__pycache__/views.cpython-311.pyc index 5e9e082211d77e8bc1e2867b3fe302aa442e70f5..38d47dd99ff1c567be56833c6fd70da6858c6bb8 100644 GIT binary patch delta 1028 zcma)*TWnNS6o%*9XXZ>>W`Npu3Qf}?HdwWnbhNRRODTaS6sBAfAws<%VLC#MwyA+g zVoNVb14vq%c2h703-qGB5i3h@GzK-M55~rb!C+!XLy%Oo4JJI|K2D+!zPKOOK70M^ z{A=xhuho6tKYHH3aM15hahY|dFc!Vh*R^m7FJH`C>Pw4+_kPvx8ZgNF4(zP9bv{|= zqr=T-dfR}?(DB9OS~KZcIysd}X7rX+LS}18rTvi%Pv)HK{}?HHfMG?ZTu-OWB2QA6 z(B!2|I)emlUX_XE9E5s#IFAJur={dkY81n|vw)B2m#RX-Fe$x7R4dOH9+#_8Zyiv9 z?qyG>=%f$>T$b?=UGTN6eVh^aL4GfxA70R1PtZY)WR+q;L~_dTSoQ(0p=eFquzV%A zRGn8(giL|utGJ@<;|^T=51ghST0=w~PQ+*v^O$_UhCY~(`n4pxxg>`wiMjbwN;i^c zaYH{}&ByARS2vUy5ks4~t$y})7k`)`p)K@yy?31q*U=NFNSF8yRx5s$;7;-tIeJqK zvvzKhi73*=RVqhzJ;NT1Y@a+!z@k9D+f5y$NyQ$bid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YoXdRqn6CFV}*B}|3A~?#fcI-UCnF%s*<^GPh?7|EPkHZhx3)HKlQK)&E4L5y_;0?oWX zQ}j=;fUka=eHDtba{-2>l{-Hbr(Y-W2?8=4i;9K|lA5k2w#T+ZCA%Y}!51lK5tYrg z_^KNctf)_r;UtTMS|^i4DhN>tritdAauUUxk|OFf$(=ks(1=lS^`G=eFoU3zb@<5x zUiML_)1E=rHFhWT3#RyS*GVzLQ>>B7nAt8k#UhdZdG37zZGp%6zX?r}3eUo3hRw66 z#BR36jJ;BtN)|k9n#^+4zYk7rU>Bk{LB?=#9+}qYS5=;xZa>2-HMQ zn|ecqgr)$=R-{TehVzIzHw2Icu%ZZ#5sZ?O-5eYTPIsaJX(*6{=Sn_wI|7dj_+F4J z>o@=|pzuNQo8Gv%wFSwj1t@64x$m{n(V>xj$5#ZP?ZHjqB2fgtu}ELDp9F?0Q<#mP z%Yve#Z9OS$Ee`jsTcyiHUuBlf`^C%b;O6Ih8cE%8x{y&oRUXkX^oZ_F*hhRZykdb- zc4PCj=wQ1f4Q{(y(xt1})xczm2>=@lN~?T6TT=oEX)Y~> z%;;(Jn4=0Cj-%QnBw@~Qf|}Cwyb6Xit)=nH?+bo6m}fqn(nf=pnMxOQJS7wPWXiDO zK@Z3IhMS@oXfHyJfQHAY)3w=LS|wF;K&W#-bu@EcAgVk=e>r#K;Z{hid*E9XP=WL| Zc4XHm`)rr5`1P(eOQT>BLyrl#)xQ_Q_~rlr diff --git a/inventory/templatetags/custom_filters.py b/inventory/templatetags/custom_filters.py index 93e3ff05..69570a5c 100644 --- a/inventory/templatetags/custom_filters.py +++ b/inventory/templatetags/custom_filters.py @@ -2,6 +2,7 @@ from random import randint from django import template from calendar import month_abbr from django.urls import reverse +from django.utils.formats import number_format from django_ledger.io.io_core import get_localdate,validate_activity from django.conf import settings from django.utils.translation import get_language @@ -352,4 +353,10 @@ def date_picker(context, nav_url=None, date_picker_id=None): @register.filter def splitlines(value): """Splits text into lines""" - return value.splitlines() \ No newline at end of file + return value.splitlines() + +@register.filter(name='currency_format') +def currency_format(value): + if not value: + value = 0.00 + return number_format(value, decimal_pos=2, use_l10n=True, force_grouping=True) \ No newline at end of file diff --git a/inventory/views.py b/inventory/views.py index 08f9fd8f..ccbd3e2f 100644 --- a/inventory/views.py +++ b/inventory/views.py @@ -1280,15 +1280,14 @@ class CustomerDetailView(LoginRequiredMixin, DetailView): dealer = get_user_type(self.request) entity = dealer.entity context = super().get_context_data(**kwargs) - # customer = f"{context['customer'].first_name} {context['customer'].middle_name} {context['customer'].last_name}" - # context["estimates"] = entity.get_estimates().filter( - # customer__customer_name=name - # ) + estimates = entity.get_estimates().filter(customer=self.object) invoices = entity.get_invoices().filter(customer=self.object) + # txs = entity. transactions(customer=self.object) total = estimates.count() + invoices.count() context["estimates"] = estimates context["invoices"] = invoices + # context["txs"] = txs context["total"] = total @@ -2632,6 +2631,7 @@ def account_delete(request, pk): # Sales list +@login_required def sales_list_view(request): dealer = get_user_type(request) entity = dealer.entity diff --git a/templates/customers/note_form.html b/templates/customers/note_form.html index 19cd30fe..6e829d3c 100644 --- a/templates/customers/note_form.html +++ b/templates/customers/note_form.html @@ -1,11 +1,7 @@ {% load i18n static crispy_forms_filters %} - -
- + {% csrf_token %} {{ form|crispy }} - - - -
\ No newline at end of file + + \ No newline at end of file diff --git a/templates/customers/view_customer.html b/templates/customers/view_customer.html index cb3ad776..c6bcd194 100644 --- a/templates/customers/view_customer.html +++ b/templates/customers/view_customer.html @@ -1,5 +1,5 @@ {% extends "base.html" %} -{% load i18n static crispy_forms_filters%} +{% load i18n static crispy_forms_filters custom_filters%} {% block title %}{{ _("View Customer") }}{% endblock title %} @@ -41,7 +41,7 @@
-

{{ customer.additional_info }}

+

{{ customer.customer_name }}

{{ customer.created|timesince}}

@@ -105,30 +105,51 @@
-

{{ _("Cars") }} ({{ total }})

+

{{ _("Related") }} ({{ total }})

- - - - - - + + + + + - +{% for estimate in estimates %} - - - - - - + + + + + - +{% endfor %}
ORDERTOTALPAYMENT STATUSFULFILMENT STATUSDELIVERY TYPEDATE{% trans 'Type'|upper %}{% trans 'Total'|upper %}{% trans 'Payment Status'|upper %}{% trans 'Fulfilment Status'|upper %}{% trans 'Date'|upper %}
#2453$87PaidOrder FulfilledCash on deliveryDec 12, 12:56 PM +

{{ estimate.estimate_number }}

+
{{ estimate.revenue_estimate|currency_format }} + + Paid + + + + {% if estimate.status == 'draft' %} + {% trans "Draft" %} + {% elif estimate.status == 'in_review' %} + {% trans "In Review" %} + {% elif estimate.status == 'approved' %} + {% trans "Approved" %} + {% elif estimate.status == 'declined' %} + {% trans "Declined" %} + {% elif estimate.status == 'canceled' %} + {% trans "Canceled" %} + {% elif estimate.status == 'completed' %} + {% trans "Completed" %} + {% elif estimate.status == 'void' %} + {% trans "Void" %} + {% endif %} + {{ estimate.created }}
@@ -138,7 +159,7 @@
diff --git a/templates/dashboards/manager.html b/templates/dashboards/manager.html index a6b5f1d0..28b6a58a 100644 --- a/templates/dashboards/manager.html +++ b/templates/dashboards/manager.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% load i18n static %} +{% load i18n static custom_filters %} {% block content %} @@ -132,7 +132,7 @@
-

{{ total_selling_price }} {{ CURRENCY }}

+

{{ total_selling_price|currency_format }} {{ CURRENCY }}

@@ -147,7 +147,7 @@
-

{{ total_profit }} {{ CURRENCY }}

+

{{ total_profit|currency_format }} {{ CURRENCY }}

diff --git a/templates/ledger/reports/dashboard-copy.html b/templates/ledger/reports/dashboard-copy.html index a24843dd..4a61e25b 100644 --- a/templates/ledger/reports/dashboard-copy.html +++ b/templates/ledger/reports/dashboard-copy.html @@ -5,7 +5,6 @@ {% block content %}
-
diff --git a/templates/sales/estimates/estimate_detail.html b/templates/sales/estimates/estimate_detail.html index 3cc9e502..6a59290c 100644 --- a/templates/sales/estimates/estimate_detail.html +++ b/templates/sales/estimates/estimate_detail.html @@ -183,7 +183,7 @@ {% trans "Discount Amount" %} - - {{data.total_discount}} + - {{data.total_discount}} @@ -192,11 +192,11 @@ {% for service in data.additionals %} + {{service.name}} - {{service.total}}
{% endfor %} - + {% trans "Grand Total" %} - + {{data.grand_total}}