[ADD] hr_attendance: Print timesheet by month => osv memory
bzr revid: mra@tinyerp.com-20100413062529-4xt6lsx1pjws6am4
This commit is contained in:
@@ -37,7 +37,8 @@
|
||||
'hr_attendance_view.xml',
|
||||
'hr_attendance_wizard.xml',
|
||||
'hr_attendance_report.xml',
|
||||
'security/ir.model.access.csv'
|
||||
'security/ir.model.access.csv',
|
||||
'wizard/hr_attendance_bymonth_view.xml',
|
||||
],
|
||||
'demo_xml': ['hr_attendance_demo.xml'],
|
||||
'installable': True,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<wizard id="wizard_attendance_error" keyword="client_print_multi" model="hr.employee" name="hr.attendance.report" string="Print Attendance Error Report"/>
|
||||
|
||||
<wizard id="print_week" keyword="client_print_multi" model="hr.employee" name="hr.attendance.print_week" string="Print Timesheet by week"/>
|
||||
<wizard id="print_month" keyword="client_print_multi" model="hr.employee" name="hr.attendance.print_month" string="Print Timesheet by month"/>
|
||||
<!--<wizard id="print_month" keyword="client_print_multi" model="hr.employee" name="hr.attendance.print_month" string="Print Timesheet by month"/>-->
|
||||
|
||||
|
||||
<menuitem action="si_so" id="menu_si_so" parent="menu_hr_time_tracking" type="wizard" sequence="1"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
@@ -15,13 +15,13 @@
|
||||
# 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/>.
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import sign_in_out
|
||||
import print_attendance_error
|
||||
from print_byweek import wiz_byweek
|
||||
from print_bymonth import wiz_bymonth
|
||||
import hr_attendance_bymonth
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,52 @@
|
||||
# -*- 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
import time
|
||||
|
||||
from osv import osv, fields
|
||||
|
||||
class hr_attendance_bymonth(osv.osv_memory):
|
||||
_name = 'hr.attendance.month'
|
||||
_description = 'Print Monthly Attendance Report'
|
||||
_columns = {
|
||||
'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),
|
||||
'year': fields.integer('Year', required=True)
|
||||
}
|
||||
|
||||
def print_report(self, cr, uid, ids, context=None):
|
||||
datas = {
|
||||
'ids': [],
|
||||
'model': 'hr.employee',
|
||||
'form': self.read(cr, uid, ids)[0]
|
||||
}
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'hr.attendance.bymonth',
|
||||
'datas': datas,
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'month': lambda * a: time.gmtime()[1],
|
||||
'year': lambda * a: time.gmtime()[0],
|
||||
}
|
||||
hr_attendance_bymonth()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_hr_attendance_month" model="ir.ui.view">
|
||||
<field name="name">Attendance Report Monthly</field>
|
||||
<field name="model">hr.attendance.month</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Print Attendance Report Monthly">
|
||||
<group col="4" colspan="6">
|
||||
<field name="month"/>
|
||||
<field name="year"/>
|
||||
<newline/>
|
||||
</group>
|
||||
<separator colspan="4"/>
|
||||
<group col="2" colspan="4">
|
||||
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
|
||||
<button name="print_report" string="Print" colspan="1" type="object" icon="gtk-print"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_hr_attendance_month" model="ir.actions.act_window">
|
||||
<field name="name">Print Timesheet by month</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">hr.attendance.month</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="event_registration_values">
|
||||
<field name="model_id" ref="hr.model_hr_employee" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Print Timesheet by month</field>
|
||||
<field name="key2">client_print_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_hr_attendance_month'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">hr.employee</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,63 +0,0 @@
|
||||
# -*- 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import time
|
||||
|
||||
_date_form = '''<?xml version="1.0"?>
|
||||
<form string="Timesheets by month">
|
||||
<separator string="Select a month" colspan="4"/>
|
||||
<field name="month"/>
|
||||
<field name="year"/>
|
||||
</form>'''
|
||||
|
||||
_date_fields = {
|
||||
'month' : {
|
||||
'string' : 'Month',
|
||||
'type' : 'selection',
|
||||
'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')],
|
||||
'required':True,
|
||||
'default' : lambda * a: time.gmtime()[1]
|
||||
},
|
||||
'year' : {
|
||||
'string' : 'Year',
|
||||
'type' : 'integer',
|
||||
'required':True,
|
||||
'default' : lambda * a: time.gmtime()[0]
|
||||
},
|
||||
}
|
||||
|
||||
class wiz_bymonth(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type': 'form', 'arch':_date_form, 'fields':_date_fields, 'state':[ ('end', 'Cancel', 'gtk-cancel'),('print', 'Print', 'gtk-ok')] }
|
||||
},
|
||||
'print': {
|
||||
'actions': [],
|
||||
'result': {'type': 'print', 'report': 'hr.attendance.bymonth', 'state': 'end' }
|
||||
}
|
||||
}
|
||||
wiz_bymonth('hr.attendance.print_month')
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
Reference in New Issue
Block a user