403Webshell
Server IP : 65.108.144.40  /  Your IP : 216.73.217.165
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux ubuntu-8gb-hel1-1 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64
User : dev ( 1000)
PHP Version : 8.2.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/erp/asset/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/erp/asset/__pycache__/models.cpython-310.pyc
o

hͦh� �@s�dZddlmZddlmZddlmZddlm	Z	ddl
mZddlm
Z
ddlmZGd	d
�d
e�ZGdd�de�ZGd
d�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZdS)z�
Models for Asset Management System

This module defines Django models to manage assets, their categories, assigning, and requests
within an Asset Management System.
�)�ValidationError)�models)�gettext_lazy)�HorillaCompanyManager)�Company)�Employee)�HorillaModelc@sVeZdZdZejddd�Zejdd�Ze�	�Z
ejede
d�d�Zed�Z
d	d
�ZdS)�
AssetCategoryz>
    Represents a category for different types of assets.
    �T)�
max_length�unique�rr��blank�verbose_name�
company_idcC�|j�S�N)�asset_category_name��self�r�/var/www/erp/asset/models.py�__str__�zAssetCategory.__str__N)�__name__�
__module__�__qualname__�__doc__r�	CharFieldr�	TextField�asset_category_description�Manager�objects�ManyToManyFieldr�_rrrrrrrr	sr	c@sbeZdZdZejddddd�Zejdddd�Zej	e
ded�d	�Ze
�ZGd
d�d�Zdd
�ZdS)�AssetLotzB
    Represents a lot associated with a collection of assets.
    �FT)r�nullrrr
�r(rrrrc@s eZdZdZed�Zed�ZdS)z
AssetLot.Metaz6
        Meta class to add additional options
        zAsset Batchz
Asset BatchesN)rrrrr%r�verbose_name_pluralrrrr�Meta+sr+cCrr)�
lot_numberrrrrr3rzAssetLot.__str__N)rrrrrrr,r �lot_descriptionr$rr%rrr#r+rrrrrr&!sr&cseZdZdZded�fded�fded�fgZejdd�Zej	e
ejddd	�Zej
dddd
�Zejdddd
�Ze��Zejddd�Zej	eejd�Zejeddd�Zej	eejddd	�Zejddd�Zejddd�Zed�ZGdd�d�Zdd�Z�fdd�Z �Z!S)�Assetz5
    Represents a asset with various attributes.
    zIn usezIn Use�	Availablez
Not-Availabler
r
T)�	on_deleter(rr)r'F)rr(r�
�)�
max_digits�decimal_places)r0�()�choices�defaultr�r(r�)r7r(�asset_category_id__company_idc@seZdZdgZdS)z
Asset.Metaz-created_atN)rrr�orderingrrrrr+Rs
r+cCs|j�d|j��S)N�-)�
asset_name�asset_tracking_idrrrrrUsz
Asset.__str__cs<tjj|jd�j|jd�}|��rtdtd�i��t	��
�S)N)r>)�id�asset_descriptionz.An asset with this tracking ID already exists.)r.r#�filterr>�exclude�pk�existsrr%�super�clean)r�existing_asset��	__class__rrrFXs�����
zAsset.clean)"rrrrr%�ASSET_STATUSrrr=�
ForeignKeyr�PROTECT�ownerr r@r>�	DateField�asset_purchase_date�DecimalField�asset_purchase_costr	�asset_category_id�asset_statusr&�asset_lot_number_id�expiry_date�IntegerField�
notify_beforerr#r+rrF�
__classcell__rrrHrr.7s2


��
�r.c@s:eZdZdZejdddd�Zejedej	d�Z
dd�Zd	S)
�AssetReportz�
    Model representing a report for an asset.

    Attributes:
    - title: A CharField for the title of the report (optional).
    - asset_id: A ForeignKey to the Asset model, linking the report to a specific asset.
    r
