From 49fe785e642e5586d965064a56d61d816b2d4911 Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Fri, 25 Apr 2014 13:32:28 +0200 Subject: [PATCH] [REM] hr_timesheet: removed xsl/models of user(s) timesheet reports as they are not available since rev 9064 revid:ged@openerp.com-20140127161718-uo6pperke86pqq5v. They are already replaced by graphviews. bzr revid: sle@openerp.com-20140425113228-obzblo2nmkmo2q58 --- addons/hr_timesheet/__init__.py | 1 - addons/hr_timesheet/__openerp__.py | 2 - addons/hr_timesheet/hr_timesheet_report.xml | 9 -- addons/hr_timesheet/hr_timesheet_wizard.xml | 5 - addons/hr_timesheet/report/__init__.py | 26 ---- addons/hr_timesheet/report/custom_default.xsl | 36 ----- addons/hr_timesheet/report/custom_rml.xsl | 37 ------ addons/hr_timesheet/report/user_timesheet.py | 124 ------------------ addons/hr_timesheet/report/user_timesheet.xsl | 123 ----------------- addons/hr_timesheet/report/users_timesheet.py | 123 ----------------- .../hr_timesheet/report/users_timesheet.xsl | 114 ---------------- 11 files changed, 600 deletions(-) delete mode 100644 addons/hr_timesheet/hr_timesheet_report.xml delete mode 100644 addons/hr_timesheet/hr_timesheet_wizard.xml delete mode 100644 addons/hr_timesheet/report/__init__.py delete mode 100644 addons/hr_timesheet/report/custom_default.xsl delete mode 100644 addons/hr_timesheet/report/custom_rml.xsl delete mode 100644 addons/hr_timesheet/report/user_timesheet.py delete mode 100644 addons/hr_timesheet/report/user_timesheet.xsl delete mode 100644 addons/hr_timesheet/report/users_timesheet.py delete mode 100644 addons/hr_timesheet/report/users_timesheet.xsl diff --git a/addons/hr_timesheet/__init__.py b/addons/hr_timesheet/__init__.py index f29aca0a003..0ba28b1946c 100644 --- a/addons/hr_timesheet/__init__.py +++ b/addons/hr_timesheet/__init__.py @@ -21,7 +21,6 @@ import hr_timesheet import wizard -import report # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/hr_timesheet/__openerp__.py b/addons/hr_timesheet/__openerp__.py index 6105271be77..411aac660b4 100644 --- a/addons/hr_timesheet/__openerp__.py +++ b/addons/hr_timesheet/__openerp__.py @@ -46,8 +46,6 @@ up a management by affair. 'security/ir.model.access.csv', 'security/hr_timesheet_security.xml', 'hr_timesheet_view.xml', - 'hr_timesheet_report.xml', - 'hr_timesheet_wizard.xml', 'process/hr_timesheet_process.xml', 'wizard/hr_timesheet_sign_in_out_view.xml', 'hr_timesheet_installer.xml', diff --git a/addons/hr_timesheet/hr_timesheet_report.xml b/addons/hr_timesheet/hr_timesheet_report.xml deleted file mode 100644 index 487dcd592bd..00000000000 --- a/addons/hr_timesheet/hr_timesheet_report.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/addons/hr_timesheet/hr_timesheet_wizard.xml b/addons/hr_timesheet/hr_timesheet_wizard.xml deleted file mode 100644 index ebc084668b7..00000000000 --- a/addons/hr_timesheet/hr_timesheet_wizard.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/addons/hr_timesheet/report/__init__.py b/addons/hr_timesheet/report/__init__.py deleted file mode 100644 index 8304c90421d..00000000000 --- a/addons/hr_timesheet/report/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). -# -# This program is free software: you can redistribute it and/or modify -# 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 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 . -# -############################################################################## - -import user_timesheet -import users_timesheet - - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/hr_timesheet/report/custom_default.xsl b/addons/hr_timesheet/report/custom_default.xsl deleted file mode 100644 index 2eda3a08f4b..00000000000 --- a/addons/hr_timesheet/report/custom_default.xsl +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - 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 deleted file mode 100644 index 64a4894613a..00000000000 --- a/addons/hr_timesheet/report/custom_rml.xsl +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/addons/hr_timesheet/report/user_timesheet.py b/addons/hr_timesheet/report/user_timesheet.py deleted file mode 100644 index 63edf3cc398..00000000000 --- a/addons/hr_timesheet/report/user_timesheet.py +++ /dev/null @@ -1,124 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). -# -# This program is free software: you can redistribute it and/or modify -# 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 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 . -# -############################################################################## - -import datetime -import time - -import openerp -from openerp.report.interface import report_rml -from openerp.report.interface import toxml -from openerp.tools.translate import _ -from openerp.report import report_sxw -from openerp.tools import ustr -from openerp.tools import to_xml - -def lengthmonth(year, month): - if month == 2 and ((year % 4 == 0) and ((year % 100 != 0) or (year % 400 == 0))): - return 29 - return [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month] - -class report_custom(report_rml): - - def get_month_name(self, cr, uid, month, context=None): - _months = {1:_("January"), 2:_("February"), 3:_("March"), 4:_("April"), 5:_("May"), 6:_("June"), 7:_("July"), 8:_("August"), 9:_("September"), 10:_("October"), 11:_("November"), 12:_("December")} - return _months[month] - def get_weekday_name(self, cr, uid, weekday, context=None): - _weekdays = {1:_('Mon'), 2:_('Tue'), 3:_('Wed'), 4:_('Thu'), 5:_('Fri'), 6:_('Sat'), 7:_('Sun')} - return _weekdays[weekday] - - def create_xml(self, cr, uid, ids, data, context): - registry = openerp.registry(cr.dbname) - - # Get the user id from the selected employee record - emp_id = data['form']['employee_id'] - emp_obj = registry['hr.employee'] - user_id = emp_obj.browse(cr, uid, emp_id).user_id.id - empl_name = emp_obj.browse(cr, uid, emp_id).name - - # Computing the dates (start of month: som, and end of month: eom) - som = datetime.date(data['form']['year'], data['form']['month'], 1) - eom = som + datetime.timedelta(lengthmonth(som.year, som.month)) - - date_xml = ['' % (self.get_month_name(cr, uid, som.month, context=context), som.year), ''] - date_xml += ['' % (x, self.get_weekday_name(cr, uid, som.replace(day=x).weekday()+1, context=context), som.replace(day=x).weekday()+1) for x in range(1, lengthmonth(som.year, som.month)+1)] - - date_xml.append('') - date_xml.append('2.5cm%s,2cm\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 "\ - "from account_analytic_line as line, hr_analytic_timesheet as hr, "\ - "account_analytic_account as account, product_uom as unit "\ - "where hr.line_id=line.id and line.account_id=account.id "\ - "and product_uom_id = unit.id "\ - "and line.user_id=%s and line.date >= %s and line.date < %s " - "order by line.date", - (user_id, som.strftime('%Y-%m-%d'), eom.strftime('%Y-%m-%d'))) - - for presence in cr.dictfetchall(): - day = int(presence['date'][-2:]) - account = accounts.setdefault((presence['account_id'], presence['name']), {}) - account[day] = account.get(day, 0.0) + presence['amount'] - - xml = ''' - - %.2f - - ''' - rpt_obj = registry['hr.employee'] - rml_obj = report_sxw.rml_parse(cr, uid, rpt_obj._name,context) - if user_id: - header_xml = ''' -
- %s - %s -
- ''' % (str(rml_obj.formatLang(time.strftime("%Y-%m-%d"),date=True))+' ' + str(time.strftime("%H:%M")),to_xml(registry['res.users'].browse(cr,uid,user_id).company_id.name)) - - account_xml = [] - for account, telems in accounts.iteritems(): - aid, aname = account - aname = registry['account.analytic.account'].name_get(cr, uid, [aid], context) - aname = aname[0][1] - - account_xml.append('' % (aid, toxml(aname))) - account_xml.append('\n'.join([xml % (day, amount) for day, amount in telems.iteritems()])) - account_xml.append('') - - # Computing the xml - xml = ''' - - %s - %s - %s - - ''' % (header_xml, ustr(toxml(empl_name)), '\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') - - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/hr_timesheet/report/user_timesheet.xsl b/addons/hr_timesheet/report/user_timesheet.xsl deleted file mode 100644 index b58e8af33b2..00000000000 --- a/addons/hr_timesheet/report/user_timesheet.xsl +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - lightgrey - - - ,0 - - - - ,-1 - - - - - - - - - - - - - - Timesheet by Employee - - - - - month - - - - - - - - - - - - - - - - - - Total - - - - Sum - - - - - - - glande - - - normal_people - - - esclave - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/addons/hr_timesheet/report/users_timesheet.py b/addons/hr_timesheet/report/users_timesheet.py deleted file mode 100644 index 0d3f23e6bd3..00000000000 --- a/addons/hr_timesheet/report/users_timesheet.py +++ /dev/null @@ -1,123 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). -# -# This program is free software: you can redistribute it and/or modify -# 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 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 . -# -############################################################################## - -import datetime -import time - -import openerp -from openerp.report.interface import report_rml -from openerp.report.interface import toxml -from openerp.tools.translate import _ -from openerp.report import report_sxw -from openerp.tools import ustr - - -def lengthmonth(year, month): - if month == 2 and ((year % 4 == 0) and ((year % 100 != 0) or (year % 400 == 0))): - return 29 - return [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month] - -def emp_create_xml(cr, id, som, eom, emp): - # Computing the attendence by analytical account - cr.execute( - "select line.date, (unit_amount / unit.factor) as amount "\ - "from account_analytic_line as line, hr_analytic_timesheet as hr, "\ - "product_uom as unit "\ - "where hr.line_id=line.id "\ - "and product_uom_id = unit.id "\ - "and line.user_id=%s and line.date >= %s and line.date < %s " - "order by line.date", - (id, som.strftime('%Y-%m-%d'), eom.strftime('%Y-%m-%d'))) - - # Sum by day - month = {} - for presence in cr.dictfetchall(): - day = int(presence['date'][-2:]) - month[day] = month.get(day, 0.0) + presence['amount'] - - xml = ''' - - %.2f - - ''' - time_xml = ([xml % (day, amount) for day, amount in month.iteritems()]) - - # Computing the xml - xml = ''' - - %s - - ''' % (id, toxml(emp), '\n'.join(time_xml)) - return xml - -class report_custom(report_rml): - - def get_month_name(self, cr, uid, month, context=None): - _months = {1:_("January"), 2:_("February"), 3:_("March"), 4:_("April"), 5:_("May"), 6:_("June"), 7:_("July"), 8:_("August"), 9:_("September"), 10:_("October"), 11:_("November"), 12:_("December")} - return _months[month] - - def get_weekday_name(self, cr, uid, weekday, context=None): - _weekdays = {1:_('Mon'), 2:_('Tue'), 3:_('Wed'), 4:_('Thu'), 5:_('Fri'), 6:_('Sat'), 7:_('Sun')} - return _weekdays[weekday] - - def create_xml(self, cr, uid, ids, data, context): - registry = openerp.registry(cr.dbname) - - # Computing the dates (start of month: som, and end of month: eom) - som = datetime.date(data['form']['year'], data['form']['month'], 1) - eom = som + datetime.timedelta(lengthmonth(som.year, som.month)) - date_xml = ['' % (self.get_month_name(cr, uid, som.month, context=context), som.year), ''] - date_xml += ['' % (x, self.get_weekday_name(cr, uid, som.replace(day=x).weekday()+1, context=context), som.replace(day=x).weekday()+1) for x in range(1, lengthmonth(som.year, som.month)+1)] - date_xml.append('') - date_xml.append('2.5cm%s,2cm\n' % (',0.7cm' * lengthmonth(som.year, som.month))) - - emp_xml='' - emp_obj = registry['hr.employee'] - for id in data['form']['employee_ids']: - user = emp_obj.browse(cr, uid, id).user_id.id - empl_name = emp_obj.browse(cr, uid, id).name - if user: - emp_xml += emp_create_xml(cr, user, som, eom, empl_name) - # Computing the xml - #Without this, report don't show non-ascii characters (TO CHECK) - date_xml = '\n'.join(date_xml) - rpt_obj = emp_obj - rml_obj=report_sxw.rml_parse(cr, uid, rpt_obj._name,context) - header_xml = ''' -
- %s - %s -
- ''' % (str(rml_obj.formatLang(time.strftime("%Y-%m-%d"),date=True))+' ' + str(time.strftime("%H:%M")),toxml(registry['res.users'].browse(cr,uid,uid).company_id.name)) - - xml=''' - - %s - %s - %s - - ''' % (header_xml,date_xml, ustr(emp_xml)) - return xml - -report_custom('report.hr.analytical.timesheet_users', 'hr.employee', '', 'addons/hr_timesheet/report/users_timesheet.xsl') - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/addons/hr_timesheet/report/users_timesheet.xsl b/addons/hr_timesheet/report/users_timesheet.xsl deleted file mode 100644 index 9c99b56afe6..00000000000 --- a/addons/hr_timesheet/report/users_timesheet.xsl +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - lightgrey - - - ,0 - - - - ,-1 - - - - - - - - - - - - - - Employees Timesheet - - - month - - - - - - - - - - - - - - - - - - Total - - - - - - - - - - - - - glande - - - normal_people - - - esclave - - - - - - - - - - - - - Total - - - - - - - - -