Merge branch 'main' of http://10.10.1.136:3000/ismail/haikal into frontend
This commit is contained in:
commit
981e826d11
@ -5122,9 +5122,9 @@ class EstimatePrintView(EstimateDetailView):
|
||||
It reuses the data-fetching logic from EstimateDetailView but
|
||||
uses a dedicated, stripped-down print template.
|
||||
"""
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
|
||||
self.object = self.get_object()
|
||||
@ -5132,20 +5132,20 @@ class EstimatePrintView(EstimateDetailView):
|
||||
|
||||
|
||||
# lang = request.GET.get('lang', 'ar')
|
||||
|
||||
|
||||
|
||||
|
||||
if request.GET.get('lang')=='en':
|
||||
template_path = "sales/estimates/estimate_preview_en.html"
|
||||
template_path = "sales/estimates/estimate_preview_en.html"
|
||||
else:
|
||||
template_path = "sales/estimates/estimate_preview_ar.html"
|
||||
|
||||
|
||||
|
||||
|
||||
html_string = render_to_string(template_path, context)
|
||||
|
||||
|
||||
base_url = request.build_absolute_uri('/')
|
||||
pdf_file = HTML(string=html_string, base_url=base_url).write_pdf()
|
||||
|
||||
|
||||
|
||||
|
||||
response = HttpResponse(pdf_file, content_type='application/pdf')
|
||||
response['Content-Disposition'] = f'attachment; filename="estimate_{self.object.estimate_number}.pdf"'
|
||||
|
||||
@ -5891,32 +5891,32 @@ class InvoicePreviewView(LoginRequiredMixin, PermissionRequiredMixin, DetailView
|
||||
kwargs["customer_obj"]=invoice.customer.customer_set.first()
|
||||
return super().get_context_data(**kwargs)
|
||||
def get(self, request, *args, **kwargs):
|
||||
|
||||
|
||||
self.object = self.get_object()
|
||||
context = self.get_context_data(object=self.object)
|
||||
|
||||
|
||||
|
||||
|
||||
# lang = request.GET.get('lang', 'ar')
|
||||
|
||||
|
||||
|
||||
|
||||
if request.GET.get('lang')=='en':
|
||||
template_path = "sales/invoices/invoice_preview_en.html"
|
||||
template_path = "sales/invoices/invoice_preview_en.html"
|
||||
elif request.GET.get('lang')=='ar':
|
||||
template_path = "sales/invoices/invoice_preview_ar.html"
|
||||
else:
|
||||
# just for preview not for download
|
||||
return render(request,'sales/invoices/invoice_preview.html',context)
|
||||
|
||||
|
||||
|
||||
|
||||
html_string = render_to_string(template_path, context)
|
||||
|
||||
|
||||
base_url = request.build_absolute_uri('/')
|
||||
pdf_file = HTML(string=html_string, base_url=base_url).write_pdf()
|
||||
|
||||
|
||||
|
||||
|
||||
response = HttpResponse(pdf_file, content_type='application/pdf')
|
||||
response['Content-Disposition'] = f'attachment; filename="invoice_{self.object.invoice_number}.pdf"'
|
||||
|
||||
|
||||
return response
|
||||
|
||||
|
||||
@ -8177,8 +8177,13 @@ class BillModelCreateView(LoginRequiredMixin, PermissionRequiredMixin,SuccessMes
|
||||
return {"date_draft": get_localdate()}
|
||||
|
||||
def get_form(self, form_class=None):
|
||||
# form = super().get_form(form_class)
|
||||
dealer = get_object_or_404(models.Dealer, slug=self.kwargs["dealer_slug"])
|
||||
return BillModelCreateForm(entity_model=dealer.entity, **self.get_form_kwargs())
|
||||
form = BillModelCreateForm(entity_model=dealer.entity, **self.get_form_kwargs())
|
||||
form.initial['prepaid_account'] = models.DealerSettings.objects.filter(dealer=dealer).first().bill_prepaid_account or None
|
||||
form.initial['unearned_account'] = models.DealerSettings.objects.filter(dealer=dealer).first().bill_unearned_account or None
|
||||
form.initial['cash_account'] = models.DealerSettings.objects.filter(dealer=dealer).first().bill_cash_account or None
|
||||
return form
|
||||
|
||||
def form_valid(self, form):
|
||||
dealer = get_object_or_404(models.Dealer, slug=self.kwargs["dealer_slug"])
|
||||
@ -8281,7 +8286,19 @@ class BillModelCreateView(LoginRequiredMixin, PermissionRequiredMixin,SuccessMes
|
||||
"bill_pk": bill_model.uuid,
|
||||
},
|
||||
)
|
||||
|
||||
def get_queryset(self):
|
||||
qs = super().get_queryset()
|
||||
return qs.select_related(
|
||||
"ledger",
|
||||
"ledger__entity",
|
||||
"vendor",
|
||||
"cash_account",
|
||||
"prepaid_account",
|
||||
"unearned_account",
|
||||
"cash_account__coa_model",
|
||||
"prepaid_account__coa_model",
|
||||
"unearned_account__coa_model",
|
||||
)
|
||||
|
||||
class BillModelDetailView(BillModelDetailViewBase):
|
||||
template_name = "bill/bill_detail.html"
|
||||
@ -11086,11 +11103,11 @@ class PurchaseOrderDetailView(LoginRequiredMixin, PermissionRequiredMixin, Detai
|
||||
"purchase_orders/po_detail_ar_pdf.html",
|
||||
context
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
base_url = request.build_absolute_uri('/')
|
||||
pdf = HTML(string=html_string, base_url=base_url).write_pdf()
|
||||
|
||||
|
||||
response = HttpResponse(pdf, content_type="application/pdf")
|
||||
response["Content-Disposition"] = f'attachment; filename="PO_{self.object.po_number}.pdf"'
|
||||
return response
|
||||
|
||||
@ -48,7 +48,7 @@
|
||||
<h5 class="fw-bold mb-2">{% trans 'Description' %}</h5>
|
||||
<div class="p-3 bg-light rounded-3">{{ ticket.description|linebreaks }}</div>
|
||||
</div>
|
||||
{% if ticket.resolution_notes %}
|
||||
{% if ticket.resolution_notes %}
|
||||
<div class="mb-4">
|
||||
<h5 class="fw-bold mb-2">{% trans 'Resolution Notes' %}</h5>
|
||||
<div class="p-3 bg-light rounded-3">{{ ticket.resolution_notes|linebreaks }}</div>
|
||||
|
||||
@ -87,7 +87,7 @@
|
||||
<i class="fa-solid fa-eye me-1"></i>
|
||||
{% trans "View" %}
|
||||
</a> {% endcomment %}
|
||||
|
||||
|
||||
<div class="btn-reveal-trigger position-static">
|
||||
<button class="btn btn-sm dropdown-toggle dropdown-caret-none transition-none btn-reveal fs-10"
|
||||
type="button"
|
||||
@ -103,15 +103,10 @@
|
||||
href="{% url 'ticket_detail' request.dealer.slug ticket.id %}">
|
||||
<i class="fa fa-eye me-2"></i>{% trans "View" %}
|
||||
</a>
|
||||
<a class="dropdown-item"
|
||||
href="{% url 'ticket_update' ticket.id%}">
|
||||
<i class="fa fa-edit me-2"></i>{% trans "Update" %}
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user