T)rrr(�asset_report��related_namer0cCs$|jr|j�d|j��Sd|j��S)z�
        Returns a string representation of the AssetReport instance.
        If a title is present, it returns "asset_id - title".
        Otherwise, it returns "report for asset_id".
        z - zreport for )�title�asset_idrrrrrws
��
�zAssetReport.__str__N)rrrrrrr]rKr.�CASCADEr^rrrrrrYis�rYc@sBeZdZdZejddejd�Zejdddd�Z	e�
�Zdd	�Zd
S)�AssetDocumentsa
    Model representing documents associated with an asset report.

    Attributes:
    - asset_report: A ForeignKey to the AssetReport model, linking the document to
    a specific asset report.
    - file: A FileField for uploading the document file (optional).
    rY�	documentsr[zasset/asset_report/documents/T��	upload_torr(cCsd|j��S)Nz
document for )rZrrrrr�szAssetDocuments.__str__N)
rrrrrrKr_rZ�	FileField�filer"r#rrrrrr`�s	��r`c@s eZdZdZejdddd�ZdS)�ReturnImagesz�
    Model representing images associated with a returned asset.

    Attributes:
    - image: A FileField for uploading the image file (optional).
    zasset/return_images/TrbN)rrrrrrd�imagerrrrrf�srfc@s�eZdZdZded�fded�fded�fgZejeej	ed�d�Z
ejeej	dd�Zej
d	d
�Zejeej	dd�Zej
d	d	d�Zejd	d	d
d�Zejedd	d	d�Zejdd�Zed�Zejed	dd�Zejed	dd�Zed�ZGdd�d�Zdd�ZdS)�AssetAssignmentzO
    Represents the allocation and return of assets to and from employees.
    zMinor damagezMajor damage�Healthy�asset�r0r�allocated_employee)r0r\T��auto_now_add�assigned_byr8r
r)r')r6rr(rF)r7�)asset_id__asset_lot_number_id__company_id�
return_images)rr\�
assign_images�7assigned_to_employee_id__employee_work_info__company_idc@�eZdZdZdgZdS)zAssetAssignment.Metaz$Meta class for AssetAssignment model�-idN�rrrrr;rrrrr+��
r+cCs|j�d|j�d|j��S)Nz --- )�assigned_to_employee_idr^�
return_statusrrrrr�szAssetAssignment.__str__N)rrrrr%�STATUSrrKr.rLr^rrxrN�
assigned_date�assigned_by_employee_id�return_dater �return_conditionrry�BooleanField�return_requestrr#r$rfrqrrr+rrrrrrh�sD


��������rhc@s�eZdZdZded�fded�fded�fgZejeej	dddd�Z
ejeej	ed�d	�Zej
d
d�Zejd
d
dd
�Zejdedd
d
d�Zed�ZGdd�d�Zdd�ZdS)�AssetRequestz<
    Represents a request for assets made by employees.
    �	Requested�Approved�Rejected�requested_employeeF)r0r\r(rzAsset CategoryrkTrmr
r)r')rr6r7r(r�5requested_employee_id__employee_work_info__company_idc@rt)zAssetRequest.Metaz!Meta class for AssetRequest modelruNrvrrrrr+�rwr+cCs4dddd�}dddd�}|j}|�|�|�|�d�S)	Nzoh-dot--successzoh-dot--infozoh-dot--danger)r�r�r�zlink-successz	link-infozlink-danger)�color�link)�asset_request_status�get)r�COLOR_CLASS�
LINK_CLASS�statusrrr�status_html_class�s���zAssetRequest.status_html_classN)rrrrr%rzrrKrrL�requested_employee_idr	rRrN�asset_request_dater �descriptionrr�rr#r+r�rrrrr��s4


���
��r�N)r�django.core.exceptionsr�	django.dbr�django.utils.translationrr%�base.horilla_company_managerr�base.modelsr�employee.modelsr�horilla.modelsrr	r&r.rYr`rfrhr�rrrr�<module>s 2.

Youez - 2016 - github.com/yon3zu
LinuXploit