diff --git a/TestDB_Horilla.sqlite3 b/TestDB_Horilla.sqlite3 index 4a430e358..b98a4e952 100755 Binary files a/TestDB_Horilla.sqlite3 and b/TestDB_Horilla.sqlite3 differ diff --git a/asset/forms.py b/asset/forms.py index f0fde614c..1fa66fa2f 100644 --- a/asset/forms.py +++ b/asset/forms.py @@ -54,6 +54,7 @@ class AssetForm(ModelForm): model = Asset fields = "__all__" + exclude = ["is_active"] widgets = { "asset_name": forms.TextInput( attrs={"placeholder": "Macbook Pro.", "class": "oh-input w-100"} @@ -159,6 +160,7 @@ class AssetReportForm(ModelForm): "title", "asset_id", ] + exclude = ["is_active"] # def __init__(self, *args, **kwargs): # super(AssetReportForm, self).__init__(*args, **kwargs) @@ -191,6 +193,7 @@ class AssetCategoryForm(ModelForm): model = AssetCategory fields = "__all__" + exclude = ["is_active"] widgets = { "asset_category_name": forms.TextInput( attrs={"placeholder": _("Computers."), "class": "oh-input w-100"} @@ -225,6 +228,7 @@ class AssetRequestForm(ModelForm): model = AssetRequest fields = "__all__" + exclude = ["is_active"] widgets = { "requested_employee_id": forms.Select( attrs={ @@ -299,7 +303,13 @@ class AssetAllocationForm(ModelForm): model = AssetAssignment fields = "__all__" - exclude = ["return_date", "return_condition", "assigned_date", "return_images"] + exclude = [ + "return_date", + "return_condition", + "assigned_date", + "return_images", + "is_active", + ] widgets = { "asset_id": forms.Select(attrs={"class": "oh-select oh-select-2 "}), "assigned_to_employee_id": forms.Select( @@ -311,10 +321,9 @@ class AssetAllocationForm(ModelForm): }, ), } - + # def clean(self): # cleaned_data = super.clean() - class AssetReturnForm(ModelForm): diff --git a/asset/models.py b/asset/models.py index 89fa60da3..bb2ccb040 100644 --- a/asset/models.py +++ b/asset/models.py @@ -8,12 +8,13 @@ within an Asset Management System. from django.db import models from django.core.exceptions import ValidationError from django.utils.translation import gettext_lazy as _ +from horilla.models import HorillaModel from base.models import Company from base.horilla_company_manager import HorillaCompanyManager from employee.models import Employee -class AssetCategory(models.Model): +class AssetCategory(HorillaModel): """ Represents a category for different types of assets. """ @@ -27,7 +28,7 @@ class AssetCategory(models.Model): return f"{self.asset_category_name}" -class AssetLot(models.Model): +class AssetLot(HorillaModel): """ Represents a lot associated with a collection of assets. """ @@ -41,7 +42,7 @@ class AssetLot(models.Model): return f"{self.lot_number}" -class Asset(models.Model): +class Asset(HorillaModel): """ Represents a asset with various attributes. """ @@ -88,7 +89,7 @@ class Asset(models.Model): return super().clean() -class AssetReport(models.Model): +class AssetReport(HorillaModel): title = models.CharField(max_length=255, blank=True, null=True) asset_id = models.ForeignKey( Asset, related_name="asset_report", on_delete=models.CASCADE @@ -118,7 +119,7 @@ class ReturnImages(models.Model): image = models.FileField(upload_to="asset/return_images/", blank=True, null=True) -class AssetAssignment(models.Model): +class AssetAssignment(HorillaModel): """ Represents the allocation and return of assets to and from employees. """ @@ -159,7 +160,7 @@ class AssetAssignment(models.Model): return f"{self.assigned_to_employee_id} --- {self.asset_id} --- {self.return_status}" -class AssetRequest(models.Model): +class AssetRequest(HorillaModel): """ Represents a request for assets made by employees. """ diff --git a/asset/templates/category/asset_category.html b/asset/templates/category/asset_category.html index d3b921999..4798bcbe9 100644 --- a/asset/templates/category/asset_category.html +++ b/asset/templates/category/asset_category.html @@ -20,7 +20,7 @@