Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Notifications for Timesheet Submission to Project Manager #23

Open
KanchanChauhan opened this issue Sep 16, 2024 · 2 comments
Open
Assignees
Milestone

Comments

@KanchanChauhan
Copy link

Notify the Project Manager when an employee submits a timesheet for approval and Send notification on Timesheet submitted for Approval is checked on Slack Settings.

Notification message:
"{{employee}} has submitted a timesheet for approval. {{link to employee timesheet on app}}"

@ananyo141
Copy link
Contributor

ananyo141 commented Oct 3, 2024

BLOCKER:

For timesheet approval, the API in frappe_pms loops over the timesheet entries and updates the approval status like this:

#  file: api/timesheet.py
    length = len(timesheets)
    for index, timesheet in enumerate(timesheets):
        doc = frappe.get_doc("Timesheet", timesheet.name)
        doc.custom_approval_status = "Approval Pending"
        doc.save()

So, the slack notification is being triggered multiple times for each timesheet update:

def on_update(doc, method):
    """
    Send a slack message to the timesheet approver when a new timesheet
    is submitted for approval.
    """
    if doc.custom_weekly_approval_status == "Approval Pending":
        frappe.enqueue(
            send_timesheet_approval_notification_bg,
            queue="short",
            doc=doc,
        )

Getting multiples:

Screenshot 2024-10-03 at 3 25 23 PM

@KanchanChauhan
Copy link
Author

@ananyo141 We will have to implement this particular Notification in rtCamp since it is very specific to rtCamp as Approval Status is our custom field and only we follow weekly submissions and approvals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants