Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Time Off

Entity: hr.leave.allocation

Compute Method: _compute_can_approve

View 18.0 View 20.0
Inputs Method Outputs
  • state
  • validation_type
for allocation in self:
-             try:
-                 if allocation.state == 'confirm' and allocation.validation_type == 'both':
-                     allocation._check_approval_update('validate1')
-                 else:
-                     allocation._check_approval_update('validate')
-             except (AccessError, UserError):
-                 allocation.can_approve = False
-             else:
-                 allocation.can_approve = True
+             allocation.can_approve = allocation._check_approval_update('validate1', raise_if_not_possible=False)
  • can_approve

Back to entity