Skip to content

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

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

[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
Contributor

Pull request status dashboard

@jcadhoc

jcadhoc commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

@roboadhoc r+ nobump

roboadhoc pushed a commit that referenced this pull request Jun 25, 2026
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.

closes #63

Signed-off-by: Juan Carreras <jc@adhoc.com.ar>
@roboadhoc roboadhoc closed this in 2aa0b49 Jun 25, 2026
@roboadhoc roboadhoc deleted the 19.0-t-64815-mav branch June 25, 2026 16:04
@roboadhoc roboadhoc added the 18.1 label Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants