[UPDT] ASSET: Updated models class, form class and form html for update the verbose name

This commit is contained in:
Horilla
2025-03-17 12:18:00 +05:30
parent b01690af79
commit 576a1b4d07
20 changed files with 284 additions and 403 deletions

View File

@@ -21,9 +21,9 @@ class AssetConfig(AppConfig):
def ready(self):
from django.urls import include, path
from horilla.horilla_settings import APPS
from horilla.horilla_settings import APP_URLS, APPS
from horilla.urls import urlpatterns
from horilla.horilla_settings import APP_URLS
APPS.append("asset")
urlpatterns.append(

View File

@@ -46,82 +46,49 @@ class AssetForm(ModelForm):
"""
class Meta:
"""
Specifies the model and fields to be used for the AssetForm.
Attributes:
model (class): The model class Asset to be used for the form.
fields (str): A special value "__all__" to include all fields
of the model in the form.
"""
model = Asset
fields = "__all__"
exclude = ["is_active", "owner"]
exclude = ["is_active"]
widgets = {
"asset_name": forms.TextInput(
attrs={"placeholder": "Macbook Pro.", "class": "oh-input w-100"}
),
"asset_description": forms.Textarea(
attrs={
"type": "text",
"placeholder": _("A powerful laptop for business use."),
"class": "oh-input oh-input--textarea oh-input--block",
"rows": 3,
"cols": 40,
}
),
"asset_tracking_id": forms.TextInput(
attrs={"placeholder": "LPT001", "class": "oh-input w-100"}
),
"asset_purchase_date": forms.DateInput(
attrs={"type": "date", "class": "oh-input w-100"}
attrs={"type": "date", "class": "oh-input w-100"}
),
"expiry_date": forms.DateInput(
attrs={"type": "date", "class": "oh-input w-100"}
),
"asset_purchase_cost": forms.NumberInput(
attrs={"class": "oh-input w-100", "placeholder": "1200.00."}
),
"asset_category_id": forms.Select(
attrs={
"class": "oh-select oh-select-2 select2-hidden-accessible",
},
),
"asset_status": forms.Select(
attrs={"class": "oh-select oh-select--lg oh-select-no-search "}
attrs={"type": "date", "class": "oh-input w-100"}
),
"asset_lot_number_id": forms.Select(
attrs={
"class": "oh-select oh-select-2 select2-hidden-accessible ",
"placeholder": "LOT001",
"onchange": "batchNoChange($(this))",
}
attrs={"onchange": "batchNoChange($(this))"}
),
}
def __init__(self, *args, **kwargs):
request = getattr(_thread_locals, "request")
request = getattr(_thread_locals, "request", None)
instance = kwargs.get("instance")
if instance:
kwargs["initial"] = set_date_field_initial(instance)
kwargs.setdefault("initial", set_date_field_initial(instance))
super().__init__(*args, **kwargs)
reload_queryset(self.fields)
self.fields["asset_category_id"].widget.attrs.update({"id": str(uuid.uuid4())})
self.fields["asset_lot_number_id"].widget.attrs.update(
{"id": str(uuid.uuid4())}
)
self.fields["asset_status"].widget.attrs.update({"id": str(uuid.uuid4())})
if request.user.has_perm("asset.add_assetlot"):
batch_no_choices = [("", _("---Choose Batch No.---"))] + list(
uuid_map = {
field: str(uuid.uuid4())
for field in ["asset_category_id", "asset_lot_number_id", "asset_status"]
}
for field, uuid_value in uuid_map.items():
self.fields[field].widget.attrs["id"] = uuid_value
if request and request.user.has_perm("asset.add_assetlot"):
batch_no_choices = list(
self.fields["asset_lot_number_id"].queryset.values_list(
"id", "lot_number"
)
)
batch_no_choices.insert(0, ("", _("---Choose Batch No.---")))
if not self.instance.pk:
batch_no_choices.append(("create", _("Create new batch number")))
self.fields["asset_lot_number_id"].choices = batch_no_choices
if self.instance.pk is None:
self.fields["asset_lot_number_id"].choices += [
("create", _("Create new batch number"))
]
def clean(self):
instance = self.instance
@@ -239,27 +206,11 @@ class AssetCategoryForm(ModelForm):
model (class): The model class AssetCategory to be used for the form.
fields (str): A special value "__all__" to include all fields
of the model in the form.
widgets (dict): A dictionary containing widget configurations for
specific form fields.
"""
model = AssetCategory
fields = "__all__"
exclude = ["is_active"]
widgets = {
"asset_category_name": forms.TextInput(
attrs={"placeholder": _("Computers."), "class": "oh-input w-100"}
),
"asset_category_description": forms.Textarea(
attrs={
"type": "text",
"placeholder": _("A category for all types of laptops."),
"class": "oh-input oh-input--textarea oh-input--block",
"rows": 3,
"cols": 40,
}
),
}
class AssetRequestForm(ModelForm):
@@ -336,7 +287,9 @@ class AssetAllocationForm(ModelForm):
asset_status="Available"
)
self.fields["assign_images"] = MultipleFileField()
self.fields["assign_images"] = MultipleFileField(
label=_("Assign Condition Images")
)
self.fields["assign_images"].required = True
class Meta:
@@ -419,7 +372,9 @@ class AssetReturnForm(ModelForm):
super().__init__(*args, **kwargs)
self.fields["return_date"].initial = date.today()
self.fields["return_images"] = MultipleFileField(label="Images")
self.fields["return_images"] = MultipleFileField(
label=_("Return Condition Images")
)
self.fields["return_images"].required = True
def clean_return_date(self):
@@ -448,10 +403,6 @@ class AssetBatchForm(ModelForm):
A Django ModelForm for creating or updating AssetLot instances.
"""
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
reload_queryset(self.fields)
class Meta:
"""
Specifies the model and fields to be used for the AssetBatchForm.
@@ -465,20 +416,3 @@ class AssetBatchForm(ModelForm):
model = AssetLot
fields = "__all__"
widgets = {
"lot_number": forms.TextInput(
attrs={"placeholder": "A12345.", "class": "oh-input w-100"}
),
"lot_description": forms.Textarea(
attrs={
"type": "text",
"placeholder": _(
"A batch of 50 laptops, consisting of Lenovo ThinkPad T480s\
and Dell XPS 13."
),
"class": "oh-input oh-input--textarea oh-input--block",
"rows": 3,
"cols": 40,
}
),
}

View File

