2010-04-13 06:25:29 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
###############################################################################
|
|
|
|
#
|
|
|
|
# OpenERP, Open Source Management Solution
|
|
|
|
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Affero General Public License as
|
|
|
|
# published by the Free Software Foundation, either version 3 of the
|
|
|
|
# License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Affero General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
##############################################################################
|
2010-07-03 10:21:52 +00:00
|
|
|
|
2010-04-13 06:25:29 +00:00
|
|
|
import time
|
|
|
|
|
2012-12-06 14:56:32 +00:00
|
|
|
from openerp.osv import osv, fields
|
2010-04-13 06:25:29 +00:00
|
|
|
|
|
|
|
class hr_attendance_bymonth(osv.osv_memory):
|
|
|
|
_name = 'hr.attendance.month'
|
|
|
|
_description = 'Print Monthly Attendance Report'
|
|
|
|
_columns = {
|
2010-07-03 10:21:52 +00:00
|
|
|
'month': fields.selection([(1, 'January'), (2, 'February'), (3, 'March'), (4, 'April'), (5, 'May'), (6, 'June'), (7, 'July'), (8, 'August'), (9, 'September'), (10, 'October'), (11, 'November'), (12, 'December')], 'Month', required=True),
|
2010-04-13 06:25:29 +00:00
|
|
|
'year': fields.integer('Year', required=True)
|
2010-08-13 06:44:34 +00:00
|
|
|
}
|
2010-04-13 06:40:24 +00:00
|
|
|
_defaults = {
|
2010-11-04 12:42:42 +00:00
|
|
|
'month': lambda *a: time.gmtime()[1],
|
|
|
|
'year': lambda *a: time.gmtime()[0],
|
2010-08-13 06:44:34 +00:00
|
|
|
}
|
2010-04-13 06:25:29 +00:00
|
|
|
|
|
|
|
def print_report(self, cr, uid, ids, context=None):
|
|
|
|
datas = {
|
|
|
|
'ids': [],
|
2011-12-16 05:52:38 +00:00
|
|
|
'active_ids': context['active_ids'],
|
2010-04-13 06:25:29 +00:00
|
|
|
'model': 'hr.employee',
|
|
|
|
'form': self.read(cr, uid, ids)[0]
|
2010-08-13 06:44:34 +00:00
|
|
|
}
|
2010-04-13 06:25:29 +00:00
|
|
|
return {
|
|
|
|
'type': 'ir.actions.report.xml',
|
|
|
|
'report_name': 'hr.attendance.bymonth',
|
|
|
|
'datas': datas,
|
2010-08-13 06:44:34 +00:00
|
|
|
}
|
2010-04-13 06:25:29 +00:00
|
|
|
|
|
|
|
|
2012-03-05 18:40:03 +00:00
|
|
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|