Skip to content

Instantly share code, notes, and snippets.

@kholioeg
Created March 20, 2018 08:13
Show Gist options
  • Save kholioeg/767df2c96885e4686e66ff5766eec9b6 to your computer and use it in GitHub Desktop.
Save kholioeg/767df2c96885e4686e66ff5766eec9b6 to your computer and use it in GitHub Desktop.
Odoo OpenERP gist to check the working aschedule for each employee
for employee in self.env['hr.employee'].search([]):
current_employee = self.search([
('name', '=', fields.Date.today()),
('employee_id', '=', employee.id)
])
if not current_employee:
try:
contract_id = self.env['hr.contract'].browse(
current_employee.contract_ids[0].id)
resource_calendar_id = contract_id.working_hours
working_schedule = self.env[
'resource.calendar.attendance'].search([
('calendar_id', '=', resource_calendar_id.id),
('dayofweek', '=',
fields.Datetime.from_string(
fields.Date.today()).weekday()),
])
.
.
.
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment