Impacted versions: Odoo 10

Steps to reproduce: 
1. Create a contract for the Employee and select the Working Schedule as Day shift.

2. Go to Payroll -> Employee Payslips -> Create. Select Employee and the Contract, Period must be automatically selected. In Worked days, the WORK100 shows no of days and hours by calculating the period and Working schedule.

3. Now try selecting the previous month(1st day to last day). And the worked Days will miscalculate the no of days and hours.(Check Screenshots).

Current behavior: Miscalculation in Worked Days( No of days and Hours) if the period is change e.g. Select a last month

Expected behavior: No of days and hours must be calculated properly after changing the period.

Video/Screenshot link (optional):
![payroll_period](https://cloud.githubusercontent.com/assets/14011478/22732830/a449a954-ee15-11e6-8909-9d714d306bdb.png)
![payroll_hours](https://cloud.githubusercontent.com/assets/14011478/22732819/9e7c34e2-ee15-11e6-9924-a8dc42ce9a5a.png)



"""
        :param localdict: dictionary containing the environement in which to compute the rule
        :return: returns a tuple build as the base/amount computed, the quantity and the rate
        :rtype: (float, float, float)
        """
        self.ensure_one()
        if self.amount_select == 'fix':
            try:
                return self.amount_fix, float(safe_eval(self.quantity, localdict)), 100.0
            except:
                raise UserError(_('Wrong quantity defined for salary rule %s (%s).') % (self.name, self.code))
        elif self.amount_select == 'percentage':
            try:
                return (float(safe_eval(self.amount_percentage_base, localdict)),
                        float(safe_eval(self.quantity, localdict)),
                        self.amount_percentage)
            except:
                raise UserError(_('Wrong percentage base or quantity defined for salary rule %s (%s).') % (self.name, self.code))
        else:
            try:
                safe_eval(self.amount_python_compute, localdict, mode='exec', nocopy=True)
                return float(localdict['result']), 'result_qty' in localdict and localdict['result_qty'] or 1.0, 'result_rate' in localdict and localdict['result_rate'] or 100.0
            except:
                raise UserError(_('Wrong  defined for salary rule %s (%s).') % (self.name, self.code))
    @api.multi
    def satisfy_condition(self, localdict):