Created
March 20, 2018 08:13
-
-
Save kholioeg/767df2c96885e4686e66ff5766eec9b6 to your computer and use it in GitHub Desktop.
Odoo OpenERP gist to check the working aschedule for each employee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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