[UPDT] PAYROLL: Updated payroll rembursment and loan account model by adding abstract class

This commit is contained in:
Horilla
2024-03-26 14:18:37 +05:30
parent edb92f344b
commit 4dbb92c342
2 changed files with 7 additions and 6 deletions

View File

@@ -164,9 +164,9 @@ class WorkRecordForm(ModelForm):
model = WorkRecord
class ReimbursementrequestCommentForm(ModelForm):
class ReimbursementRequestCommentForm(ModelForm):
"""
ReimbursementrequestCommentForm form
ReimbursementRequestCommentForm form
"""
class Meta:
@@ -176,6 +176,7 @@ class ReimbursementrequestCommentForm(ModelForm):
model = ReimbursementrequestComment
fields = ("comment",)
exclude = ["is_active"]
class EncashmentGeneralSettingsForm(ModelForm):

View File

@@ -1472,22 +1472,22 @@ def create_payrollrequest_comment(request, payroll_id):
This method renders form and template to create Reimbursement request comments
"""
from payroll.forms.forms import (
ReimbursementrequestCommentForm,
ReimbursementRequestCommentForm,
)
payroll = Reimbursement.objects.filter(id=payroll_id).first()
emp = request.user.employee_get
form = ReimbursementrequestCommentForm(
form = ReimbursementRequestCommentForm(
initial={"employee_id": emp.id, "request_id": payroll_id}
)
if request.method == "POST":
form = ReimbursementrequestCommentForm(request.POST)
form = ReimbursementRequestCommentForm(request.POST)
if form.is_valid():
form.instance.employee_id = emp
form.instance.request_id = payroll
form.save()
form = ReimbursementrequestCommentForm(
form = ReimbursementRequestCommentForm(
initial={"employee_id": emp.id, "request_id": payroll_id}
)
messages.success(request, _("Comment added successfully!"))