This commit is contained in:
Faheedkhan 2025-07-08 11:24:17 +03:00
parent 4bfb533448
commit 62356a997e
4 changed files with 68 additions and 59 deletions

View File

@ -2644,7 +2644,7 @@ class CustomGroup(models.Model):
allowed_models=[], allowed_models=[],
other_perms=[ other_perms=[
"view_purchaseordermodel", "view_purchaseordermodel",
"can_view_financials",
] ]
) )
###################################### ######################################
@ -2671,10 +2671,7 @@ class CustomGroup(models.Model):
"organization", "organization",
"notes", "notes",
"tasks", "tasks",
<<<<<<< HEAD
=======
"lead" "lead"
>>>>>>> 25d17efa11e8f03c6819b27572ca6abe91860d11
"activity", "activity",
], ],
other_perms=[ other_perms=[
@ -2704,14 +2701,7 @@ class CustomGroup(models.Model):
"carfinance", "carfinance",
"notes", "notes",
"tasks", "tasks",
"activity", "activity",],
<<<<<<< HEAD
"vendor"],
=======
"vendor",
"poitemsuploaded"
],
>>>>>>> 25d17efa11e8f03c6819b27572ca6abe91860d11
other_perms=[ other_perms=[
"view_car", "view_car",
"view_carlocation", "view_carlocation",

View File

@ -963,7 +963,7 @@ def create_po_fulfilled_notification(sender,instance,created,**kwargs):
@receiver(post_save, sender=models.Car) @receiver(post_save, sender=models.Car)
def car_created_notification(sender, instance, created, **kwargs): def car_created_notification(sender, instance, created, **kwargs):
if created: if created:
accountants = models.CustomGroup.objects.filter(dealer=instance.dealer,name__in=["Manager","Accountant"]).first().group.user_set.all() accountants = models.CustomGroup.objects.filter(dealer=instance.dealer,name__in=["Manager","Accountant","Inventory"]).first().group.user_set.all().distinct()
for accountant in accountants: for accountant in accountants:
models.Notification.objects.create( models.Notification.objects.create(
user=accountant, user=accountant,
@ -972,6 +972,9 @@ def car_created_notification(sender, instance, created, **kwargs):
<a href="{instance.get_absolute_url()}" target="_blank">View</a> <a href="{instance.get_absolute_url()}" target="_blank">View</a>
""", """,
) )
@receiver(post_save, sender=PurchaseOrderModel) @receiver(post_save, sender=PurchaseOrderModel)
def po_fullfilled_notification(sender, instance, created, **kwargs): def po_fullfilled_notification(sender, instance, created, **kwargs):
if instance.is_fulfilled(): if instance.is_fulfilled():
@ -994,7 +997,7 @@ def vendor_created_notification(sender, instance, created, **kwargs):
recipients = User.objects.filter( recipients = User.objects.filter(
groups__customgroup__dealer=instance.dealer, groups__customgroup__dealer=instance.dealer,
groups__customgroup__name__in=["Manager", "Inventory"] groups__customgroup__name__in=["Manager", "Inventory"]
) ).distinct()
for recipient in recipients: for recipient in recipients:
models.Notification.objects.create( models.Notification.objects.create(

View File

@ -8,45 +8,61 @@
<div class="container-fluid mt-4"> <div class="container-fluid mt-4">
<div class="row g-1"> <div class="row g-1">
<div class="col-lg-12">
<div class="d-flex flex-column gap-3"> <div class="col-lg-12 mb-3 ">
<div class="card"> <div class="row">
<div class="card-body">
{% include 'purchase_orders/includes/card_po.html' with dealer_slug=request.dealer.slug po_model=po_model entity_slug=entity_slug style='po-detail' %} <div class="col-9">
</div> <div class="card">
<div class="card-body">
{% include 'purchase_orders/includes/card_po.html' with dealer_slug=request.dealer.slug po_model=po_model entity_slug=entity_slug style='po-detail' %}
</div>
</div>
</div>
<div class='col-3'>
<div class="row">
<div class="col-12">
<div class="card mb-4">
<div class="card-body">
<div class="row text-center">
<div class="col-md-6 border-end">
<div class="p-2">
<h6 class="text-muted mb-2">{% trans 'PO Amount' %}</h6>
<h3 class="fw-light mb-0">
<span class="currency">{{CURRENCY}}</span>{{ po_model.po_amount | absolute | currency_format }}
</h3>
</div>
</div>
<div class="col-md-6">
<div class="p-2">
<h6 class="text-muted mb-2">{% trans 'Amount Received' %}</h6>
<h3 class="fw-light mb-0 text-success">
<span class="currency">{{CURRENCY}}</span>{{ po_model.po_amount_received | currency_format }}
</h3>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-12">
<a class="btn btn-phoenix-primary w-100 py-2"
href="{% url 'purchase_order_list' request.dealer.slug request.dealer.entity.slug %}">
<i class="fas fa-list me-2"></i>{% trans 'PO List' %}
</a>
</div>
</div>
</div> </div>
<a class="btn btn-phoenix-primary w-100 py-2" </div>
href="{% url 'purchase_order_list' request.dealer.slug request.dealer.entity.slug %}">
<i class="fas fa-list me-2"></i>{% trans 'PO List' %}
</a>
</div>
</div> </div>
<div class="col-lg-12">
<div class="card mb-4">
<div class="card-body">
<div class="row text-center">
<div class="col-md-6 border-end">
<div class="p-2">
<h6 class="text-muted mb-2">{% trans 'PO Amount' %}</h6>
<h3 class="fw-light mb-0">
<span class="currency">{{CURRENCY}}</span>{{ po_model.po_amount | absolute | currency_format }}
</h3>
</div>
</div>
<div class="col-md-6">
<div class="p-2">
<h6 class="text-muted mb-2">{% trans 'Amount Received' %}</h6>
<h3 class="fw-light mb-0 text-success">
<span class="currency">{{CURRENCY}}</span>{{ po_model.po_amount_received | currency_format }}
</h3>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-12"> <div class="col-lg-12">
<div class="table-responsive"> <div class="table-responsive">

View File

@ -9,22 +9,22 @@
<style> <style>
/* Custom styling */ /* Custom styling */
.form-section { .form-section {
background-color: #f8f9fa;
border-radius: 0.5rem; border-radius: 0.5rem;
padding: 1.5rem; padding: 1.5rem;
margin-bottom: 1.5rem; margin-bottom: 1.5rem;
} }
.form-section-header { .form-section-header {
border-bottom: 1px solid #dee2e6;
padding-bottom: 0.75rem; padding-bottom: 0.75rem;
margin-bottom: 1.5rem; margin-bottom: 1.5rem;
color: #0d6efd;
} }
.required-field::after { .required-field::after {
content: " *"; content: " *";
color: #dc3545;
} }
.search-select { .search-select {
@ -40,7 +40,7 @@
right: 1rem; right: 1rem;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
color: #6c757d;
} }
.currency-input { .currency-input {
@ -52,7 +52,7 @@
left: 1rem; left: 1rem;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
color: #6c757d;
} }
.currency-input input { .currency-input input {
@ -60,12 +60,12 @@
} }
.form-actions { .form-actions {
background-color: #f8f9fa;
padding: 1rem; padding: 1rem;
border-radius: 0.5rem; border-radius: 0.5rem;
position: sticky; position:static;
bottom: 1rem; bottom: 1rem;
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
} }
</style> </style>
{% endblock customCSS %} {% endblock customCSS %}
@ -75,7 +75,7 @@
<div class="row justify-content-center mb-4"> <div class="row justify-content-center mb-4">
<div class="col-lg-10"> <div class="col-lg-10">
<div class="card shadow"> <div class="card shadow">
<div class="card-header bg-primary text-white"> <div class="card-header bg-primary ">
<div class="d-flex justify-content-between align-items-center"> <div class="d-flex justify-content-between align-items-center">
<h2 class="h4 mb-0"> <h2 class="h4 mb-0">
<i class="fas fa-file-invoice me-2"></i> New Sale Order <i class="fas fa-file-invoice me-2"></i> New Sale Order