Skip to content

feat: timesheet rejection flow updates - #2136

Open
robinroy03 wants to merge 4 commits into
version-16-hotfixfrom
feat/2112
Open

feat: timesheet rejection flow updates#2136
robinroy03 wants to merge 4 commits into
version-16-hotfixfrom
feat/2112

Conversation

@robinroy03

Copy link
Copy Markdown
Member

Description

  1. a rejected timesheet is not editable
  2. a rejected timesheet hours goes to 0 - logged in a new field instead
  3. a rejected timesheet is color coded properly now (red with (x). the normal ones dont have this)

Relevant Technical Choices

  1. new field introduced for logging
  2. migration script for existing draft timesheets
  3. deletion/edit lock for rejected timesheets
  4. UI changes to support this

Testing Instructions

  1. make a new timesheet and reject it - observe the UI changes
  2. observe the 0 value in sum and other areas

Screenshot/Screencast

image image image image image image image image

Checklist

  • I have carefully reviewed the code before submitting it for review.
  • This code is adequately covered by unit tests to validate its functionality.
  • I have conducted thorough testing to ensure it functions as intended.
  • A member of the QA team has reviewed and tested this PR (To be checked by QA or code reviewer)
  • I have reviewed and updated the documentation as needed.

Fixes #2112

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The migration can zero resubmitted hours or permanently skip records, and single-entry rejected timesheets remain deletable.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds persistent rejected-hour tracking so rejected work remains visible but is excluded from totals and cannot be edited.

Changes:

  • Adds and migrates the rejected_hours field.
  • Locks rejected entries and excludes their hours from calculations.
  • Updates personal/team interfaces and integration tests.
File summaries
File Description
next_pms/timesheet/utils/constant.py Exposes rejected hours through APIs.
next_pms/timesheet/patches/setup_timesheet_rejected_hours_field.py Adds field setup patch.
next_pms/timesheet/patches/park_rejected_hours_on_draft_timesheets.py Migrates legacy rejected entries.
next_pms/timesheet/doc_events/timesheet.py Parks and locks rejected rows.
next_pms/timesheet/api/team.py Preserves historical rejection reasons.
next_pms/tests/timesheet/doc_events/test_zero_hours_validation.py Tests zero-hour validation.
next_pms/tests/timesheet/api/test_timesheet_rejection_reason.py Updates rejection lifecycle expectations.
next_pms/tests/timesheet/api/test_rejected_timesheet_hours.py Tests rejection behavior and calculations.
next_pms/project_currency/overrides/timesheet.py Allows parked rejected rows.
next_pms/patches.txt Registers migration patches.
next_pms/install.py Defines the rejected-hours field.
frontend/packages/app/src/types/timesheet.ts Adds rejected-hour typing.
frontend/packages/app/src/pages/timesheet/team/weekly-approval/utils.ts Maps rejected entry state.
frontend/packages/app/src/pages/timesheet/team/weekly-approval/types.ts Extends approval types.
frontend/packages/app/src/pages/timesheet/team/weekly-approval/entryRow.tsx Renders rejected entries read-only.
frontend/packages/app/src/lib/utils.ts Adds rejected-hour aggregation.
frontend/packages/app/src/components/timesheet-row/components/row/taskRow.tsx Displays rejected totals and status.
frontend/packages/app/src/components/timesheet-row/components/inline-time-entry/index.tsx Shows and locks rejected entries.
Review details

Suppressed comments (1)

next_pms/timesheet/patches/park_rejected_hours_on_draft_timesheets.py:25

  • Catching ValidationError lets the patch return successfully, so Frappe records it as executed even though this selected rejected timesheet still has counted hours. The log does not provide any automatic retry, leaving production data permanently split between the old and new invariants. Either update the affected fields/totals through a migration-safe path, or re-raise after logging so the migration cannot be marked complete until every selected document is handled.
        try:
            doc.save(ignore_permissions=True)
        except frappe.ValidationError:
            # A document that no longer passes its own validation is left as it was.
            frappe.log_error(title=f"Could not park rejected hours on {name}")
  • Files reviewed: 18/18 changed files
  • Comments generated: 2
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread next_pms/timesheet/patches/park_rejected_hours_on_draft_timesheets.py Outdated
Comment thread next_pms/timesheet/doc_events/timesheet.py
@robinroy03
robinroy03 requested a review from b1ink0 September 4, 2026 11:47
b1ink0
b1ink0 previously approved these changes Sep 4, 2026

@b1ink0 b1ink0 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM FE changes

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants