Skip to content

Commit 7d2261d

Browse files
committed
feat: Add old_balance flag to vacation creation
- Add `is_old_balance` to vacation serializer - Pass `is_old_balance` to Vacation model creation - Pass `is_old_balance` to VacationNotification
1 parent f78aeff commit 7d2261d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

server/cshr/views/vacations.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ def post(self, request: Request, user_id: str) -> Response:
441441
reason = serializer.validated_data.get("reason")
442442
from_date = serializer.validated_data.get("from_date")
443443
end_date = serializer.validated_data.get("end_date")
444+
is_old_balance = request.data.get("old_balance", False)
444445
applying_user = get_user_by_id(user_id)
445446

446447
if applying_user is None:
@@ -456,6 +457,7 @@ def post(self, request: Request, user_id: str) -> Response:
456457
reason=reason,
457458
from_date=from_date,
458459
end_date=end_date,
460+
is_old_balance=is_old_balance,
459461
)
460462

461463
vacation_days = 0
@@ -480,6 +482,7 @@ def post(self, request: Request, user_id: str) -> Response:
480482
type=TYPE_CHOICES.VACATIONS,
481483
status=STATUS_CHOICES.APPROVED,
482484
actual_days=vacation_days,
485+
is_old_balance=is_old_balance,
483486
)
484487

485488
notification_service = VacationNotification(

0 commit comments

Comments
 (0)