[REM] project_timesheet: report_timesheet_task_user
authorrsi-odoo <rsi@openerp.com>
Wed, 13 Aug 2014 08:56:19 +0000 (14:26 +0530)
committerRichard Mathot <rim@openerp.com>
Fri, 31 Oct 2014 07:21:55 +0000 (12:51 +0530)
addons/project_timesheet/__init__.py
addons/project_timesheet/__openerp__.py
addons/project_timesheet/report/__init__.py [deleted file]
addons/project_timesheet/report/task_report.py [deleted file]
addons/project_timesheet/report/task_report_view.xml [deleted file]
addons/project_timesheet/security/ir.model.access.csv
addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml

index ceae2d0..7c6eff5 100644 (file)
@@ -2,7 +2,7 @@
 ##############################################################################
 #
 #    OpenERP, Open Source Management Solution
-#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#    Copyright (C) 2004-2014 OpenERP S.A. (<https://www.odoo.com>).
 #
 #    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 <http://www.gnu.org/licenses/>.
 #
 ##############################################################################
+
 import project_timesheet
-import report
 
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
index 14c0b52..3838729 100644 (file)
@@ -2,7 +2,7 @@
 ##############################################################################
 #
 #    OpenERP, Open Source Management Solution
-#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#    Copyright (C) 2004-2014 OpenERP S.A. (<https://www.odoo.com>).
 #
 #    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 (file)
index 24e75e1..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-#    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 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 <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-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 (file)
index 5f821ca..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-#    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 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 <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-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 (file)
index 2295720..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
- <data>
-          <menuitem
-            id="hr.menu_hr_reporting"
-            name="Human Resources"
-            parent="base.menu_reporting"
-            sequence="60" />
-
-        <!-- Report for Users' Timesheet and Task Hours per Month -->
-
-      <record id="view_report_timesheet_task_user_search" model="ir.ui.view">
-            <field name="name">report.timesheet.task.user.search</field>
-            <field name="model">report.timesheet.task.user</field>
-            <field name="arch" type="xml">
-                <search string="Tasks by User">
-                    <field name="name" string="Date"/>
-                    <field name="user_id"/>
-                    <group expand="1" string="Group By">
-                        <filter string="User" name="group_user_id" icon="terp-personal" context="{'group_by':'user_id'}"/>
-                        <filter string="Month" icon="terp-go-month" context="{'group_by':'month'}" help="Group by month of date"/>
-                        <filter string="Year" icon="terp-go-year" context="{'group_by':'year'}" help="Group by year of date"/>
-                    </group>
-                </search>
-            </field>
-        </record>
-
-        <record id="view_task_hour_per_month_graph" model="ir.ui.view">
-            <field name="name">report.timesheet.task.user.graph</field>
-            <field name="model">report.timesheet.task.user</field>
-            <field name="arch" type="xml">
-                <graph string="Task Hours Per Month" type="bar">
-                     <field name="user_id"/>
-                     <field name="task_hrs" operator="+"/>
-                     <field name="timesheet_hrs" operator="+"/>
-                 </graph>
-            </field>
-        </record>
-
-        <record id="action_report_timesheet_task_user" model="ir.actions.act_window">
-            <field name="name">Task Hours Per Month</field>
-            <field name="res_model">report.timesheet.task.user</field>
-            <field name="view_type">form</field>
-            <field name="view_mode">graph</field>
-            <field name="context">{'search_default_year':1,'search_default_month':1, 'search_default_group_user_id':1}</field>
-        </record>
-        <menuitem id="menu_timesheet_task_user" parent="hr.menu_hr_reporting_timesheet"
-                    action="action_report_timesheet_task_user" sequence="1"/>
-
-    </data>
-</openerp>
index 2414353..e8f7bad 100644 (file)
@@ -1,6 +1,4 @@
 id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink\r
-access_report_timesheet_task_user_manager,report.timesheet.task.user.manager,model_report_timesheet_task_user,project.group_project_manager,1,1,1,1\r
-access_hr_analytic_timesheet_user,hr.analytic.timesheet.user,hr_timesheet_sheet.model_hr_analytic_timesheet,project.group_project_user,1,1,1,0\r
-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\r
+access_hr_analytic_timesheet_user,hr.analytic.timesheet.user,hr_timesheet.model_hr_analytic_timesheet,project.group_project_user,1,1,1,0\r
 access_sale_order_manager,sale.order,sale.model_sale_order,project.group_project_manager,1,0,0,0\r
 access_sale_order_user,sale.order,sale.model_sale_order,project.group_project_user,1,0,0,0\r
index bab5a08..5ba4b83 100644 (file)
     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'
 -
   !record {model: project.project, id: project_project_timesheetmanagement0}:
@@ -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