Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions hrms/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def get_unread_notifications_count() -> int:
)


@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def mark_all_notifications_as_read() -> None:
frappe.db.set_value(
"PWA Notification",
Expand Down Expand Up @@ -749,7 +749,7 @@ def get_attachments(dt: str, dn: str):
)


@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def upload_base64_file(
content: str, filename: str, dt: str | None = None, dn: str | None = None, fieldname: str | None = None
):
Expand Down Expand Up @@ -793,7 +793,7 @@ def upload_base64_file(
).insert()


@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def delete_attachment(filename: str):
attached_to_doctype, attached_to_name = frappe.db.get_value(
"File", filename, ["attached_to_doctype", "attached_to_name"]
Expand Down
10 changes: 5 additions & 5 deletions hrms/api/roster.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def get_schedule_from_assignment(shift_schedule_assignment: str):
return {"frequency": frequency, "repeat_on_days": repeat_on_days}


@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def create_shift_schedule_assignment(
employee: str,
company: str,
Expand Down Expand Up @@ -124,7 +124,7 @@ def create_shift_schedule_assignment(
)


@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def delete_shift_schedule_assignment(shift_schedule_assignment: str) -> None:
shift_schedule_assignment_doc = frappe.get_doc("Shift Schedule Assignment", shift_schedule_assignment)
shift_schedule_assignment_doc.check_permission("delete")
Expand All @@ -141,7 +141,7 @@ def delete_shift_schedule_assignment(shift_schedule_assignment: str) -> None:
frappe.delete_doc("Shift Schedule Assignment", shift_schedule_assignment, ignore_permissions=True)


@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def swap_shift(
src_shift: str, src_date: str, tgt_employee: str, tgt_date: str, tgt_shift: str | None
) -> None:
Expand Down Expand Up @@ -190,7 +190,7 @@ def swap_shift(
)


@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def break_shift(assignment: str | ShiftAssignment, date: str) -> None:
if isinstance(assignment, str):
assignment = frappe.get_doc("Shift Assignment", assignment)
Expand Down Expand Up @@ -223,7 +223,7 @@ def break_shift(assignment: str | ShiftAssignment, date: str) -> None:
)


@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def insert_shift(
employee: str,
company: str,
Expand Down
2 changes: 1 addition & 1 deletion hrms/hr/doctype/appraisal/appraisal.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def calculate_final_score(self):

self.final_score = flt(final_score, self.precision("final_score"))

@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def add_feedback(self, feedback: str, feedback_ratings: list) -> Document:
feedback = frappe.get_doc(
{
Expand Down
4 changes: 2 additions & 2 deletions hrms/hr/doctype/appraisal_cycle/appraisal_cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def get_appraisal_template_map(self):

return appraisal_templates

@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def create_appraisals(self):
self.check_permission("write")
if not self.appraisees:
Expand Down Expand Up @@ -168,7 +168,7 @@ def show_missing_template_message(self, raise_exception=False):
msg, title=_("Appraisal Template Missing"), indicator="yellow", raise_exception=raise_exception
)

@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def complete_cycle(self):
self.check_permission("write")

Expand Down
2 changes: 1 addition & 1 deletion hrms/hr/doctype/attendance/attendance.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ def mark_attendance(
return attendance.name


@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def mark_bulk_attendance(data: str | dict):
import json

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def _get_unmarked_attendance_with_shift(unmarked_attendance, shift, date):
return shiftwise_unmarked_attendance


@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def mark_employee_attendance(
employee_list: list | str,
status: str,
Expand Down
4 changes: 2 additions & 2 deletions hrms/hr/doctype/employee_checkin/employee_checkin.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def validate_distance_from_shift_location(self):
)


@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def add_log_based_on_employee_field(
employee_field_value: str | int,
timestamp: str | datetime,
Expand Down Expand Up @@ -218,7 +218,7 @@ def add_log_based_on_employee_field(
return doc


@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def bulk_fetch_shift(checkins: list[str] | str) -> None:
if isinstance(checkins, str):
checkins = frappe.json.loads(checkins)
Expand Down
2 changes: 1 addition & 1 deletion hrms/hr/doctype/employee_onboarding/employee_onboarding.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def on_update_after_submit(self):
def on_cancel(self):
super().on_cancel()

@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def mark_onboarding_as_completed(self):
self.check_permission("write")
for activity in self.activities:
Expand Down
2 changes: 1 addition & 1 deletion hrms/hr/doctype/employee_referral/employee_referral.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def on_discard(self):
self.db_set("status", "Cancelled")


@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def create_job_applicant(source_name: str, target_doc: str | Document | None = None) -> Document:
emp_ref = frappe.get_doc("Employee Referral", source_name)
# just for Api call if some set status apart from default Status
Expand Down
2 changes: 1 addition & 1 deletion hrms/hr/doctype/exit_interview/exit_interview.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def update_interview_date_in_employee(self):
frappe.db.set_value("Employee", self.employee, "held_on", None)


@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def send_exit_questionnaire(interviews: str | list) -> None:
interviews = get_interviews(interviews)
validate_questionnaire_settings()
Expand Down
6 changes: 3 additions & 3 deletions hrms/hr/doctype/goal/goal.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def _update_goal_completion_status(goals: list[dict]) -> list[dict]:
return goals


@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def update_progress(progress: float, goal: str) -> None:
goal = frappe.get_doc("Goal", goal)
goal.progress = progress
Expand All @@ -235,7 +235,7 @@ def update_progress(progress: float, goal: str) -> None:
return goal


@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def update_status(status: str, goals: str | list) -> None:
if isinstance(goals, str):
import json
Expand All @@ -253,7 +253,7 @@ def update_status(status: str, goals: str | list) -> None:
return goals


@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def add_tree_node():
from frappe.desk.treeview import make_tree_args

Expand Down
6 changes: 3 additions & 3 deletions hrms/hr/doctype/interview/interview.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def get_job_applicant_status(self) -> str | None:
status_map = {"Cleared": "Accepted", "Rejected": "Rejected"}
return status_map.get(self.status, None)

@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def reschedule_interview(
self, scheduled_on: datetime.date, from_time: datetime.time, to_time: datetime.time
) -> None:
Expand Down Expand Up @@ -220,7 +220,7 @@ def get_skill_wise_average_rating(interview: str) -> list[dict]:
).run(as_dict=True)


@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def update_job_applicant_status(status: str, job_applicant: str):
try:
if not job_applicant:
Expand Down Expand Up @@ -348,7 +348,7 @@ def get_expected_skill_set(interview_type: str):
)


@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def create_interview_feedback(data: str | dict, interview_name: str, interviewer: str, job_applicant: str):
import json

Expand Down
4 changes: 2 additions & 2 deletions hrms/hr/doctype/job_applicant/job_applicant.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def set_missing_values(source, target):
)


@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def create_kanban_board(board_name: str) -> dict:
frappe.has_permission("Job Applicant", throw=True)

Expand Down Expand Up @@ -212,7 +212,7 @@ def create_interview(job_applicant: str, interview_type: str) -> Document:
return interview


@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def schedule_interview(
job_applicant: str,
interview_type: str,
Expand Down
2 changes: 1 addition & 1 deletion hrms/hr/doctype/job_requisition/job_requisition.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def check_duplicate_job_requisition(self):
},
)

@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def associate_job_opening(self, job_opening: str) -> None:
frappe.has_permission("Job Opening", "write", job_opening, throw=True)
frappe.db.set_value(
Expand Down
10 changes: 5 additions & 5 deletions hrms/hr/doctype/leave_allocation/leave_allocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def validate_back_dated_allocation(self):
BackDatedAllocationError,
)

@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def set_total_leaves_allocated(self):
self.unused_leaves = flt(
get_carry_forwarded_leaves(self.employee, self.leave_type, self.from_date, self.carry_forward),
Expand Down Expand Up @@ -358,7 +358,7 @@ def create_leave_ledger_entry(self, submit=True):
)
create_leave_ledger_entry(self, args, submit)

@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def allocate_leaves_manually(self, new_leaves: str | float, from_date: str | datetime.date | None = None):
self.check_permission("write")
if from_date and not (getdate(self.from_date) <= getdate(from_date) <= getdate(self.to_date)):
Expand Down Expand Up @@ -438,7 +438,7 @@ def get_monthly_earned_leave(self):

return _get_monthly_earned_leave(doj, annual_allocation, frequency, rounding)

@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def create_leave_adjustment(
self,
adjustment_type: str,
Expand All @@ -460,7 +460,7 @@ def create_leave_adjustment(
leave_adjustment.submit()
frappe.msgprint(_("Adjustment Created Successfully"), indicator="green", alert=True)

@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def retry_failed_allocations(self, failed_allocations: list) -> None:
if not frappe.has_permission(doctype="Leave Allocation", ptype="write", user=frappe.session.user):
frappe.throw(_("You do not have permission to complete this action"), frappe.PermissionError)
Expand Down Expand Up @@ -621,7 +621,7 @@ def show_expire_leave_dialog(expired_leaves, leave_type):
)


@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def expire_carried_forward_allocation():
if frappe.has_permission(doctype="Leave Allocation", ptype="submit", user=frappe.session.user):
process_expired_allocation()
Expand Down
2 changes: 1 addition & 1 deletion hrms/hr/doctype/leave_control_panel/leave_control_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def validate_fields(self, employees: list):
mandatory_fields.extend(["leave_type", "no_of_days"])
validate_bulk_tool_fields(self, mandatory_fields, employees, "from_date", "to_date")

@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def allocate_leave(self, employees: list):
self.validate_fields(employees)
if self.allocate_based_on_leave_policy:
Expand Down
2 changes: 1 addition & 1 deletion hrms/hr/doctype/leave_ledger_entry/leave_ledger_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def get_remaining_leaves(allocation):
)


@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def expire_allocation(allocation: str | Document | frappe._dict, expiry_date: datetime.date | None = None):
"""expires non-carry forwarded allocation"""
import json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ def calculate_pro_rated_leaves(
return rounded(leaves)


@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def create_assignment_for_multiple_employees(employees: str | list[str], data: str | dict) -> list[str]:
if isinstance(employees, str):
employees = json.loads(employees)
Expand Down Expand Up @@ -527,7 +527,7 @@ def create_assignment_for_multiple_employees(employees: str | list[str], data: s
return docs_name


@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def create_assignment(employee: str, data: frappe._dict) -> Document:
assignment = frappe.new_doc("Leave Policy Assignment")
assignment.employee = employee
Expand Down
2 changes: 1 addition & 1 deletion hrms/hr/doctype/overtime_slip/overtime_slip.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def get_frequency_and_dates(self):
)
)

@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def get_emp_and_overtime_details(self):
records = self.get_attendance_records()
if len(records):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def get_query_checking_overlapping_shift_timings(self, query, doctype, shift_typ
.where((end_time_case >= shift_start) & (ShiftType.start_time <= shift_end))
)

@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def bulk_assign(self, employees: list):
if self.action == "Assign Shift":
mandatory_fields = ["shift_type"]
Expand Down Expand Up @@ -280,7 +280,7 @@ def _bulk_assign(self, employees: list):
after_commit=True,
)

@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def bulk_process_shift_requests(self, shift_requests: list, status: str):
if not shift_requests:
frappe.throw(
Expand Down
2 changes: 1 addition & 1 deletion hrms/hr/doctype/shift_type/shift_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def unlinked_checkins_exist(self):
{"shift": self.name, "attendance": ["is", "not set"], "skip_auto_attendance": 0, "offshift": 0},
)

@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def process_auto_attendance(self, is_manually_triggered: int | bool = False) -> None | str:
if self.has_incorrect_shift_config():
return
Expand Down
2 changes: 1 addition & 1 deletion hrms/overrides/employee_payment_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ def get_total_amount_and_exchange_rate(ref_doc, party_account_currency, company_


# update exchange rate in linked advance
@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def set_exchange_rate_in_advance(doc: Document, method: None = None):
if doc.references:
for reference_doc in doc.references:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def get_employees(self, advanced_filters: list) -> list:
)
return query.run(as_dict=True)

@frappe.whitelist()
@frappe.whitelist(methods=["POST"])
def bulk_assign_structure(self, employees: list) -> None:
mandatory_fields = ["salary_structure", "from_date", "company"]
validate_bulk_tool_fields(self, mandatory_fields, employees)
Expand Down
Loading
Loading