flectra/addons/hr_holidays/wizard/hr_holidays_summary_employees.py

33 lines
1.2 KiB
Python
Raw Normal View History

# -*- coding: utf-8 -*-
2018-01-16 11:34:37 +01:00
# Part of Odoo, Flectra. See LICENSE file for full copyright and licensing details.
import time
2018-01-16 11:34:37 +01:00
from flectra import api, fields, models
class HolidaysSummaryEmployee(models.TransientModel):
_name = 'hr.holidays.summary.employee'
_description = 'HR Leaves Summary Report By Employee'
date_from = fields.Date(string='From', required=True, default=lambda *a: time.strftime('%Y-%m-01'))
emp = fields.Many2many('hr.employee', 'summary_emp_rel', 'sum_id', 'emp_id', string='Employee(s)')
holiday_type = fields.Selection([
('Approved', 'Approved'),
('Confirmed', 'Confirmed'),
('both', 'Both Approved and Confirmed')
], string='Select Leave Type', required=True, default='Approved')
@api.multi
def print_report(self):
self.ensure_one()
[data] = self.read()
data['emp'] = self.env.context.get('active_ids', [])
employees = self.env['hr.employee'].browse(data['emp'])
datas = {
'ids': [],
'model': 'hr.employee',
'form': data
}
return self.env.ref('hr_holidays.action_report_holidayssummary').report_action(employees, data=datas)