diff --git a/addons/hr_timesheet/report/custom_default.xsl b/addons/hr_timesheet/report/custom_default.xsl new file mode 100644 index 00000000000..39e71d6d53e --- /dev/null +++ b/addons/hr_timesheet/report/custom_default.xsl @@ -0,0 +1,40 @@ + + + + + + + + + + + + + / + + 1.3cm 19.3cm 28.5cm 19.3cm + + + + + + + + + + + + / + + 1.3cm 19.3cm 28.5cm 19.3cm + + + + + + + + + + + diff --git a/addons/hr_timesheet/report/custom_rml.xsl b/addons/hr_timesheet/report/custom_rml.xsl new file mode 100644 index 00000000000..64a4894613a --- /dev/null +++ b/addons/hr_timesheet/report/custom_rml.xsl @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/addons/hr_timesheet/report/user_timesheet.py b/addons/hr_timesheet/report/user_timesheet.py index d444e4a19bc..f4428c5a045 100644 --- a/addons/hr_timesheet/report/user_timesheet.py +++ b/addons/hr_timesheet/report/user_timesheet.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (). # @@ -15,16 +15,16 @@ # 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 datetime from report.interface import report_rml -from report.interface import toxml +from report.interface import toxml from tools.translate import _ - +import time import pooler def lengthmonth(year, month): @@ -52,7 +52,7 @@ class report_custom(report_rml): date_xml.append('') date_xml.append('2.5cm%s,2cm\n' % (',0.7cm' * lengthmonth(som.year, som.month))) - + # Computing the attendence by analytical account cr.execute( "select line.date, (unit_amount * unit.factor) as amount, account_id, account.name "\ @@ -70,12 +70,19 @@ class report_custom(report_rml): day = int(presence['date'][-2:]) account = accounts.setdefault((presence['account_id'], presence['name']), {}) account[day] = account.get(day, 0.0) + presence['amount'] - + xml = ''' %.2f ''' + header_xml = ''' +
+ %s + %s +
+ ''' % (time.strftime('%m/%d/%Y %H:%M'),pooler.get_pool(cr.dbname).get('res.users').browse(cr,uid,uid).company_id.name) + account_xml = [] for account, telems in accounts.iteritems(): aid, aname = account @@ -93,10 +100,11 @@ class report_custom(report_rml): # Computing the xml xml = ''' + %s %s %s - ''' % (toxml(emp), '\n'.join(date_xml) + '\n'.join(account_xml)) + ''' % (header_xml,toxml(emp), '\n'.join(date_xml) + '\n'.join(account_xml)) return xml report_custom('report.hr.analytical.timesheet', 'hr.employee', '', 'addons/hr_timesheet/report/user_timesheet.xsl') diff --git a/addons/hr_timesheet/report/user_timesheet.xsl b/addons/hr_timesheet/report/user_timesheet.xsl index 88faa6dafef..b4a5a8c8d25 100644 --- a/addons/hr_timesheet/report/user_timesheet.xsl +++ b/addons/hr_timesheet/report/user_timesheet.xsl @@ -3,20 +3,14 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> - - - + + + + + - - - - - + @@ -50,15 +44,10 @@ - - - - - - - + + Timesheet diff --git a/addons/hr_timesheet/report/users_timesheet.py b/addons/hr_timesheet/report/users_timesheet.py index 9755d2d5871..9fd2f93e0be 100644 --- a/addons/hr_timesheet/report/users_timesheet.py +++ b/addons/hr_timesheet/report/users_timesheet.py @@ -22,7 +22,8 @@ import datetime from report.interface import report_rml from report.interface import toxml - +import time +import pooler from tools.translate import _ @@ -96,12 +97,20 @@ class report_custom(report_rml): #Without this, report don't show non-ascii characters (TO CHECK) date_xml = '\n'.join(date_xml) + header_xml = ''' +
+ %s + %s +
+ ''' % (time.strftime('%m/%d/%Y %H:%M'),pooler.get_pool(cr.dbname).get('res.users').browse(cr,uid,uid).company_id.name) + xml=''' %s %s + %s - ''' % (date_xml, emp_xml) + ''' % (header_xml,date_xml, emp_xml) return xml report_custom('report.hr.analytical.timesheet_users', 'hr.employee', '', 'addons/hr_timesheet/report/users_timesheet.xsl') diff --git a/addons/hr_timesheet/report/users_timesheet.xsl b/addons/hr_timesheet/report/users_timesheet.xsl index 952af98e81a..9c99b56afe6 100644 --- a/addons/hr_timesheet/report/users_timesheet.xsl +++ b/addons/hr_timesheet/report/users_timesheet.xsl @@ -3,20 +3,15 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> + + + - - - - - + @@ -50,17 +45,12 @@ - - - - - - - Employees Timesheet + Employees Timesheet + month