[IMP] hr_presence: Allow to force the presence of an employee

This commit is contained in:
Yannick Tivisse
2018-11-07 16:30:29 +00:00
parent ba18cf7fdc
commit faf90c4f52
2 changed files with 7 additions and 0 deletions
+5
View File
@@ -95,6 +95,11 @@ class ResCompany(models.Model):
"context": {'search_default_group_hr_presence_state': 1},
}
def action_set_present(self):
if not self.env.user.has_group('hr.group_hr_manager'):
raise UserError(_("You don't have the right to do this. Please contact an Administrator."))
self.write({'hr_presence_state': 'present'})
def action_send_sms(self):
if not self.env.user.has_group('hr.group_hr_manager'):
raise UserError(_("You don't have the right to do this. Please contact an Administrator."))
@@ -22,6 +22,8 @@
<xpath expr="//div[hasclass('oe_kanban_details')]" position="inside">
<div class="o_kanban_record_bottom">
<div class="oe_kanban_bottom_left">
<field name="hr_presence_state" invisible="1"/>
<button name="action_set_present" type="object" class="btn btn-primary btn-sm mt8 fa fa-check" title="Set as present" attrs="{'invisible': [('hr_presence_state', '!=', 'to_define')]}"> </button>
<button name="%(hr_holidays.hr_leave_action_all)d" type="action" class="btn btn-primary btn-sm mt8" context="{'default_employee_id': active_id}">Leaves</button>
<button name="action_send_sms" type="object" class="btn btn-primary btn-sm mt8" context="{'active_id': active_id}">SMS</button>
<button name="action_send_mail" type="object" class="btn btn-primary btn-sm mt8" context="{'active_id': active_id}">Mail</button>