Skip to content

[IMP] hr_holidays_ux: prevent auto-approval in batch allocations#63

Open
mav-adhoc wants to merge 1 commit into
ingadhoc:19.0from
adhoc-dev:19.0-t-64815-mav
Open

[IMP] hr_holidays_ux: prevent auto-approval in batch allocations#63
mav-adhoc wants to merge 1 commit into
ingadhoc:19.0from
adhoc-dev:19.0-t-64815-mav

Conversation

@mav-adhoc

Copy link
Copy Markdown
Contributor

Summary

  • Override action_generate_allocations on hr.leave.allocation.generate.multi.wizard so allocations created via "New Group Allocation" stay in confirm (To Approve) instead of being auto-approved. Types with no_validation still auto-approve via the create() hook.
  • Add action_reset_to_confirm on hr.leave.allocation to revert validated allocations back to confirm. Raises UserError if leaves_taken > 0; permission checks delegated to _check_approval_update.
  • Add server action bound to the allocation list view (Actions menu) to expose action_reset_to_confirm.

Test plan

  • Open "New Group Allocation" wizard, fill in a leave type with validation "By Time Off Officer", generate → allocations should land in "To Approve" (not "Approved").
  • For a leave type with "No Validation", same wizard → allocations still auto-approve.
  • From the allocation list, select approved allocations with no leaves taken → Actions → "Reset to To Approve" → state changes to confirm.
  • Same action on an allocation with leaves_taken > 0 → UserError raised.
  • Same action as a non-officer user → UserError from _check_approval_update.

Related task: https://www.adhoc.inc/odoo/knowledge/180/902/tasks/64815

Override action_generate_allocations on the multi-allocation wizard so
allocations created via "New Group Allocation" stay in 'confirm' (To Approve)
instead of being auto-approved, regardless of the leave type's validation
setting.  no_validation types still auto-approve via the create() hook.

Add action_reset_to_confirm on hr.leave.allocation to revert validated
allocations back to 'confirm'.  Blocked when leaves_taken > 0; permission
checks delegated to _check_approval_update (officer role required).

Add server action bound to the allocation list view to expose
action_reset_to_confirm from the Actions menu.
@roboadhoc

Copy link
Copy Markdown

Pull request status dashboard

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.

2 participants