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/horilla_api/api_serializers/payroll/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/erp/horilla_api/api_serializers/payroll/__pycache__/serializers.cpython-310.pyc
o

hͦhZ-�@s�ddlmZddlmZmZddlmZddlmZm	Z	m
Z
mZmZm
Z
mZmZddlmZGdd�dej�ZGdd	�d	ej�ZGd
d�dej�ZGdd
�d
ej�ZGdd�dej�ZGdd�dej�ZGdd�dej�ZGdd�dej�ZdS)�)�serializers)�
BonusPoint�Employee)�	LeaveType)�	Allowance�Contract�	Deduction�LoanAccount�MultipleCondition�Payslip�
Reimbursement�ReimbursementMultipleAttachment)�
TaxBracketc@s�eZdZejddd�Zejddd�Zejddd�Zejddd�Zej	dd�Z
ejddd�Zejd	dd�ZGd
d�d�Z
dd
�ZdS)�PayslipSerializer�employee_id.employee_first_nameT��source�	read_only�employee_id.employee_last_name�shift_id.employee_shift�employee_id.badge_id�rz7employee_id.employee_work_info.department_id.departmentz0employee_id.employee_bank_details.account_numberc@�eZdZeZdZdS)zPayslipSerializer.Meta�__all__N)�__name__�
__module__�__qualname__r�model�fields�rr�?/var/www/erp/horilla_api/api_serializers/payroll/serializers.py�Meta#�r!cC�z|jj}|jWSYdS�N��employee_id�employee_profile�url��self�objr'rrr �get_employee_profile_url*�
z*PayslipSerializer.get_employee_profile_urlN)rrrr�	CharField�employee_first_name�employee_last_name�
shift_name�badge_id�SerializerMethodField�employee_profile_url�department_name�bank_account_check_numberr!r,rrrr rs$����rc@s�eZdZejddd�Zejddd�Zejddd�Zejddd�Zej	dd�Z
ejddd�Zejd	dd�Zejd
dd�Z
ejddd�Zejddd�Zdd
�ZGdd�d�ZdS)�ContractSerializerrTrrrrrzjob_position_id.job_positionzjob_role_id.job_rolezdepartment_id.departmentzwork_type_id.work_typecCr#r$r%r)rrr r,Ir-z+ContractSerializer.get_employee_profile_urlc@r)zContractSerializer.MetarN)rrrrrrrrrr r!Pr"r!N)rrrrr.r/r0r1r2r3r4�job_position_name�
job_role_namer5�work_type_namer,r!rrrr r72s.�����r7c@�eZdZGdd�d�ZdS)�MultipleConditionSerializerc@r)z MultipleConditionSerializer.MetarN)rrrr
rrrrrr r!Vr"r!N�rrrr!rrrr r<U�r<c@sleZdZejej��ddd�Zejej��ddd�Z	eje
j��ddd�ZGdd�d�Zdd�Z
dd	�Zd
S)�AllowanceSerializerTF)�queryset�many�requiredc@seZdZeZdZgd�ZdS)zAllowanceSerializer.Metar)�id�
company_id�only_show_under_employee�is_loanN)rrrrrr�read_only_fieldsrrrr r!fsr!cCs^|�dg�}|�dg�}|�dg�}tjjdi|��}|j�|�|j�|�|j�|�|S)N�specific_employees�exclude_employees�other_conditionsr)�popr�objects�createrH�setrIrJ)r*�validated_datarHrIrJ�	allowancerrr rMkszAllowanceSerializer.createcCs|�d�}|�d�}|�d�}|�d�}|�d�}|�d�}|�d�}|�d�}	|�d	�}
|�d
�}|�d�}|�d�}
|rK|dusF|d
krKt�d��|sT|sTt�d��|dkr_|s_t�d��|dkrj|sjt�d��|dkru|sut�d��|r�|	r}|r}|
s�t�d��|r�|
dur�t�d��|S)N�is_fixed�amount�based_on�per_attendance_fixed_amount�shift_id�work_type_id�is_condition_based�field�	condition�value�
has_max_limit�maximum_amountrz:If 'is_fixed' is True, 'amount' must be a positive number.z/If 'is_fixed' is False, 'based_on' is required.�
attendancezIIf 'based_on' is 'attendance', 'per_attendance_fixed_amount' is required.z4If 'based_on' is 'shift_id', 'shift_id' is required.z<If 'based_on' is 'work_type_id', 'work_type_id' is required.zPIf 'is_condition_based' is True, 'field', 'value', and 'condition' are required.z9If 'has_max_limit' is True, 'maximum_amount' is required.)�getr�ValidationError)r*�datarQrRrSrTrUrVrWrXrYrZr[r\rrr �validateysR











�������zAllowanceSerializer.validateN)rrrr�PrimaryKeyRelatedFieldrrL�allrHrIr
rJr!rMrarrrr r?[s���r?c@r;)�DeductionSerializerc@r)zDeductionSerializer.MetarN)rrrrrrrrrr r!�r"r!Nr=rrrr rd�r>rdc@sXeZdZejdd�Zejddd�Zejddd�Zejddd�Z	Gdd�d�Z
d	d
�ZdS)�LoanAccountSerializerTr�employee_id.get_full_namerrzemployee_id.get_job_positionc@r)zLoanAccountSerializer.MetarN)rrrr	rrrrrr r!�r"r!cCr#r$r%r)rrr r,�r-z.LoanAccountSerializer.get_employee_profile_urlN)rrrrr3r4r.�employee_full_namer2r8r!r,rrrr re�s��recs�eZdZe��Zejddd�Zejdd�Zejdd�Z	ejdd�Z
dd	�ZGd
d�d�Zdd
�Z
�fdd�Zdd�Zdd�Z�fdd�Z�ZS)�ReimbursementSerializerzleave_type_id.nameTrrr)rrfcCr#r$r%r)rrr r,�r-z0ReimbursementSerializer.get_employee_profile_urlc@r)zReimbursementSerializer.MetarN)rrrrrrrrrr r!�r"r!cCs4g}|j��D]}z	|�|jj�WqYq|Sr$)�other_attachmentsrc�append�
attachmentr()r*r+�attachmentsrkrrr �get_other_attachements�sz.ReimbursementSerializer.get_other_attachementscs�t�j|i|��g}t|jdd�}|dkr|�gd��n|dkr*|�gd��n|dkr5|�gd��|D]	}|j�|d�q7dS)N�type�
reimbursement)�
leave_type_id�
cfd_to_encash�ad_to_encash�bonus_to_encash�leave_encashment)rkrRrs�bonus_encashment)rkrRrprqrr)�super�__init__�getattr�instance�extendrrK)r*�args�kwargs�exclude_fields�
instance_typerX��	__class__rr rw�s ���z ReimbursementSerializer.__init__cCstjj|ddd�}|S)N�T)�%employee_available_leave__employee_id�/employee_available_leave__total_leave_days__gte�
is_encashable)rrL�filter)r*�employee�leavesrrr �get_encashable_leaves�s�z-ReimbursementSerializer.get_encashable_leavescCs�z|jj}|jj}|jj}Wn|d}|d}|�dd�r$|dnd}Ytjj|d���}|dkrZz|jj	}Wn|d}Y|j
|krOt�ddi��|dkrZt�dd	i��|d
krt|}|�
|�}|dusm||vrtt�ddi��|S)Nr&rnrp)r&rursz!Not enough bonus points to redeemrz+Points must be greater than zero to redeem.rtz!This leave type is not encashable)ryr&rnrpr^rrLr��firstrs�pointsrr_r�)r*r`r&rnrp�available_pointsrs�encashable_leavesrrr ras>�

��
�z ReimbursementSerializer.validatecspg}|jdj}|�d�}|r$|D]}t�}||_|��|�|j�qt���}|j	j
|�t�jdi|��S)N�requestrkr)�context�FILES�getlistr
rk�saverj�pkrvri�add)r*r|�multiple_attachment_ids�
request_filesrlrk�
file_instanceryrrr r�,s

zReimbursementSerializer.save)rrrrr3�other_attachementsr.�leave_type_namer4r2rgr,r!rmrwr�rar��
__classcell__rrrr rh�s	%rhc@r;)�TaxBracketSerializerc@seZdZdZeZdS)zTaxBracketSerializer.MetarN)rrrrrrrrrr r!>r"r!Nr=rrrr r�=r>r�N)�rest_frameworkr�employee.modelsrr�leave.modelsr�payroll.models.modelsrrrr	r
rrr
�payroll.models.tax_modelsr�ModelSerializerrr7r<r?rdrerhr�rrrr �<module>s(
 #Rt

Youez - 2016 - github.com/yon3zu
LinuXploit