**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

addons/hr_payroll/models/hr_payslip.py
_name = 'hr.payslip.worked_days'
    _description = 'Payslip Worked Days'
    _order = 'payslip_id, sequence'
    name = fields.Char(string='Description', required=True)
    payslip_id = fields.Many2one('hr.payslip', string='Pay Slip', required=True, ondelete='cascade', index=True)
    sequence = fields.Integer(required=True, index=True, default=10)
    code = fields.Char(required=True, help="The code that can be used in the salary rules")
    number_of_days = fields.Float(string='Number of Days')
    number_of_hours = fields.Float(string='Number of Hours')
    contract_id = fields.Many2one('hr.contract', string='Contract', required=True,
        help="The contract for which applied this input")
class HrPayslipInput(models.Model):
    _name = 'hr.payslip.input'
    _description = 'Payslip Input'
    _order = 'payslip_id, sequence'
    name = fields.Char(string='Description', required=True)
    payslip_id = fields.Many2one('hr.payslip', string='Pay Slip', required=True, ondelete='cascade', index=True)
    sequence = fields.Integer(required=True, index=True, default=10)
    code = fields.Char(required=True, help="The code that can be used in the salary rules")
    amount = fields.Float(help="It is used in computation. For e.g. A rule for sales having "
                               "1% commission of basic salary for per product can defined in expression "
                               "like result = inputs.SALEURO.amount * contract.wage*0.01.")
    contract_id = fields.Many2one('hr.contract', string='Contract', required=True,
        help="The contract for which applied this input")
class HrPayslipRun(models.Model):