@@ -20,12 +20,24 @@ class AssetCategory(HorillaModel):
Represents a category for different types of assets.
"""
asset_category_name = models.CharField(max_length=255, unique=True)
asset_category_description = models.TextField(max_length=255)
asset_category_name = models.CharField(
max_length=255, unique=True, verbose_name=_("Name")
)
asset_category_description = models.TextField(
max_length=255, verbose_name=_("Description")
)
objects = models.Manager()
company_id = models.ManyToManyField(Company, blank=True, verbose_name=_("Company"))
objects = HorillaCompanyManager("company_id")
class Meta:
"""
Meta class to add additional options
"""
verbose_name = _("Asset Category")
verbose_name_plural = _("Asset Categories")
def __str__(self):
return f"{self.asset_category_name}"
@@ -35,8 +47,16 @@ class AssetLot(HorillaModel):
Represents a lot associated with a collection of assets.
"""
lot_number = models.CharField(max_length=30, null=False, blank=False, unique=True)
lot_description = models.TextField(null=True, blank=True, max_length=255)
lot_number = models.CharField(
max_length=30,
null=False,
blank=False,
unique=True,
verbose_name=_("Batch Number"),
)
lot_description = models.TextField(
null=True, blank=True, max_length=255, verbose_name=_("Description")
)
company_id = models.ManyToManyField(Company, blank=True, verbose_name=_("Company"))
objects = HorillaCompanyManager()
@@ -45,6 +65,7 @@ class AssetLot(HorillaModel):
Meta class to add additional options
"""
ordering = ["-created_at"]
verbose_name = _("Asset Batch")
verbose_name_plural = _("Asset Batches")
@@ -62,25 +83,50 @@ class Asset(HorillaModel):
("Available", _("Available")),
("Not-Available", _("Not-Available")),
]
asset_name = models.CharField(max_length=255)
owner = models.ForeignKey(Employee, on_delete=models.PROTECT, null=True, blank=True)
asset_description = models.TextField(null=True, blank=True, max_length=255)
asset_tracking_id = models.CharField(max_length=30, null=False, unique=True)
asset_purchase_date = models.DateField()
asset_purchase_cost = models.DecimalField(max_digits=10, decimal_places=2)
asset_category_id = models.ForeignKey(AssetCategory, on_delete=models.PROTECT)
asset_name = models.CharField(max_length=255, verbose_name=_("Asset Name"))
owner = models.ForeignKey(
Employee,
on_delete=models.PROTECT,
null=True,
blank=True,
verbose_name=_("Current User"),
)
asset_description = models.TextField(
null=True, blank=True, max_length=255, verbose_name=_("Description")
)
asset_tracking_id = models.CharField(
max_length=30, null=False, unique=True, verbose_name=_("Tracking Id")
)
asset_purchase_date = models.DateField(verbose_name=_("Purchase Date"))
asset_purchase_cost = models.DecimalField(
max_digits=10, decimal_places=2, verbose_name=_("Cost")
)
asset_category_id = models.ForeignKey(
AssetCategory, on_delete=models.PROTECT, verbose_name=_("Category")
)
asset_status = models.CharField(
choices=ASSET_STATUS, default="Available", max_length=40
choices=ASSET_STATUS,
default="Available",
max_length=40,
verbose_name=_("Status"),
)
asset_lot_number_id = models.ForeignKey(
AssetLot, on_delete=models.PROTECT, null=True, blank=True
AssetLot,
on_delete=models.PROTECT,
null=True,
blank=True,
verbose_name=_("Batch No"),
)
expiry_date = models.DateField(null=True, blank=True, verbose_name=_("Expiry Date"))
notify_before = models.IntegerField(
default=1, null=True, verbose_name=_("Notify Before (days)")
)
expiry_date = models.DateField(null=True, blank=True)
notify_before = models.IntegerField(default=1, null=True)
objects = HorillaCompanyManager("asset_category_id__company_id")
class Meta:
ordering = ["-created_at"]
verbose_name = _("Asset")
verbose_name_plural = _("Assets")
def __str__(self):
return f"{self.asset_name}-{self.asset_tracking_id}"
@@ -173,19 +219,31 @@ class AssetAssignment(HorillaModel):
("Healthy", _("Healthy")),
]
asset_id = models.ForeignKey(
Asset, on_delete=models.PROTECT, verbose_name=_("asset")
Asset, on_delete=models.PROTECT, verbose_name=_("Asset")
)
assigned_to_employee_id = models.ForeignKey(
Employee, on_delete=models.PROTECT, related_name="allocated_employee"
Employee,
on_delete=models.PROTECT,
related_name="allocated_employee",
verbose_name=_("Assigned To"),
)
assigned_date = models.DateField(auto_now_add=True)
assigned_by_employee_id = models.ForeignKey(
Employee, on_delete=models.PROTECT, related_name="assigned_by"
Employee,
on_delete=models.PROTECT,
related_name="assigned_by",
verbose_name=_("Assigned By"),
)
return_date = models.DateField(null=True, blank=True, verbose_name=_("Return Date"))
return_condition = models.TextField(
null=True, blank=True, max_length=255, verbose_name=_("Return Condition")
)
return_date = models.DateField(null=True, blank=True)
return_condition = models.TextField(null=True, blank=True, max_length=255)
return_status = models.CharField(
choices=STATUS, max_length=30, null=True, blank=True
choices=STATUS,
max_length=30,
null=True,
blank=True,
verbose_name=_("Return Status"),
)
return_request = models.BooleanField(default=False)
objects = HorillaCompanyManager("asset_id__asset_lot_number_id__company_id")
@@ -193,7 +251,10 @@ class AssetAssignment(HorillaModel):
ReturnImages, blank=True, related_name="return_images"
)
assign_images = models.ManyToManyField(
ReturnImages, blank=True, related_name="assign_images"
ReturnImages,
blank=True,
related_name="assign_images",
verbose_name=_("Assign Condition Images"),
)
objects = HorillaCompanyManager(
"assigned_to_employee_id__employee_work_info__company_id"
@@ -203,6 +264,8 @@ class AssetAssignment(HorillaModel):
"""Meta class for AssetAssignment model"""
ordering = ["-id"]
verbose_name = _("Asset Allocation")
verbose_name_plural = _("Asset Allocations")
def __str__(self):
return f"{self.assigned_to_employee_id} --- {self.asset_id} --- {self.return_status}"
@@ -224,12 +287,15 @@ class AssetRequest(HorillaModel):
related_name="requested_employee",
null=False,
blank=False,
verbose_name=_("Requesting User"),
)
asset_category_id = models.ForeignKey(
AssetCategory, on_delete=models.PROTECT, verbose_name=_("Asset Category")
)
asset_request_date = models.DateField(auto_now_add=True)
description = models.TextField(null=True, blank=True, max_length=255)
description = models.TextField(
null=True, blank=True, max_length=255, verbose_name=_("Description")
)
asset_request_status = models.CharField(
max_length=30, choices=STATUS, default="Requested", null=True, blank=True
)
@@ -241,6 +307,8 @@ class AssetRequest(HorillaModel):
"""Meta class for AssetRequest model"""
ordering = ["-id"]
verbose_name = _("Asset Request")
verbose_name_plural = _("Asset Requests")
def status_html_class(self):
COLOR_CLASS = {

View File

@@ -102,7 +102,7 @@ $(document).ready(function () {
var csrf_token = $('input[name="csrfmiddlewaretoken"]').attr("value");
$.ajax({
type: "POST",
url: "asset-count-update",
url: "/asset/asset-count-update",
data: {
asset_category_id: assetCategoryId,
csrfmiddlewaretoken: csrf_token,

View File

@@ -20,14 +20,14 @@
<!-- end of messages -->
<!-- checking if the category id is present -->
<div class="oh-modal__dialog-header">
<div class="oh-modal__dialog-header pb-0">
<button type="button" class="oh-modal__close" data-dismiss="oh-modal" aria-label="Close"
hx-get="{%url 'asset-list' cat_id=asset_creation_form.asset_category_id.initial %}?{{request.GET.urlencode}}&category={{asset_creation_form.asset_category_id.initial}}"
hx-target="#assetCategory{{asset_creation_form.asset_category_id.initial}}">
<ion-icon name="close-outline"></ion-icon>
</button>
<span class="oh-modal__dialog-title ml-5" id="addEmployeeObjectiveModalLabel">
<h5>{% trans "Asset Creation" %}</h5>
<h5>{% trans "Create" %} {{asset_creation_form.verbose_name}}</h5>
</span>
</div>
<div class="oh-modal__dialog-body">
@@ -37,14 +37,14 @@
<div class="oh-profile-section pt-0" id="AssetCreationFormContainer">
<div class="oh-input__group">
<label class="oh-input__label" for="{{asset_creation_form.asset_name.id_for_label}}">
{% trans "Asset Name" %}
{{asset_creation_form.asset_name.label}}
</label>
{{asset_creation_form.asset_name}}
{{asset_creation_form.asset_name.errors}}
</div>
<div class="oh-input__group">
<label class="oh-input__label" for="{{asset_creation_form.asset_description.id_for_label}}">
{% trans "Description" %}</label>
{{asset_creation_form.asset_description.label}}</label>
{{asset_creation_form.asset_description}}
{{asset_creation_form.asset_description.errors}}
</div>
@@ -52,7 +52,7 @@
<div class="col-12 col-sm-12 col-md-4 col-lg-4">
<div class="oh-input__group">
<label class="oh-input__label" for="{{asset_creation_form.asset_tracking_id.id_for_label}}">
{% trans "Tracking Id" %}
{{asset_creation_form.asset_tracking_id.label}}
</label>
{{asset_creation_form.asset_tracking_id}}
{{asset_creation_form.asset_tracking_id.errors}}
@@ -61,7 +61,7 @@
<div class="col-12 col-sm-12 col-md-4 col-lg-4">
<div class="oh-input__group">
<label class="oh-input__label" for="{{asset_creation_form.asset_purchase_date.id_for_label}}">
{% trans "Purchase Date" %}
{{asset_creation_form.asset_purchase_date.label}}
</label>
{{asset_creation_form.asset_purchase_date |attr:"type:date" }}
{{asset_creation_form.asset_purchase_date.errors }}
@@ -70,7 +70,7 @@
<div class="col-12 col-sm-12 col-md-4 col-lg-4">
<div class="oh-input__group">
<label class="oh-input__label" for="{{asset_creation_form.asset_purchase_cost.id_for_label}}">
{% trans "Cost" %}
{{asset_creation_form.asset_purchase_cost.label}}
</label>
{{asset_creation_form.asset_purchase_cost}}
{{asset_creation_form.asset_purchase_cost.errors}}
@@ -81,7 +81,7 @@
<div class="col-12 col-sm-12 col-md-6 col-lg-6">
<div class="oh-input__group">
<label class="oh-input__label" for="{{asset_creation_form.asset_status.id_for_label}}">
{% trans "Status" %}
{{asset_creation_form.asset_status.label}}
</label>
{{asset_creation_form.asset_status }}
{{asset_creation_form.asset_status.errors }}
@@ -90,7 +90,7 @@
<div class="col-12 col-sm-12 col-md-6 col-lg-6">
<div class="oh-input__group">
<label class="oh-input__label" for="{{asset_creation_form.asset_lot_number_id.id_for_label}}">
{% trans "Batch No" %}
{{asset_creation_form.asset_lot_number_id.label}}
</label>
{{asset_creation_form.asset_lot_number_id }}
{{asset_creation_form.asset_lot_number_id.errors}}
@@ -101,7 +101,7 @@
<div class="col-12 col-sm-12 col-md-4 col-lg-6">
<div class="oh-input__group">
<label class="oh-input__label" for="{{asset_creation_form.expiry_date.id_for_label}}">
{% trans "Expiry Date" %}
{{asset_creation_form.expiry_date.label}}
</label>
{{asset_creation_form.expiry_date |attr:"type:date" }}
{{asset_creation_form.expiry_date.errors }}
@@ -110,7 +110,7 @@
<div class="col-12 col-sm-12 col-md-4 col-lg-6 d-none notify">
<div class="oh-input__group">
<label class="oh-input__label" for="{{asset_creation_form.notify_before.id_for_label}}">
{% trans "Notify Before (days)" %}
{{asset_creation_form.notify_before.label}}
</label>
{{asset_creation_form.notify_before}}
{{asset_creation_form.notify_before.errors}}

View File

@@ -282,7 +282,7 @@
var csrf_token = $('input[name="csrfmiddlewaretoken"]').attr("value");
$.ajax({
type: "POST",
url: "asset-count-update",
url: "/asset/asset-count-update",
data: {
asset_category_id: assetCategoryId,
csrfmiddlewaretoken: csrf_token,

View File

@@ -1,86 +1,57 @@
{% load i18n %} {% load horillafilters %}
<div class="oh-modal__dialog-header">
<button
type="button"
class="oh-modal_close--custom"
onclick="$('#objectCreateModal').removeClass('oh-modal--show');"
>
<ion-icon
name="close-outline"
role="img"
aria-label="close outline"
class="md hydrated"
></ion-icon>
<div class="oh-modal__dialog-header pb-0">
<button type="button" class="oh-modal_close--custom"
onclick="$('#objectCreateModal').removeClass('oh-modal--show');">
<ion-icon name="close-outline" role="img" aria-label="close outline" class="md hydrated"></ion-icon>
</button>
<span
class="oh-modal__dialog-title ml-5"
id="addEmployeeObjectiveModalLabel"
>
<span class="oh-modal__dialog-title ml-5" id="addEmployeeObjectiveModalLabel">
<h5>{% trans "Asset Return Form" %}</h5>
</span>
</div>
<div class="oh-modal__dialog-body">
<form
hx-post="{%url 'asset-allocate-return' asset_id=asset_id %}"
hx-target="#objectCreateModalTarget"
hx-encoding="multipart/form-data"
>
<form hx-post="{%url 'asset-allocate-return' asset_id=asset_id %}" hx-target="#objectCreateModalTarget"
hx-encoding="multipart/form-data">
{% csrf_token %}
<div class="oh-profile-section pt-0">
<div class="oh-input__group">
<label class="oh-input__label" for="objective"
>{% trans "Return Status" %}</label
>
<label class="oh-input__label" for="objective">
{{asset_return_form.return_status.label}}</label>
{{asset_return_form.return_status}}
</div>
<div class="oh-input__group">
<label class="oh-input__label" for="objective"
>{% trans "Return Date" %}</label
>
<label class="oh-input__label" for="objective">
{{asset_return_form.return_date.label}}</label>
{{asset_return_form.return_date}}
{{asset_return_form.return_date.errors}}
</div>
<div class="oh-input__group">
<label class="oh-input__label" for="objective"
>{% trans "Return Condition" %}</label
>
<label class="oh-input__label" for="objective">
{{asset_return_form.return_condition.label}}</label>
{{asset_return_form.return_condition}}
</div>
<div class="oh-input__group">
<label class="oh-input__label" for="objective"
>{% trans "Return Condition Images" %}</label
>
<label class="oh-input__label" for="objective">
{{asset_return_form.return_images.label}}
</label>
{{asset_return_form.return_images}}
</div>
<div class="oh-btn-group mt-4">
<button
class="oh-btn oh-btn--info oh-btn--shadow w-100"
type="button"
data-toggle="oh-modal-toggle"
data-target="#dynamicCreateModal"
hx-get="{% url "add-asset-report" asset_id %}"
hx-target="#dynamicCreateModalTarget"
>
<button class="oh-btn oh-btn--info oh-btn--shadow w-100" type="button" data-toggle="oh-modal-toggle"
data-target="#dynamicCreateModal" hx-get="{% url 'add-asset-report' asset_id %}"
hx-target="#dynamicCreateModalTarget">
{% trans "Add Report" %}
</button>
{% if "payroll"|app_installed %}
{% if perms.payroll.add_loanaccount %}
<button
class="oh-btn oh-btn--primary oh-btn--shadow w-100 ml-2"
type="button"
hx-get="{% url "asset-fine" %}?employee_id={{asset_alocation.assigned_to_employee_id.id}}&asset_id={{asset_id}}"
hx-target="#dynamicCreateModalTarget"
data-toggle="oh-modal-toggle"
data-target="#dynamicCreateModal"
>
<button class="oh-btn oh-btn--primary oh-btn--shadow w-100 ml-2" type="button"
hx-get="{% url 'asset-fine' %}?employee_id={{asset_alocation.assigned_to_employee_id.id}}&asset_id={{asset_id}}"
hx-target="#dynamicCreateModalTarget" data-toggle="oh-modal-toggle"
data-target="#dynamicCreateModal">
{% trans "Add Fine" %}
</button>
{% endif %}
{% endif %}
<button
type="submit"
class="oh-btn oh-btn--secondary oh-btn--shadow w-100 ml-2"
>
<button type="submit" class="oh-btn oh-btn--secondary oh-btn--shadow w-100 ml-2">
{% trans "Save" %}
</button>
</div>

View File

@@ -67,7 +67,9 @@
<ion-icon name="close-outline"></ion-icon>
</button>
{% endif %}
<span class="oh-modal__dialog-title " id="addEmployeeObjectiveModalLabel"> {% trans "Asset Update" %}</span>
<span class="oh-modal__dialog-title ml-5" id="addEmployeeObjectiveModalLabel">
<h5>{% trans "Update" %} {{asset_form.verbose_name}}</h5>
</span>
</div>
<div class="oh-modal__dialog-body">
<form hx-post="{%url 'asset-update' asset_id=asset_form.instance.id %}?requests_ids={{requests_ids}}&{{pg}}"
@@ -82,10 +84,10 @@
<div class="my-3" id="keyResultCard">
<div class=" " id="assetUpdateFormContainer">
<div class="row">
<div class="col-12 col-sm-12 col-md-6 col-lg-6">
<div class="col-12 {% if instance.asset_status == "In use" and instance.assetassignment_set.last %}col-sm-12 col-md-6 col-lg-6 {% endif %}">
<div class="oh-input__group">
<label class="oh-input__label" for="{{asset_form.asset_name.id_for_label}}">
{% trans "Asset Name" %}
{{asset_form.asset_name.label}}
</label>
{{asset_form.asset_name}}
{{asset_form.asset_name.errors}}
@@ -95,7 +97,7 @@
<div class="col-12 col-sm-12 col-md-6 col-lg-6">
<div class="oh-input__group">
<label class="oh-input__label" for="{{asset_form.owner.id_for_label}}">
{% trans "Current User" %}
{{asset_form.owner.label}}
</label>
{% with assigned=instance.assetassignment_set.last %}
<input type="text" class="oh-input w-100"
@@ -107,7 +109,7 @@
</div>
<div class="oh-input__group ">
<label class="oh-input__label" for="{{asset_form.asset_description.id_for_label}}">
{% trans "Asset Description" %}
{{asset_form.asset_description.label}}
</label>
{{asset_form.asset_description}}
{{asset_form.asset_description.errors}}
@@ -117,7 +119,7 @@
<div class="oh-input__group">
<label class="oh-input__label"
for="{{asset_form.asset_tracking_id.id_for_label}}">
{% trans "Tracking Id" %}
{{asset_form.asset_tracking_id.label}}
</label>
{{asset_form.asset_tracking_id}}
{{asset_form.asset_tracking_id.errors}}
@@ -127,7 +129,7 @@
<div class="oh-input__group">
<label class="oh-input__label"
for="{{asset_form.asset_category_id.id_for_label}}">
{% trans "Category" %}
{{asset_form.asset_category_id.label }}
</label>
{{asset_form.asset_category_id }}
{{asset_form.asset_category_id.errors }}
@@ -139,7 +141,7 @@
<div class="oh-input__group">
<label class="oh-input__label"
for="{{asset_form.asset_purchase_date.id_for_label}}">
{% trans "Purchase Date" %}
{{asset_form.asset_purchase_date.label}}
</label>
{{asset_form.asset_purchase_date }}
{{asset_form.asset_purchase_date.errors }}
@@ -149,7 +151,7 @@
<div class="oh-input__group">
<label class="oh-input__label"
for="{{asset_form.asset_purchase_cost.id_for_label}}">
{% trans "Cost" %}
{{asset_form.asset_purchase_cost.label}}
</label>
{{asset_form.asset_purchase_cost}}
{{asset_form.asset_purchase_cost.errors}}
@@ -160,7 +162,7 @@
<div class="col-12 col-sm-12 col-md-6 col-lg-6">
<div class="oh-input__group">
<label class="oh-input__label" for="{{asset_form.asset_status.id_for_label}}">
{% trans "Status" %}
{{asset_form.asset_status.label}}
</label>
{{asset_form.asset_status}}
{{asset_form.asset_status.errors}}
@@ -170,7 +172,7 @@
<div class="oh-input__group">
<label class="oh-input__label"
for="{{asset_form.asset_lot_number_id.id_for_label}}">
{% trans "Batch No" %}
{{asset_form.asset_lot_number_id.label}}
</label>
{{asset_form.asset_lot_number_id}}
{{asset_form.asset_lot_number_id.errors}}
@@ -181,7 +183,7 @@
<div class="col-12 col-sm-12 col-md-6 col-lg-6">
<div class="oh-input__group">
<label class="oh-input__label" for="{{asset_form.expiry_date.id_for_label}}">
{% trans "Expiry Date" %}
{{asset_form.expiry_date.label}}
</label>
{{asset_form.expiry_date}}
{{asset_form.expiry_date.errors}}
@@ -192,7 +194,7 @@
<div class="oh-input__group">
<label class="oh-input__label"
for="{{asset_form.notify_before.id_for_label}}">
{% trans "Notify Before(days)" %}
{{asset_form.notify_before.label}}
</label>
{{asset_form.notify_before}}
{{asset_form.notify_before.errors}}

View File

@@ -1,54 +1,35 @@
{% load static i18n %} {% load i18n %}
{% if messages %}
<div class="oh-wrapper">
{% for message in messages %}
<div class="oh-alert-container">
<div class="oh-alert oh-alert--animated {{message.tags}}">
{{ message }}
</div>
</div>
{% endfor %}
<span {% if hx_get and hx_target %} hx-get="{{hx_get}}" hx-target="{{hx_target}}" {% else %}
hx-get="{% url 'asset-batch-number-search' %}" hx-target="#AssetBatchList" {% endif %} hx-trigger="load delay:1s"
hx-on-htmx-after-request="setTimeout(function () { $('.oh-modal__close--custom').click(); }, 1000);"></span>
<script>
setTimeout(function () {
$(".oh-modal__close--custom").click();
}, 1000);
reloadMessage();
</script>
</div>
{% endif %}
<div class="oh-modal__dialog-header pb-0">
<h5 class="oh-modal__dialog-title" id="addEmployeeObjectiveModalLabel">
{% trans "Create Batch Number" %}
{% trans "Create" %} {{asset_batch_form.verbose_name}}
</h5>
<button type="button" class="oh-modal__close--custom"
data-dismiss="oh-modal" aria-label="Close"
onclick="$(this).closest('.oh-modal--show').toggleClass('oh-modal--show')"
{% if hx_get and hx_target %}
hx-get="{{hx_get}}"
hx-target="{{hx_target}}"
{% else %}
hx-get="{% url 'asset-batch-number-search' %}"
hx-target="#AssetBatchList"
{% endif %}
>
<button type="button" class="oh-modal__close--custom" data-dismiss="oh-modal" aria-label="Close"
onclick="$(this).closest('.oh-modal--show').toggleClass('oh-modal--show')">
<ion-icon name="close-outline"></ion-icon>
</button>
</div>
<div class="oh-modal__dialog-body">
<form hx-post="{%url 'asset-batch-number-creation' %}?{{hx_vals}}"
{% if hx_vals %}
hx-target="#dynamicCreateModalTarget"
{% else %}
hx-target="#objectCreateModalTarget"
{% endif %}
class="oh-profile-section pt-1"
>
<form hx-post="{%url 'asset-batch-number-creation' %}?{{hx_vals}}" {% if hx_vals %}
hx-target="#dynamicCreateModalTarget" {% else %} hx-target="#objectCreateModalTarget" {% endif %}
class="oh-profile-section pt-1">
{% csrf_token %}
<div class="oh-input__group">
<label class="oh-input__label" for="{{asset_batch_form.lot_number.id_for_label}}" >{% trans "Batch Number" %}</label>
<label class="oh-input__label"
for="{{asset_batch_form.lot_number.id_for_label}}">{{asset_batch_form.lot_number.label}}</label>
{{asset_batch_form.lot_number}} {{asset_batch_form.lot_number.errors}}
</div>
<div class="oh-input__group">
<label class="oh-input__label" for="{{asset_batch_form.lot_description.id_for_label}}" >{% trans "Description" %}</label>
<label class="oh-input__label"
for="{{asset_batch_form.lot_description.id_for_label}}">{{asset_batch_form.lot_description.label}}</label>
{{asset_batch_form.lot_description}}
{{asset_batch_form.lot_description.errors}}
</div>

View File

@@ -1,13 +1,11 @@
{% load static i18n %} {% load i18n %}
{% if messages %}
<span hx-get="{%url 'asset-batch-number-search'%}" hx-target="#AssetBatchList" hx-trigger="load"></span>
<span hx-get="{%url 'asset-batch-number-search'%}" hx-target="#AssetBatchList" hx-trigger="load delay:1s"
hx-on-htmx-after-request="setTimeout(function () { $('.oh-modal__close').click(); }, 1000);"></span>
<script>
setTimeout(function () {
$('.oh-modal__close').click()
}, 1000);
reloadMessage();
</script>
{% endif %}
<!-- start of messages -->
{% if in_use_message %}
<div class="oh-wrapper">
<div class="oh-alert-container">
@@ -17,23 +15,26 @@
</div>
</div>
{% endif %}
<!-- end of messages -->
<div class="oh-modal__dialog-header">
<h5 class="oh-modal__dialog-title" id="addEmployeeObjectiveModalLabel">{% trans "Batch Number Update" %}</h5>
<h5 class="oh-modal__dialog-title" id="addEmployeeObjectiveModalLabel">{% trans "Update" %}
{{asset_batch_update_form.verbose_name}}</h5>
<button type="button" class="oh-modal__close" data-dismiss="oh-modal" aria-label="Close">
<ion-icon name="close-outline"></ion-icon>
<ion-icon name="close-outline"></ion-icon>
</button>
</div>
<div class="oh-modal__dialog-body">
<form hx-post="{%url 'asset-batch-update' batch_id=asset_batch_update_form.instance.id %}" hx-target="#objectUpdateModalTarget" class="oh-profile-section pt-1">
<form hx-post="{%url 'asset-batch-update' batch_id=asset_batch_update_form.instance.id %}"
hx-target="#objectUpdateModalTarget" class="oh-profile-section pt-1">
{% csrf_token %}
<div class="oh-input__group">
<label class="oh-input__label" for="objective">{% trans "Batch Number" %}</label>
<label class="oh-input__label"
for="{{asset_batch_update_form.lot_number.id_for_label}}">{{asset_batch_update_form.lot_number.label}}</label>
{{asset_batch_update_form.lot_number}}
</div>
<div class="oh-input__group">
<label class="oh-input__label" for="objective">{% trans "Description" %}</label>
<label class="oh-input__label"
for="{{asset_batch_update_form.lot_description.id_for_label}}">{{asset_batch_update_form.lot_description.label}}</label>
{{asset_batch_update_form.lot_description}}
</div>
<div class="oh-modal__dialog-footer p-0 pt-2">

View File

@@ -1,61 +0,0 @@
{% load static i18n %}
{% if messages %}
<div class="oh-wrapper">
{% for message in messages %}
<div class="oh-alert-container">
<div class="oh-alert oh-alert--animated {{message.tags}}">
{{ message }}
</div>
</div>
{% endfor %}
<script>
setTimeout(function () {
$('.oh-modal__close').click()
}, 1000);
</script>
</div>
{% endif %}
<div class="oh-modal__dialog-header">
<button
type="button"
class="oh-modal__close"
data-dismiss="oh-modal"
aria-label="Close"
{% if messages %}
hx-get="{%url 'asset-category-view-search-filter' %}"
hx-target="#assetCategoryList"
{% endif %}
>
<ion-icon name="close-outline"></ion-icon>
</button>
<span class="oh-modal__dialog-title ml-5" id="addEmployeeObjectiveModalLabel">
<h5>{% trans "Asset Category Creation" %}</h5>
</span>
</div>
<div class="oh-modal__dialog-body">
<form hx-post="{%url 'asset-category-creation' %}" hx-target="#objectCreateModalTarget">
{% csrf_token %}
<div class="oh-profile-section pt-0">
<div class="oh-input__group ">
<label class="oh-input__label" for="{{asset_category_form.asset_category_name.id_for_label}}">{% trans "Name" %}</label>
{{asset_category_form.asset_category_name}}
{{asset_category_form.asset_category_name.errors}}
</div>
<div class="oh-input__group ">
<label class="oh-input__label" for="{{asset_category_form.asset_category_description.id_for_label}}">{% trans "Description" %}</label>
{{asset_category_form.asset_category_description}}
{{asset_category_form.asset_category_description.errors}}
</div>
<div class="oh-input__group ">
<label class="oh-input__label" for="{{asset_category_form.company_id.id_for_label}}">{% trans "Company" %}</label>
{{asset_category_form.company_id}}
{{asset_category_form.company_id.errors}}
</div>
<div class="oh-modal__dialog-footer p-0 mt-3">
<button type="submit" class="oh-btn oh-btn--secondary oh-btn--shadow" >
{% trans "Save" %}
</button>
</div>
</div>
</form>
</div>

View File

@@ -0,0 +1,45 @@
{% load static i18n %}
{% if messages %}
<span hx-get="{%url 'asset-category-view-search-filter' %}" hx-target="#assetCategoryList" hx-trigger="load"
hx-on-htmx-after-request="setTimeout(function () { $('.oh-modal__close').click(); }, 1000);"></span>
{% endif %}
<div class="oh-modal__dialog-header">
<button type="button" class="oh-modal__close" data-dismiss="oh-modal" aria-label="Close">
<ion-icon name="close-outline"></ion-icon>
</button>
<span class="oh-modal__dialog-title ml-5" id="addEmployeeObjectiveModalLabel">
<h5>{% if form.instance.id %} {% trans "Update" %}{% else %}{% trans "Create" %}{% endif %}
{{form.verbose_name}}</h5>
</span>
</div>
<div class="oh-modal__dialog-body">
<form
hx-post="{% if form.instance.id %}{% url 'asset-category-update' cat_id=form.instance.id %}?{{pg}}{% else %}{%url 'asset-category-creation' %}{% endif %}"
hx-target="{% if form.instance.id %}#objectUpdateModalTarget{% else %}#objectCreateModalTarget{% endif %}">
{% csrf_token %}
<div class="oh-profile-section pt-0">
<div class="oh-input__group ">
<label class="oh-input__label"
for="{{form.asset_category_name.id_for_label}}">{{form.asset_category_name.label}}</label>
{{form.asset_category_name}}
{{form.asset_category_name.errors}}
</div>
<div class="oh-input__group ">
<label class="oh-input__label"
for="{{form.asset_category_description.id_for_label}}">{{form.asset_category_description.label}}</label>
{{form.asset_category_description}}
{{form.asset_category_description.errors}}
</div>
<div class="oh-input__group ">
<label class="oh-input__label" for="{{form.company_id.id_for_label}}">{{form.company_id.label}}</label>
{{form.company_id}}
{{form.company_id.errors}}
</div>
<div class="oh-modal__dialog-footer p-0 mt-3">
<button type="submit" class="oh-btn oh-btn--secondary oh-btn--shadow">
{% trans "Save" %}
</button>
</div>
</div>
</form>
</div>

View File

@@ -1,60 +0,0 @@
{% load static i18n %}
{% load i18n %}
<!-- start of messages -->
{% if messages %}
<div class="oh-wrapper">
{% for message in messages %}
<div class="oh-alert-container">
<div class="oh-alert oh-alert--animated {{message.tags}}">
{{ message }}
</div>
</div>
{% endfor %}
<script>
setTimeout(function () {
$('.oh-modal__close').click()
}, 1000);
</script>
</div>
{% endif %}
<!-- end of messages -->
<!-- asset cretion form -->
<div class="oh-modal__dialog-header">
<button type="button" class="oh-modal__close" data-dismiss="oh-modal" aria-label="Close" {% if messages %}
hx-get="{%url 'asset-category-view-search-filter'%}?{{pg}}" hx-target="#assetCategoryList" {% endif %}>
<ion-icon name="close-outline"></ion-icon>
</button>
<span class="oh-modal__dialog-title ml-5" id="addEmployeeObjectiveModalLabel">
<h5>{% trans "Asset Category Update" %}</h5>
</span>
</div>
<div class="oh-modal__dialog-body">
<form hx-post="{%url 'asset-category-update' cat_id=asset_category_update_form.instance.id %}?{{pg}}"
hx-target="#objectUpdateModalTarget">
{% csrf_token %}
<div class="oh-profile-section pt-0">
<div class="oh-input__group ">
<label class="oh-input__label" for="{{asset_category_update_form.asset_category_name.id_for_label}}">{% trans "Name" %}</label>
{{asset_category_update_form.asset_category_name.errors}}
{{asset_category_update_form.asset_category_name}}
</div>
<div class="oh-input__group ">
<label class="oh-input__label" for="{{asset_category_update_form.asset_category_description.id_for_label}}">{% trans "Description" %}</label>
{{asset_category_update_form.asset_category_description.errors}}
{{asset_category_update_form.asset_category_description}}
</div>
<div class="oh-input__group ">
<label class="oh-input__label" for="{{asset_category_update_form.company_id.id_for_label}}">{% trans "Company" %}</label>
{{asset_category_update_form.company_id.errors}}
{{asset_category_update_form.company_id}}
</div>
<div class="oh-modal__dialog-footer p-0 mt-3">
<button type="submit" class="oh-btn oh-btn--secondary oh-btn--shadow ">
{% trans "Save" %}
</button>
</div>
</div>
</form>
</div>

View File

@@ -48,7 +48,7 @@
<main :class="sidebarOpen ? 'oh-main__sidebar-visible' : ''">
<section class="oh-wrapper oh-main__topbar" x-data="{searchShow: false}">
<div class="oh-main__titlebar oh-main__titlebar--left">
<h1 class="oh-main__titlebar-title fw-bold">{% trans "Asset Category" %}</h1>
<h1 class="oh-main__titlebar-title fw-bold">{{ model.get_verbose_name }}</h1>
<a class="oh-main__titlebar-search-toggle" role="button" aria-label="Toggle Search"
@click="searchShow = !searchShow">
<ion-icon name="search-outline" class="oh-main__titlebar-serach-icon"></ion-icon>

View File

@@ -35,7 +35,7 @@
<main :class="sidebarOpen ? 'oh-main__sidebar-visible' : ''">
<section class="oh-wrapper oh-main__topbar" x-data="{searchShow: false}">
<div class="oh-main__titlebar oh-main__titlebar--left">
<h1 class="oh-main__titlebar-title fw-bold">{% trans "Asset Category" %}</h1>
<h1 class="oh-main__titlebar-title fw-bold">{{ model.get_verbose_name }}</h1>
</div>
<div class="oh-main__titlebar oh-main__titlebar--right">

View File

@@ -16,7 +16,7 @@
<ion-icon name="close-outline"></ion-icon>
</button>
<span class="oh-modal__dialog-title ml-5" id="addEmployeeObjectiveModalLabel">
<h5>{% trans "Asset Allocation" %}</h5>
<h5>{{asset_allocation_form.verbose_name}}</h5>
</span>
</div>
<div class="oh-modal__dialog-body">
@@ -26,28 +26,28 @@
<div class="oh-profile-section pt-0">
<div class="oh-input__group">
<label class="oh-input__label" for="{{asset_allocation_form.assigned_to_employee_id.id_for_label}}">
{% trans "Assigned To" %}
{{asset_allocation_form.assigned_to_employee_id.label}}
</label>
{{asset_allocation_form.assigned_to_employee_id}}
{{asset_allocation_form.assigned_to_employee_id.errors}}
</div>
<div class="oh-input__group">
<label class="oh-input__label" for="{{asset_allocation_form.asset_id.id_for_label}}">
{% trans "Asset" %}
{{asset_allocation_form.asset_id.label}}
</label>
{{asset_allocation_form.asset_id}}
{{asset_allocation_form.asset_id.errors}}
</div>
<div class="oh-input__group">
<label class="oh-input__label" for="{{asset_allocation_form.assigned_by_employee_id.id_for_label}}">
{% trans "Assigned By" %}
{{asset_allocation_form.assigned_by_employee_id.label}}
</label>
{{asset_allocation_form.assigned_by_employee_id}}
{{asset_allocation_form.assigned_by_employee_id.errors}}
</div>
<div class="oh-input__group">
<label class="oh-input__label" for="{{asset_allocation_form.assign_images.id_for_label}}">
{% trans "Assign Condition Images" %}
{{asset_allocation_form.assign_images.label}}
</label>
{{asset_allocation_form.assign_images}}
{{asset_allocation_form.assign_images.errors}}

View File

@@ -4,7 +4,7 @@
<ion-icon name="close-outline"></ion-icon>
</button>
<span class="oh-modal__dialog-title ml-5" id="addEmployeeObjectiveModalLabel">
<h5>{% trans "Asset Approve" %}</h5>
<h5>{{asset_allocation_form.verbose_name}}</h5>
</span>
</div>
<div class="oh-modal__dialog-body">
@@ -15,14 +15,14 @@
<div class="oh-profile-section pt-0">
<div class="oh-input__group">
<label class="oh-input__label" for="{{asset_allocation_form.asset_id.id_for_label}}">
{% trans "Asset" %}
{{asset_allocation_form.asset_id.label}}
</label>
{{asset_allocation_form.asset_id}}
{{asset_allocation_form.asset_id.errors}}
</div>
<div class="oh-input__group">
<label class="oh-input__label" for="{{asset_allocation_form.assign_images.id_for_label}}">
{% trans "Assign Condition Images" %}
{{asset_allocation_form.assign_images.label}}
</label>
{{asset_allocation_form.assign_images}}
{{asset_allocation_form.assign_images.errors}}

View File

@@ -1,6 +1,6 @@
{% load i18n %}
{% if messages %}
<script>setTimeout(() => {reloadMessage(this); $('.oh-modal__close').click(); }, 160);</script>
<script>setTimeout(() => { reloadMessage(this); $('.oh-modal__close').click(); }, 160);</script>
{% if hx_url %}
<span hx-trigger="load" hx-target="#{{hx_target}}" hx-get="{{hx_url}}"></span>
{% endif %}
@@ -9,7 +9,7 @@
<div class="oh-modal__dialog-header pb-0">
<span class="oh-modal__dialog-title" id="createModalLabel">
{% trans "Asset Request" %}
{{asset_request_form.verbose_name}}
</span>
<button class="oh-modal__close" aria-label="Close">
<ion-icon name="close-outline"></ion-icon>
@@ -31,23 +31,23 @@
<form hx-post="{%url 'asset-request-creation' %}" hx-target="#objectCreateModalTarget">
{% csrf_token %}
<div class="oh-general__tab-target oh-profile-section">
<div class="oh-input__group {% if not perms.asset.add_assetrequest %}d-none {% endif %}">
<div class="oh-input__group {% if not perms.asset.add_assetrequest %} d-none {% endif %}">
<label class="oh-input__label" for="{{asset_request_form.requested_employee_id.id_for_label}}">
{% trans "Requesting User" %}
{{asset_request_form.requested_employee_id.label}}
</label>
{{asset_request_form.requested_employee_id}}
{{asset_request_form.requested_employee_id.errors}}
</div>
<div class="oh-input__group ">
<label class="oh-input__label" for="{{asset_request_form.asset_category_id.id_for_label}}">
{% trans "Asset Category" %}
{{asset_request_form.asset_category_id.label}}
</label>
{{asset_request_form.asset_category_id}}
{{asset_request_form.asset_category_id.errors}}
</div>
<div class="oh-input__group ">
<label class="oh-input__label" for="{{asset_request_form.description.id_for_label}}">
{% trans "Description" %}
{{asset_request_form.description.label}}
</label>
{{asset_request_form.description}}
{{asset_request_form.description.errors}}

View File

@@ -49,8 +49,8 @@ urlpatterns = [
kwargs={
"model": AssetCategory,
"form": AssetCategoryForm,
"form_name": "asset_category_form",
"template": "category/asset_category_creation.html",
"form_name": "form",
"template": "category/asset_category_form.html",
},
),
path(

View File

@@ -1,7 +1,7 @@
""""
""" "
asset.py
This module is used to """
This module is used to"""
import csv
import json
@@ -113,7 +113,7 @@ def asset_creation(request, asset_category_id):
initial_data = {"asset_category_id": asset_category_id}
# Use request.GET to pre-fill the form with dynamic create batch number data if available
form = (
AssetForm(request.GET, initial=initial_data)
AssetForm(initial={**initial_data, **request.GET.dict()})
if request.GET.get("csrfmiddlewaretoken")
else AssetForm(initial=initial_data)
)
@@ -355,8 +355,7 @@ def asset_list(request, cat_id):
context = {}
asset_under = ""
asset_filtered = AssetFilter(request.GET)
asset_list = asset_filtered.qs.filter(asset_category_id = cat_id)
asset_list = asset_filtered.qs.filter(asset_category_id=cat_id)
paginator = Paginator(asset_list, get_pagination())
page_number = request.GET.get("page")
@@ -389,18 +388,18 @@ def asset_category_creation(request):
Returns:
A rendered HTML template displaying the AssetCategory creation form.
"""
asset_category_form = AssetCategoryForm()
form = AssetCategoryForm()
if request.method == "POST":
asset_category_form = AssetCategoryForm(request.POST)
if asset_category_form.is_valid():
asset_category_form.save()
form = AssetCategoryForm(request.POST)
if form.is_valid():
form.save()
messages.success(request, _("Asset category created successfully"))
asset_category_form = AssetCategoryForm()
form = AssetCategoryForm()
if AssetCategory.objects.filter().count() == 1:
return HttpResponse("<script>window.location.reload();</script>")
context = {"asset_category_form": asset_category_form}
return render(request, "category/asset_category_creation.html", context)
context = {"form": form}
return render(request, "category/asset_category_form.html", context)
@login_required
@@ -418,17 +417,17 @@ def asset_category_update(request, cat_id):
previous_data = request.GET.urlencode()
asset_category = AssetCategory.objects.get(id=cat_id)
asset_category_form = AssetCategoryForm(instance=asset_category)
context = {"asset_category_update_form": asset_category_form, "pg": previous_data}
form = AssetCategoryForm(instance=asset_category)
context = {"form": form, "pg": previous_data}
if request.method == "POST":
asset_category_form = AssetCategoryForm(request.POST, instance=asset_category)
if asset_category_form.is_valid():
asset_category_form.save()
form = AssetCategoryForm(request.POST, instance=asset_category)
if form.is_valid():
form.save()
messages.success(request, _("Asset category updated successfully"))
else:
context["asset_category_form"] = asset_category_form
context["form"] = form
return render(request, "category/asset_category_update.html", context)
return render(request, "category/asset_category_form.html", context)
@login_required
@@ -491,6 +490,7 @@ def filter_pagination_asset_category(request):
"pg": previous_data,
"filter_dict": data_dict,
"dashboard": request.GET.get("dashboard"),
"model": AssetCategory,
}
@@ -1478,7 +1478,7 @@ def asset_batch_update(request, batch_id):
asset_batch_form = AssetBatchForm(request.POST, instance=asset_batch_number)
if asset_batch_form.is_valid():
asset_batch_form.save()
messages.info(request, _("Batch updated successfully."))
messages.success(request, _("Batch updated successfully."))
context["asset_batch_update_form"] = asset_batch_form
return render(request, "batch/asset_batch_number_update.html", context)