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 ##############################################################################
23 from openerp.osv import fields, osv
25 class hr_salary_employee_bymonth(osv.osv_memory):
27 _name = 'hr.salary.employee.month'
28 _description = 'Hr Salary Employee By Month Report'
30 'start_date': fields.date('Start Date', required=True),
31 'end_date': fields.date('End Date', required=True),
32 'employee_ids': fields.many2many('hr.employee', 'payroll_year_rel', 'payroll_year_id', 'employee_id', 'Employees', required=True),
33 'category_id': fields.many2one('hr.salary.rule.category', 'Category', required=True),
36 def _get_default_category(self, cr, uid, context=None):
37 category_ids = self.pool.get('hr.salary.rule.category').search(cr, uid, [('code', '=', 'NET')], context=context)
38 return category_ids and category_ids[0] or False
41 'start_date': lambda *a: time.strftime('%Y-01-01'),
42 'end_date': lambda *a: time.strftime('%Y-%m-%d'),
43 'category_id': _get_default_category
46 def print_report(self, cr, uid, ids, context=None):
48 To get the date and print the report
49 @param self: The object pointer.
50 @param cr: A database cursor
51 @param uid: ID of the user currently logged in
52 @param context: A standard dictionary
53 @return: return report
57 datas = {'ids': context.get('active_ids', [])}
59 res = self.read(cr, uid, ids, context=context)
60 res = res and res[0] or {}
61 datas.update({'form': res})
62 return self.pool['report'].get_action(cr, uid, ids,
63 'l10n_in_hr_payroll.report_hrsalarybymonth',
64 data=datas, context=context)
66 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: