Skip to content
Permalink
Browse files

[FIX] hr_holidays: Use correct term in allocation messages

closes #31892
closes #32063
  • Loading branch information...
LucasLefevre committed Apr 3, 2019
1 parent 0ccac18 commit 1c291f83b24e8c97e8d739141ec80c508f9b1eb2
Showing with 12 additions and 12 deletions.
  1. +12 −12 addons/hr_holidays/models/hr_leave_allocation.py
@@ -42,10 +42,10 @@ def _default_holiday_status_id(self):
('validate1', 'Second Approval'),
('validate', 'Approved')
], string='Status', readonly=True, tracking=True, copy=False, default='confirm',
help="The status is set to 'To Submit', when a time off request is created." +
"\nThe status is 'To Approve', when time off request is confirmed by user." +
"\nThe status is 'Refused', when time off request is refused by manager." +
"\nThe status is 'Approved', when time off request is approved by manager.")
help="The status is set to 'To Submit', when an allocation request is created." +
"\nThe status is 'To Approve', when an allocation request is confirmed by user." +
"\nThe status is 'Refused', when an allcoation request is refused by manager." +
"\nThe status is 'Approved', when an allocation request is approved by manager.")
date_from = fields.Datetime(
'Start Date', readonly=True, index=True, copy=False,
states={'draft': [('readonly', False)], 'confirm': [('readonly', False)]}, tracking=True)
@@ -77,10 +77,10 @@ def _default_holiday_status_id(self):
linked_request_ids = fields.One2many('hr.leave.allocation', 'parent_id', string='Linked Requests')
first_approver_id = fields.Many2one(
'hr.employee', string='First Approval', readonly=True, copy=False,
help='This area is automatically filled by the user who validate the time off', oldname='manager_id')
help='This area is automatically filled by the user who validates the allocation', oldname='manager_id')
second_approver_id = fields.Many2one(
'hr.employee', string='Second Approval', readonly=True, copy=False, oldname='manager_id2',
help='This area is automaticly filled by the user who validate the time off with second level (If time off type need second validation)')
help='This area is automaticly filled by the user who validates the allocation with second level (If time off type needs second validation)')
allocation_validation_type = fields.Selection('Validation Type', related='holiday_status_id.allocation_validation_type', readonly=True)
can_reset = fields.Boolean('Can reset', compute='_compute_can_reset')
can_approve = fields.Boolean('Can Approve', compute='_compute_can_approve')
@@ -358,12 +358,12 @@ def write(self, values):
@api.multi
def unlink(self):
for holiday in self.filtered(lambda holiday: holiday.state not in ['draft', 'cancel', 'confirm']):
raise UserError(_('You cannot delete a time off which is in %s state.') % (holiday.state,))
raise UserError(_('You cannot delete an allocation which is in %s state.') % (holiday.state,))
return super(HolidaysAllocation, self).unlink()

@api.multi
def copy_data(self, default=None):
raise UserError(_('A time off cannot be duplicated.'))
raise UserError(_('An allocation cannot be duplicated.'))

####################################################
# Business methods
@@ -496,11 +496,11 @@ def _check_approval_update(self, state):

if state == 'draft':
if holiday.employee_id != current_employee and not is_manager:
raise UserError(_('Only a time off Manager can reset other people time off.'))
raise UserError(_('Only a time off Manager can reset other people allocations.'))
continue

if not is_officer:
raise UserError(_('Only a time off Officer or Manager can approve or refuse time off requests.'))
raise UserError(_('Only a time off Officer or Manager can approve or refuse allocation requests.'))

if is_officer:
# use ir.rule based first access check: department, members, ... (see security.xml)
@@ -512,11 +512,11 @@ def _check_approval_update(self, state):
if (state == 'validate1' and val_type == 'both') or (state == 'validate' and val_type == 'manager'):
manager = holiday.employee_id.parent_id or holiday.employee_id.department_id.manager_id
if (manager and manager != current_employee) and not self.env.user.has_group('hr_holidays.group_hr_holidays_manager'):
raise UserError(_('You must be either %s\'s manager or time off manager to approve this time off') % (holiday.employee_id.name))
raise UserError(_('You must be either %s\'s manager or time off manager to approve this allocation.') % (holiday.employee_id.name))

if state == 'validate' and val_type == 'both':
if not self.env.user.has_group('hr_holidays.group_hr_holidays_manager'):
raise UserError(_('Only an time off Manager can apply the second approval on time off requests.'))
raise UserError(_('Only a time off Manager can apply the second approval on allocation requests.'))

# ------------------------------------------------------------
# Activity methods

0 comments on commit 1c291f8

Please sign in to comment.
You can’t perform that action at this time.