33 lines
1.2 KiB
Python
33 lines
1.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo, Flectra. See LICENSE file for full copyright and licensing details.
|
|
import time
|
|
|
|
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)
|