**Impacted versions:**
11.0

**Steps to reproduce:**
In runbot odoo/odoo or odoo/enterprise

- In Preferences change the timezone to America/Mexico_city

- Create a contract for a user with this values: **state**: running, **End Date**: NULL, **Start Date**: year before (for example), and **working schedule**: Standard 40 Hours/week
![image](https://user-images.githubusercontent.com/19410285/35942162-2640db56-0c2b-11e8-8714-b25413d62123.png)

- Edit the working schedule as the image below, and save.
![image](https://user-images.githubusercontent.com/19410285/35942368-c846cf82-0c2b-11e8-9a26-753ded2509d1.png)

- Create a payslip for a user with the edited contract.

- Change the date_from (in period) to a saturday day
![image](https://user-images.githubusercontent.com/19410285/35942575-83626d08-0c2c-11e8-8023-11675d29c3ea.png)


**Current behavior:**
Take this error
![image](https://user-images.githubusercontent.com/19410285/35942631-ad048268-0c2c-11e8-9147-c3f2ff5770fe.png)


**Expected behavior:**
compute the number of days without error


**Video/Screenshot link (optional):**
https://youtu.be/fQWTg7LXD2g

def get_worked_day_lines(self, contracts, date_from, date_to):
        """
        @param contract: Browse record of contracts
        @return: returns a list of dict containing the input that should be applied for the given contract between date_from and date_to
        """
        res = []
        
        for contract in contracts.filtered(lambda contract: contract.resource_calendar_id):
            day_from = datetime.combine(fields.Date.from_string(date_from), datetime_time.min)
            day_to = datetime.combine(fields.Date.from_string(date_to), datetime_time.max)
            
            leaves = {}
            day_leave_intervals = contract.employee_id.iter_leaves(day_from, day_to, calendar=contract.resource_calendar_id)
            for day_intervals in day_leave_intervals:
                for interval in day_intervals:
                    holiday = interval[2]['leaves'].holiday_id
                    current_leave_struct = leaves.setdefault(holiday.holiday_status_id, {
                        'name': holiday.holiday_status_id.name,
                        'sequence': 5,
                        'code': holiday.holiday_status_id.name,
                        'number_of_days': 0.0,
                        'number_of_hours': 0.0,
                        'contract_id': contract.id,
                    })
                    leave_time = (interval[1] - interval[0]).seconds / 3600
                    current_leave_struct['number_of_hours'] += leave_time
                    work_hours = contract.employee_id.get_day_work_hours_count(interval[0].date(), calendar=contract.resource_calendar_id)
                    current_leave_struct['number_of_days'] += leave_time / work_hours
            
            work_data = contract.employee_id.get_work_days_data(day_from, day_to, calendar=contract.resource_calendar_id)