Can I handle Employees leaves requests directly from the mail on Odoo 10? So HR managers and Officers can refuse or validate directly from the mail.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilidad
- Inventario
- PoS
- Project
- MRP
Se marcó esta pregunta
2
Respuestas
6592
Vistas
Yes we can, Odoo 10 can handle Leave requests directly from the mail. for that, we can find a function named
_notification_recipients in the hr_holidays model.
@api.multi
def _notification_recipients(self, message, groups):
""" Handle HR users and officers recipients that can validate or refuse holidays
directly from email. """
groups = super(Holidays, self)._notification_recipients(message, groups)
self.ensure_one()
hr_actions = []
if self.state == 'confirm':
app_action = self._notification_link_helper('controller', controller='/hr_holidays/validate')
hr_actions += [{'url': app_action, 'title': _('Approve')}]
if self.state in ['confirm', 'validate', 'validate1']:
ref_action = self._notification_link_helper('controller', controller='/hr_holidays/refuse')
hr_actions += [{'url': ref_action, 'title': _('Refuse')}]
new_group = (
'group_hr_holidays_user', lambda partner: bool(partner.user_ids) and any(user.has_group('hr_holidays.group_hr_holidays_user') for user in partner.user_ids), {
'actions': hr_actions,
})
return [new_group] + groups
There is also controller written to accept the validation/refusal through the link.
@http.route('/hr_holidays/validate', type='http', auth='user', methods=['GET'])
def hr_holidays_validate(self, res_id, token):
comparison, record, redirect = MailController._check_token_and_record_or_redirect('hr.holidays', int(res_id), token)
if comparison and record:
try:
record.action_approve()
except Exception:
return MailController._redirect_to_messaging()
return redirect
@http.route('/hr_holidays/refuse', type='http', auth='user', methods=['GET'])
def hr_holidays_refuse(self, res_id, token):
comparison, record, redirect = MailController._check_token_and_record_or_redirect('hr.holidays', int(res_id), token)
if comparison and record:
try:
record.action_refuse()
except Exception:
return MailController._redirect_to_messaging()
return redirect
Thanks.
What about Odoo11???
Same
_notify_get_groups on odoo13
¿Le interesa esta conversación? ¡Participe en ella!
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
RegistrarsePublicaciones relacionadas | Respuestas | Vistas | Actividad | |
---|---|---|---|---|
|
2
jul 25
|
4828 | ||
|
2
dic 24
|
7911 | ||
How to ORDER BY? [Odoo 10]
Resuelto
|
|
2
nov 24
|
28723 | |
|
2
may 24
|
7601 | ||
|
3
mar 24
|
7056 |