FIX to make it work with lunch voucher on months when nobody took holidays

This commit is contained in:
Alexis de Lattre
2018-01-23 17:05:40 +01:00
parent da6ba9b75e
commit 5c9b6dd702

View File

@@ -57,8 +57,10 @@ class HrHolidaysToPayslip(models.TransientModel):
# because, after the write, it doesn't have a value any more !!! # because, after the write, it doesn't have a value any more !!!
holidays_to_payslip = self.holidays_to_payslip_ids holidays_to_payslip = self.holidays_to_payslip_ids
today = fields.Date.context_today(self) today = fields.Date.context_today(self)
if not self.holidays_to_payslip_ids: # Disable the raise below to make the module "hr_holidays_lunch_voucher"
raise UserError(_('No leave request to transfer to payslip.')) # work even when nobody took holidays on the current month
# if not self.holidays_to_payslip_ids:
# raise UserError(_('No leave request to transfer to payslip.'))
self.holidays_to_payslip_ids.write({'payslip_date': today}) self.holidays_to_payslip_ids.write({'payslip_date': today})
view_id = self.env.ref('hr_holidays_usability.hr_holiday_pivot').id view_id = self.env.ref('hr_holidays_usability.hr_holiday_pivot').id
action = { action = {