2 ##############################################################################
4 # OpenERP, Open Source Management Solution
5 # Copyright (C) 2011 OpenERP SA (<http://openerp.com>). All Rights Reserved
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU Affero General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU Affero General Public License for more details.
17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ##############################################################################
24 from openerp.osv import fields, osv
26 class hr_salary_employee_bymonth(osv.osv_memory):
28 _name = 'hr.salary.employee.month'
29 _description = 'Hr Salary Employee By Month Report'
31 'start_date': fields.date('Start Date', required=True),
32 'end_date': fields.date('End Date', required=True),
33 'employee_ids': fields.many2many('hr.employee', 'payroll_year_rel', 'payroll_year_id', 'employee_id', 'Employees', required=True),
34 'category_id': fields.many2one('hr.salary.rule.category', 'Category', required=True),
37 def _get_default_category(self, cr, uid, context=None):
38 category_ids = self.pool.get('hr.salary.rule.category').search(cr, uid, [('code', '=', 'NET')], context=context)
39 return category_ids and category_ids[0] or False
42 'start_date': lambda *a: time.strftime('%Y-01-01'),
43 'end_date': lambda *a: time.strftime('%Y-%m-%d'),
44 'category_id': _get_default_category
47 def print_report(self, cr, uid, ids, context=None):
49 To get the date and print the report
50 @param self: The object pointer.
51 @param cr: A database cursor
52 @param uid: ID of the user currently logged in
53 @param context: A standard dictionary
54 @return: return report
58 datas = {'ids': context.get('active_ids', [])}
60 res = self.read(cr, uid, ids, context=context)
61 res = res and res[0] or {}
62 datas.update({'form': res})
64 'type': 'ir.actions.report.xml',
65 'report_name': 'salary.employee.bymonth',
69 hr_salary_employee_bymonth()
71 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: