Fixed timestamp formatting in attendance reports.

Added default value for attendance report wizard.

bzr revid: ls@numerigraphe.fr-20090206101110-e6bnbv6111mp11kh
This commit is contained in:
Numerigraphe - Lionel Sausin 2009-02-06 11:11:10 +01:00
parent 9014c3f6f6
commit 8d8ce8454e
3 changed files with 16 additions and 5 deletions

View File

@ -65,7 +65,7 @@ class report_custom(report_rml):
where att.name between %s and %s and emp.id = %s
order by att.name
'''
cr.execute(sql, (today, tomor, employee_id))
cr.execute(sql, (today.strftime('%Y-%m-%d %H:%M:%S'), tomor.strftime('%Y-%m-%d %H:%M:%S'), employee_id))
attendences = cr.dictfetchall()
wh = 0
# Fake sign ins/outs at week ends, to take attendances across week ends into account

View File

@ -75,7 +75,7 @@ class report_custom(report_rml):
order by att.name
'''
for idx in range(7):
cr.execute(sql, (monday, monday + DateTime.RelativeDateTime(days=idx+1), employee_id))
cr.execute(sql, (monday.strftime('%Y-%m-%d %H:%M:%S'), (monday + DateTime.RelativeDateTime(days=idx+1)).strftime('%Y-%m-%d %H:%M:%S'), employee_id))
attendances = cr.dictfetchall()
week_wh = {}
# Fake sign ins/outs at week ends, to take attendances across week ends into account

View File

@ -31,15 +31,26 @@ _date_form = '''<?xml version="1.0"?>
</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 },
'year' : {'string' : 'Year', 'type' : 'integer', 'required':True, 'default' : lambda *a: time.gmtime()[0]},
'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':[('print','Print Timesheet'),('end','Cancel')]}
'result': {'type': 'form', 'arch':_date_form, 'fields':_date_fields, 'state':[('print', 'Print Timesheet'), ('end', 'Cancel')]}
},
'print': {
'actions': [],