feat: timesheet rejection flow updates - #2136
Open
robinroy03 wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
🟡 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_hoursfield. - 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
ValidationErrorlets 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Relevant Technical Choices
Testing Instructions
Screenshot/Screencast
Checklist
Fixes #2112