diff --git a/addons/project_timesheet/__init__.py b/addons/project_timesheet/__init__.py index ceae2d0185a..7c6eff5f454 100644 --- a/addons/project_timesheet/__init__.py +++ b/addons/project_timesheet/__init__.py @@ -2,7 +2,7 @@ ############################################################################## # # OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). +# Copyright (C) 2004-2014 OpenERP S.A. (). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -18,7 +18,6 @@ # along with this program. If not, see . # ############################################################################## -import project_timesheet -import report -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +import project_timesheet + diff --git a/addons/project_timesheet/__openerp__.py b/addons/project_timesheet/__openerp__.py index 14c0b52b6a0..383872955d4 100644 --- a/addons/project_timesheet/__openerp__.py +++ b/addons/project_timesheet/__openerp__.py @@ -2,7 +2,7 @@ ############################################################################## # # OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). +# Copyright (C) 2004-2014 OpenERP S.A. (). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -34,11 +34,10 @@ with the effect of creating, editing and deleting either ways. 'author': 'OpenERP SA', 'website': 'https://www.odoo.com/page/project-management', 'images': ['images/invoice_task_work.jpeg', 'images/my_timesheet.jpeg', 'images/working_hour.jpeg'], - 'depends': ['resource', 'project', 'hr_timesheet_sheet', 'hr_timesheet_invoice', 'account_analytic_analysis', 'procurement'], + 'depends': ['resource', 'project', 'hr_timesheet', 'hr_timesheet_invoice', 'account_analytic_analysis', 'procurement'], 'data': [ 'security/ir.model.access.csv', 'security/project_timesheet_security.xml', - 'report/task_report_view.xml', 'project_timesheet_view.xml', ], 'demo': ['project_timesheet_demo.xml'], @@ -49,4 +48,3 @@ with the effect of creating, editing and deleting either ways. 'installable': True, 'auto_install': True, } -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/project_timesheet/report/__init__.py b/addons/project_timesheet/report/__init__.py deleted file mode 100644 index 24e75e1cf35..00000000000 --- a/addons/project_timesheet/report/__init__.py +++ /dev/null @@ -1,22 +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 task_report -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/project_timesheet/report/task_report.py b/addons/project_timesheet/report/task_report.py deleted file mode 100644 index 5f821ca400d..00000000000 --- a/addons/project_timesheet/report/task_report.py +++ /dev/null @@ -1,83 +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 . -# -############################################################################## -from datetime import datetime -from dateutil.relativedelta import relativedelta - -from openerp.osv import fields,osv -from openerp import tools - -class report_timesheet_task_user(osv.osv): - _name = "report.timesheet.task.user" - _auto = False - _order = "name" - - def get_hrs_timesheet(self, cr, uid, ids, name, args, context): - result = {} - for record in self.browse(cr, uid, ids, context): - last_date = datetime.strptime(record.name, '%Y-%m-%d') + relativedelta(months=1) - relativedelta(days=1) - obj = self.pool.get('hr_timesheet_sheet.sheet.day') - sheet_ids = obj.search(cr, uid, [('sheet_id.user_id','=',record.user_id.id),('name','>=',record.name),('name','<=',last_date.strftime('%Y-%m-%d'))]) - data_days = obj.read(cr, uid, sheet_ids, ['name','sheet_id.user_id','total_attendance']) - total = 0.0 - for day_attendance in data_days: - total += day_attendance['total_attendance'] - result[record.id] = total - return result - - _columns = { - 'name': fields.char('Date'), - 'year': fields.char('Year', size=4, required=False, readonly=True), - 'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), ('05','May'), ('06','June'), - ('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')],'Month', readonly=True), - 'user_id': fields.many2one('res.users', 'User',readonly=True), - 'timesheet_hrs': fields.function(get_hrs_timesheet, string="Timesheet Hours"), - 'task_hrs' : fields.float('Task Hours'), - } - - def init(self, cr): - tools.drop_view_if_exists(cr, 'report_timesheet_task_user') - cr.execute(""" create or replace view report_timesheet_task_user as ( - select - ((r.id*12)+to_number(months.m_id,'999999'))::integer as id, - months.name as name, - r.id as user_id, - to_char(to_date(months.name, 'YYYY/MM/DD'),'YYYY') as year, - to_char(to_date(months.name, 'YYYY/MM/DD'),'MM') as month, - (select sum(hours) from project_task_work where user_id = r.id and date between to_date(months.name, 'YYYY/MM/DD') and (to_date(months.name, 'YYYY/MM/DD') + interval '1 month' - - interval '1 day') ) as task_hrs - from res_users r, - (select to_char(p.date,'YYYY-MM-01') as name, - to_char(p.date,'YYYYMM') as m_id - from project_task_work p - - union - select to_char(h.name,'YYYY-MM-01') as name, - to_char(h.name,'YYYYMM') as m_id - from hr_timesheet_sheet_sheet_day h) as months - - group by - r.id,months.m_id,months.name, - to_char(to_date(months.name, 'YYYY/MM/DD'),'YYYY') , - to_char(to_date(months.name, 'YYYY/MM/DD'),'MM') - ) """) - - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/project_timesheet/report/task_report_view.xml b/addons/project_timesheet/report/task_report_view.xml deleted file mode 100644 index 22957208d2a..00000000000 --- a/addons/project_timesheet/report/task_report_view.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - report.timesheet.task.user.search - report.timesheet.task.user - - - - - - - - - - - - - - - report.timesheet.task.user.graph - report.timesheet.task.user - - - - - - - - - - - Task Hours Per Month - report.timesheet.task.user - form - graph - {'search_default_year':1,'search_default_month':1, 'search_default_group_user_id':1} - - - - - diff --git a/addons/project_timesheet/security/ir.model.access.csv b/addons/project_timesheet/security/ir.model.access.csv index 24143531f53..e8f7badf40a 100644 --- a/addons/project_timesheet/security/ir.model.access.csv +++ b/addons/project_timesheet/security/ir.model.access.csv @@ -1,6 +1,4 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_report_timesheet_task_user_manager,report.timesheet.task.user.manager,model_report_timesheet_task_user,project.group_project_manager,1,1,1,1 -access_hr_analytic_timesheet_user,hr.analytic.timesheet.user,hr_timesheet_sheet.model_hr_analytic_timesheet,project.group_project_user,1,1,1,0 -access_hr_timesheet_sheet_sheet_user,hr.timesheet.sheet.sheet.user,hr_timesheet_sheet.model_hr_timesheet_sheet_sheet,project.group_project_user,1,1,1,0 +access_hr_analytic_timesheet_user,hr.analytic.timesheet.user,hr_timesheet.model_hr_analytic_timesheet,project.group_project_user,1,1,1,0 access_sale_order_manager,sale.order,sale.model_sale_order,project.group_project_manager,1,0,0,0 access_sale_order_user,sale.order,sale.model_sale_order,project.group_project_user,1,0,0,0 diff --git a/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml b/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml index bab5a083e3d..5ba4b832bd2 100644 --- a/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml +++ b/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml @@ -38,16 +38,6 @@ user_id: res_users_hrmanager0 product_id: product_product_hrmanger0 journal_id: account_analytic_journal_hrtimesheet0 -- - Create a timesheet sheet for HR manager -- - !record {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_sheetforhrmanager0}: - date_from: !eval "'%s-05-01' %(datetime.now().year)" - date_to: !eval "'%s-05-31' %(datetime.now().year)" - name: Sheet for hr manager - state: new - user_id: res_users_hrmanager0 - employee_id : 'hr_employee_hrmanager0' - Create a project 'Timesheet Management' - @@ -73,8 +63,3 @@ hours: 10.0 name: Get work calendar of all employees user_id: res_users_hrmanager0 -- - Check for timesheet_ids in HR manager's timesheet -- - !assert {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_sheetforhrmanager0, string: After hr manager's work task, length of timesheet line of current timesheet must be greater then 1}: - - len(timesheet_ids) > 0