Skip to content
Permalink
Browse files

[FIX] hr_holidays: Use correct warning messages

  • Loading branch information...
sswapnesh committed Mar 22, 2019
1 parent 39e7135 commit fc61c9ef79f93b5d32ca3ac677475d864f96e2cf
Showing with 65 additions and 18 deletions.
  1. +57 −10 addons/hr_holidays/i18n/hr_holidays.pot
  2. +8 −8 addons/hr_holidays/models/hr_leave_allocation.py
@@ -446,11 +446,16 @@ msgstr ""

#. module: hr_holidays
#: code:addons/hr_holidays/models/hr_leave.py:535
#: code:addons/hr_holidays/models/hr_leave_allocation.py:365
#, python-format
msgid "A leave cannot be duplicated."
msgstr ""

#. module: hr_holidays
#: code:addons/hr_holidays/models/hr_leave_allocation.py:367
#, python-format
msgid "A time off allocation cannot be duplicated."
msgstr ""

#. module: hr_holidays
#: model:ir.model.fields,field_description:hr_holidays.field_hr_employee__show_leaves
msgid "Able to see Remaining Leaves"
@@ -1406,42 +1411,62 @@ msgstr ""

#. module: hr_holidays
#: code:addons/hr_holidays/models/hr_leave.py:642
#: code:addons/hr_holidays/models/hr_leave_allocation.py:421
#, python-format
msgid "Leave request must be confirmed (\"To Approve\") in order to approve it."
msgstr ""

#. module: hr_holidays
#: code:addons/hr_holidays/models/hr_leave_allocation.py:423
#, python-format
msgid "Time off allocation request must be confirmed (\"To Approve\") in order to approve it."
msgstr ""

#. module: hr_holidays
#: code:addons/hr_holidays/models/hr_leave.py:655
#: code:addons/hr_holidays/models/hr_leave_allocation.py:435
#, python-format
msgid "Leave request must be confirmed in order to approve it."
msgstr ""

#. module: hr_holidays
#: code:addons/hr_holidays/models/hr_leave_allocation.py:437
#, python-format
msgid "Time off allocation request must be confirmed in order to approve it."
msgstr ""

#. module: hr_holidays
#: code:addons/hr_holidays/models/hr_leave.py:690
#: code:addons/hr_holidays/models/hr_leave_allocation.py:473
#, python-format
msgid "Leave request must be confirmed or validated in order to refuse it."
msgstr ""

#. module: hr_holidays
#: code:addons/hr_holidays/models/hr_leave_allocation.py:473
#, python-format
msgid "Time off allocation request must be confirmed or validated in order to refuse it."
msgstr ""

#. module: hr_holidays
#: code:addons/hr_holidays/models/hr_leave.py:632
#: code:addons/hr_holidays/models/hr_leave_allocation.py:411
#, python-format
msgid "Leave request must be in Draft state (\"To Submit\") in order to confirm it."
msgstr ""

#. module: hr_holidays
#: code:addons/hr_holidays/models/hr_leave_allocation.py:413
#, python-format
msgid "Time off allocation request must be in Draft state (\"To Submit\") in order to confirm it."
msgstr ""

#. module: hr_holidays
#: code:addons/hr_holidays/models/hr_leave.py:616
#, python-format
msgid "Leave request state must be \"Refused\" or \"To Approve\" in order to be reset to draft."
msgstr ""

#. module: hr_holidays
#: code:addons/hr_holidays/models/hr_leave_allocation.py:395
#: code:addons/hr_holidays/models/hr_leave_allocation.py:397
#, python-format
msgid "Leave request state must be \"Refused\" or \"To Approve\" in order to reset to Draft."
msgid "Time off allocation request state must be \"Refused\" or \"To Approve\" in order to reset to Draft."
msgstr ""

#. module: hr_holidays
@@ -1868,6 +1893,12 @@ msgstr ""
msgid "Only a Leave Manager can approve its own requests."
msgstr ""

#. module: hr_holidays
#: code:addons/hr_holidays/models/hr_leave_allocation.py:511
#, python-format
msgid "Only a time off Manager can approve its own requests."
msgstr ""

#. module: hr_holidays
#: code:addons/hr_holidays/models/hr_leave.py:717
#: code:addons/hr_holidays/models/hr_leave_allocation.py:496
@@ -1878,7 +1909,13 @@ msgstr ""
#. module: hr_holidays
#: code:addons/hr_holidays/models/hr_leave_allocation.py:500
#, python-format
msgid "Only a Leave Officer or Manager can approve or refuse leave requests."
msgid "Only a time off Manager can reset other people time off."
msgstr ""

