diff --git a/addons/hr_attendance/__openerp__.py b/addons/hr_attendance/__openerp__.py index 8b159501592..eee14eaff2b 100644 --- a/addons/hr_attendance/__openerp__.py +++ b/addons/hr_attendance/__openerp__.py @@ -39,6 +39,7 @@ 'hr_attendance_report.xml', 'security/ir.model.access.csv', 'wizard/hr_attendance_bymonth_view.xml', + 'wizard/hr_attendance_byweek_view.xml', ], 'demo_xml': ['hr_attendance_demo.xml'], 'installable': True, diff --git a/addons/hr_attendance/wizard/__init__.py b/addons/hr_attendance/wizard/__init__.py index b6d0dc5eb6a..86f07d6fb52 100644 --- a/addons/hr_attendance/wizard/__init__.py +++ b/addons/hr_attendance/wizard/__init__.py @@ -21,7 +21,7 @@ import sign_in_out import print_attendance_error -from print_byweek import wiz_byweek +import hr_attendance_byweek import hr_attendance_bymonth # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/hr_attendance/wizard/hr_attendance_bymonth.py b/addons/hr_attendance/wizard/hr_attendance_bymonth.py index f020f7542ba..2b2c33cf5eb 100644 --- a/addons/hr_attendance/wizard/hr_attendance_bymonth.py +++ b/addons/hr_attendance/wizard/hr_attendance_bymonth.py @@ -30,6 +30,10 @@ class hr_attendance_bymonth(osv.osv_memory): 'Month', required=True), 'year': fields.integer('Year', required=True) } + _defaults = { + 'month': lambda * a: time.gmtime()[1], + 'year': lambda * a: time.gmtime()[0], + } def print_report(self, cr, uid, ids, context=None): datas = { @@ -43,10 +47,6 @@ class hr_attendance_bymonth(osv.osv_memory): '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: \ No newline at end of file diff --git a/addons/hr_attendance/wizard/hr_attendance_bymonth_view.xml b/addons/hr_attendance/wizard/hr_attendance_bymonth_view.xml index d2e28579875..89272706eee 100644 --- a/addons/hr_attendance/wizard/hr_attendance_bymonth_view.xml +++ b/addons/hr_attendance/wizard/hr_attendance_bymonth_view.xml @@ -31,7 +31,7 @@ new - + Print Timesheet by month diff --git a/addons/hr_attendance/wizard/print_byweek.py b/addons/hr_attendance/wizard/hr_attendance_byweek.py similarity index 51% rename from addons/hr_attendance/wizard/print_byweek.py rename to addons/hr_attendance/wizard/hr_attendance_byweek.py index d859e81aea5..30c63d69f2b 100644 --- a/addons/hr_attendance/wizard/print_byweek.py +++ b/addons/hr_attendance/wizard/hr_attendance_byweek.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (). # @@ -15,39 +15,36 @@ # 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 . +# along with this program. If not, see . # ############################################################################## - -import wizard import time -_date_form = ''' -
- - - - -''' +from osv import osv, fields -_date_fields = { - 'init_date': {'string':'Starting Date', 'type':'date', 'default':lambda *a: time.strftime('%Y-%m-%d'), 'required':True}, - 'end_date': {'string':'Ending Date', 'type':'date', 'default':lambda *a: time.strftime('%Y-%m-%d'), 'required':True} -} +class hr_attendance_byweek(osv.osv_memory): + _name = 'hr.attendance.week' + _description = 'Print Week Attendance Report' + _columns = { + 'init_date': fields.date('Starting Date', required=True), + 'end_date': fields.date('Ending Date', required=True) + } + _defaults = { + 'init_date': lambda *a: time.strftime('%Y-%m-%d'), + 'end_date': lambda *a: time.strftime('%Y-%m-%d'), + } -class wiz_byweek(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.allweeks', 'state':'end'} - } - } -wiz_byweek('hr.attendance.print_week') - - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + 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.allweeks', + 'datas': datas, + } +hr_attendance_byweek() +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/hr_attendance/wizard/hr_attendance_byweek_view.xml b/addons/hr_attendance/wizard/hr_attendance_byweek_view.xml new file mode 100644 index 00000000000..618217a1a66 --- /dev/null +++ b/addons/hr_attendance/wizard/hr_attendance_byweek_view.xml @@ -0,0 +1,46 @@ + + + + + + Attendance Report Week + hr.attendance.week + form + +
+ + + + + + + + +