[IMP] hr_*: changes accourding to the Piratepad
[odoo/odoo.git] / addons / hr_attendance / report / bymonth.py
index 0ae0710..cfebc64 100644 (file)
@@ -1,21 +1,20 @@
 # -*- coding: utf-8 -*-
 ##############################################################################
 #
-#    OpenERP, Open Source Management Solution  
-#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
-#    $Id$
+#    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 General Public License as published by
-#    the Free Software Foundation, either version 3 of the License, or
-#    (at your option) any later version.
+#    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 General Public License for more details.
+#    GNU Affero General Public License for more details.
 #
-#    You should have received a copy of the GNU General Public License
+#    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/>.
 #
 ##############################################################################
@@ -40,14 +39,10 @@ def hour2str(h):
 
 class report_custom(report_rml):
     def create_xml(self, cr, uid, ids, datas, context):
-        service = netsvc.LocalService('object_proxy')
-
         month = DateTime.DateTime(datas['form']['year'], datas['form']['month'], 1)
-        
         user_xml = ['<month>%s</month>' % month2name[month.month], '<year>%s</year>' % month.year]
-        
         for employee_id in ids:
-            emp = service.execute(cr.dbname, uid, 'hr.employee', 'read', [employee_id])[0]
+            emp = pooler.get_pool(cr.dbname).get('hr.employee').read(cr, uid, [employee_id], ['name'])[0]
             stop, days_xml = False, []
             user_repr = '''
             <user>
@@ -79,15 +74,15 @@ class report_custom(report_rml):
                     if att['action'] == 'sign_out':
                         wh += (dt - ldt).hours
                     ldt = dt
-                
+
                 # Week xml representation
                 wh = hour2str(wh)
                 today_xml = '<day num="%s"><wh>%s</wh></day>' % ((today - month).days+1, wh)
                 days_xml.append(today_xml)
                 today, tomor = tomor, tomor + one_day
-                
+
             user_xml.append(user_repr % '\n'.join(days_xml))
-        
+
         xml = '''<?xml version="1.0" encoding="UTF-8" ?>
         <report>
         %s