bug fixes and updates

This commit is contained in:
ismail 2025-09-24 09:49:07 +03:00
parent f7a5c9b05c
commit 7bf7e51c09
9 changed files with 34 additions and 11 deletions

View File

@ -411,6 +411,22 @@ class BasePurchaseOrderActionActionView(
f"while performing action '{self.action_name}' on Purchase Order ID: {po_model.pk}. "
f"Error: {e}"
)
except Exception as e:
print(
f"User {user_username} encountered an exception "
f"while performing action '{self.action_name}' on Purchase Order ID: {po_model.pk}. "
f"Error: {e}"
)
logger.warning(
f"User {user_username} encountered an exception "
f"while performing action '{self.action_name}' on Purchase Order ID: {po_model.pk}. "
f"Error: {e}"
)
messages.add_message(
request,
message=f"Failed to update PO {po_model.po_number}. {e}",
level=messages.ERROR,
)
return response

View File

@ -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
@ -11161,9 +11161,9 @@ class PurchaseOrderModelDeleteView(PurchaseOrderModelDeleteViewBase):
level=messages.SUCCESS,
)
return reverse(
"purchase_order_list", kwargs={"dealer_slug": self.kwargs["dealer_slug"],"entity_slug":self.kwargs['entity_slug']}
"purchase_order_list", kwargs={"dealer_slug": self.kwargs["dealer_slug"], "entity_slug": self.kwargs["entity_slug"]}
)
class PurchaseOrderMarkAsDraftView(BasePurchaseOrderActionActionView):

View File

@ -22,6 +22,7 @@
hx-target="#notesTable"
hx-on::after-request="{ resetSubmitButton(document.querySelector('.add_note_form button[type=submit]')); $('#noteModal').modal('hide'); }"
hx-swap="outerHTML show:window.top"
hx-select-oob="#timeline"
method="post"
class="add_note_form">
{% csrf_token %}

View File

@ -22,7 +22,7 @@
hx-target=".taskTable"
hx-on::after-request="{ resetSubmitButton(document.querySelector('.add_schedule_form button[type=submit]')); $('#scheduleModal').modal('hide'); }"
hx-swap="outerHTML"
hx-select-oob="#toast-container:outerHTML"
hx-select-oob="#toast-container:outerHTML,#timeline:outerHTML"
method="post"
class="add_schedule_form">
{% csrf_token %}

View File

@ -335,7 +335,7 @@
</div>
<div class="row justify-content-between align-items-md-center hover-actions-trigger btn-reveal-trigger border-translucent py-3 gx-0 border-top">
<div class="col-12 col-lg-auto">
<div class="timeline-basic mb-9">
<div id="timeline" class="timeline-basic mb-9">
{% for activity in activities %}
<div class="timeline-item">
<div class="row g-3">
@ -353,7 +353,9 @@
{% elif activity.activity_type == "visit" %}
<span class="fa-solid fa-users text-danger fs-8"></span>
{% elif activity.activity_type == "whatsapp" %}
<span class="fab fa-whatsapp text-success-dark fs-7"></span>
<span class="fab fa-whatsapp text-success-dark fs-7"></span>
{% elif activity.activity_type == "meeting" %}
<span class="fa-solid fa-users text-danger fs-8"></span>
{% endif %}
</div>
{% if forloop.last %}

View File

@ -542,7 +542,7 @@
data-bs-dismiss="modal"
aria-label="Close"></button>
</div>
<div id="estimateModalBody" class="main-modal-body" style="padding: 20px;">
<div id="estimateModalBody" style="padding: 20px;">
<form action="{% url 'create_estimate_for_car' request.dealer.slug car.slug %}" method="post">
{% csrf_token %}
{{estimate_form|crispy}}

View File

@ -49,6 +49,8 @@
<span class="badge badge-phoenix badge-phoenix-success">
{% elif bill.is_canceled %}
<span class="badge badge-phoenix badge-phoenix-danger">
{% elif bill.is_void %}
<span class="badge badge-phoenix badge-phoenix-secondary">
{% endif %}
{{ bill.bill_status }}
</span>

View File

@ -155,12 +155,14 @@
</div>
{% endif %}
{% endif %}
{% if po_model.can_void %}
{% comment %} TODO: upgrade djnago ledger or replace core functionality {% endcomment %}
{% comment %} issue with django ledger base functionality when marking as void throughs error , will be fix in future {% endcomment %}
{% comment %} {% if po_model.can_void %}
<button class="btn btn-phoenix-danger"
onclick="showPOModal('{% trans "Void Purchase Order" %}', '{% url 'po-action-mark-as-void' request.dealer.slug entity_slug po_model.pk %}', 'Mark As Void')">
<i class="fas fa-times-circle me-2"></i>{% trans 'Void' %}
</button>
{% endif %}
{% endif %} {% endcomment %}
{% if po_model.can_cancel %}
<button class="btn btn-phoenix-secondary"
onclick="showPOModal('Cancel PO', '{% url 'po-action-mark-as-canceled' request.dealer.slug entity_slug po_model.pk %}', 'Mark As Cancelled')">

View File

@ -32,8 +32,8 @@
</button>
{% endif %}
</th>
<th>{% trans 'Unit Cost' %}</th>
<th>{% trans 'Quantity' %}</th>
<th>{% trans 'Unit Cost' %}</th>
<th>{% trans 'Unit' %}</th>
<th class="text-end">{% trans 'Amount' %}</th>
<th>{% trans 'Status' %}</th>
@ -52,8 +52,8 @@
{{ f.item_model|add_class:"form-control" }}
{% if f.errors %}<div class="text-danger small">{{ f.errors }}</div>{% endif %}
</td>
<td id="{{ f.instance.html_id_unit_cost }}">{{ f.po_unit_cost|add_class:"form-control" }}</td>
<td id="{{ f.instance.html_id_quantity }}">{{ f.po_quantity|add_class:"form-control" }}</td>
<td id="{{ f.instance.html_id_unit_cost }}">{{ f.po_unit_cost|add_class:"form-control" }}</td>
<td>{{ f.entity_unit|add_class:"form-control" }}</td>
<td class="text-end" id="{{ f.instance.html_id_total_amount }}">
<span class="currency">{{ CURRENCY }}</span>{{ f.instance.po_total_amount | currency_format }}