#. module: hr_holidays
#: code:addons/hr_holidays/models/hr_leave_allocation.py:504
#, python-format
msgid "Only a time off Officer or Manager can approve or refuse time off requests."
msgstr ""

#. module: hr_holidays
@@ -1889,11 +1926,16 @@ msgstr ""

#. module: hr_holidays
#: code:addons/hr_holidays/models/hr_leave.py:737
#: code:addons/hr_holidays/models/hr_leave_allocation.py:516
#, python-format
msgid "Only an Leave Manager can apply the second approval on leave requests."
msgstr ""

#. module: hr_holidays
#: code:addons/hr_holidays/models/hr_leave_allocation.py:520
#, python-format
msgid "Only a time off Manager can apply the second approval on time off requests."
msgstr ""

#. module: hr_holidays
#: model_terms:ir.ui.view,arch_db:hr_holidays.edit_holiday_status_form
msgid "Options"
@@ -2534,11 +2576,16 @@ msgstr ""

#. module: hr_holidays
#: code:addons/hr_holidays/models/hr_leave.py:733
#: code:addons/hr_holidays/models/hr_leave_allocation.py:512
#, python-format
msgid "You must be either %s's manager or Leave manager to approve this leave"
msgstr ""

#. module: hr_holidays
#: code:addons/hr_holidays/models/hr_leave_allocation.py:516
#, python-format
msgid "You must be either %s\'s manager or time off manager to approve this time off."
msgstr ""

#. module: hr_holidays
#: model_terms:ir.ui.view,arch_db:hr_holidays.hr_leave_allocation_view_kanban
#: model_terms:ir.ui.view,arch_db:hr_holidays.hr_leave_report_kanban
@@ -364,7 +364,7 @@ def unlink(self):

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

####################################################
# Business methods
@@ -394,7 +394,7 @@ def _prepare_holiday_values(self, employee):
def action_draft(self):
for holiday in self:
if holiday.state not in ['confirm', 'refuse']:
raise UserError(_('Time off request state must be "Refused" or "To Approve" in order to reset to Draft.'))
raise UserError(_('Time off allocation request state must be "Refused" or "To Approve" in order to reset to Draft.'))
holiday.write({
'state': 'draft',
'first_approver_id': False,
@@ -410,7 +410,7 @@ def action_draft(self):
@api.multi
def action_confirm(self):
if self.filtered(lambda holiday: holiday.state != 'draft'):
raise UserError(_('Time off request must be in Draft state ("To Submit") in order to confirm it.'))
raise UserError(_('Time off allocation request must be in Draft state ("To Submit") in order to confirm it.'))
res = self.write({'state': 'confirm'})
self.activity_update()
return res
@@ -420,7 +420,7 @@ def action_approve(self):
# if validation_type == 'both': this method is the first approval approval
# if validation_type != 'both': this method calls action_validate() below
if any(holiday.state != 'confirm' for holiday in self):
raise UserError(_('Time off request must be confirmed ("To Approve") in order to approve it.'))
raise UserError(_('Time off allocation request must be confirmed ("To Approve") in order to approve it.'))

current_employee = self.env['hr.employee'].search([('user_id', '=', self.env.uid)], limit=1)

@@ -434,7 +434,7 @@ def action_validate(self):
current_employee = self.env['hr.employee'].search([('user_id', '=', self.env.uid)], limit=1)
for holiday in self:
if holiday.state not in ['confirm', 'validate1']:
raise UserError(_('Time off request must be confirmed in order to approve it.'))
raise UserError(_('Time off allocation request must be confirmed in order to approve it.'))

holiday.write({'state': 'validate'})
if holiday.validation_type == 'both':
@@ -472,7 +472,7 @@ def action_refuse(self):
current_employee = self.env['hr.employee'].search([('user_id', '=', self.env.uid)], limit=1)
for holiday in self:
if holiday.state not in ['confirm', 'validate', 'validate1']:
raise UserError(_('Time off request must be confirmed or validated in order to refuse it.'))
raise UserError(_('Time off allocation request must be confirmed or validated in order to refuse it.'))

if holiday.state == 'validate1':
holiday.write({'state': 'refuse', 'first_approver_id': current_employee.id})
@@ -513,11 +513,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 time off.') % (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 time off requests.'))

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

0 comments on commit fc61c9e

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