[FIX] Hr_Timesheet : Timesheet report should be available for those employees who have user associated with them.

bzr revid: jvo@tinyerp.com-20110207113837-ajxt2kis1xpa6rk8
This commit is contained in:
Jay Vora (OpenERP) 2011-02-07 17:08:37 +05:30
parent c57658c9b1
commit 591782def9
1 changed files with 25 additions and 22 deletions

View File

@ -61,6 +61,10 @@ class report_custom(report_rml):
date_xml.append('</days>')
date_xml.append('<cols>2.5cm%s,2cm</cols>\n' % (',0.7cm' * lengthmonth(som.year, som.month)))
# Sum attendence by account, then by day
accounts = {}
header_xml = ''
if user_id:
# Computing the attendence by analytical account
cr.execute(
"select line.date, (unit_amount * unit.factor) as amount, account_id, account.name "\
@ -72,8 +76,6 @@ class report_custom(report_rml):
"order by line.date",
(user_id, som.strftime('%Y-%m-%d'), eom.strftime('%Y-%m-%d')))
# Sum attendence by account, then by day
accounts = {}
for presence in cr.dictfetchall():
day = int(presence['date'][-2:])
account = accounts.setdefault((presence['account_id'], presence['name']), {})
@ -86,6 +88,7 @@ class report_custom(report_rml):
'''
rpt_obj = pooler.get_pool(cr.dbname).get('hr.employee')
rml_obj = report_sxw.rml_parse(cr, uid, rpt_obj._name,context)
if user_id:
header_xml = '''
<header>
<date>%s</date>