summaryrefslogtreecommitdiff
path: root/addons/report_project
diff options
context:
space:
mode:
authorpinky <>2006-12-07 13:41:40 +0000
committerpinky <>2006-12-07 13:41:40 +0000
commita83dce15e0f33145b2eea7e878ae7eacf3aba90a (patch)
treea3d1399cbfebf7d90a8894d97c9b7e0a9d881960 /addons/report_project
parent004a0b996ff8f269451e07346f71a129a1f3fbaf (diff)
New trunk
bzr revid: pinky-dedd7f8a42bd4557112a0513082691b8590ad6cc
Diffstat (limited to 'addons/report_project')
-rw-r--r--addons/report_project/__init__.py30
-rw-r--r--addons/report_project/__terp__.py14
-rw-r--r--addons/report_project/report_project.py109
-rw-r--r--addons/report_project/report_project_view.xml116
4 files changed, 269 insertions, 0 deletions
diff --git a/addons/report_project/__init__.py b/addons/report_project/__init__.py
new file mode 100644
index 00000000000..20af2105b36
--- /dev/null
+++ b/addons/report_project/__init__.py
@@ -0,0 +1,30 @@
+##############################################################################
+#
+# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
+#
+# $Id: project.py 1005 2005-07-25 08:41:42Z nicoe $
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# 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 2
+# 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.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+##############################################################################
+
+import report_project
diff --git a/addons/report_project/__terp__.py b/addons/report_project/__terp__.py
new file mode 100644
index 00000000000..5c44a7859a9
--- /dev/null
+++ b/addons/report_project/__terp__.py
@@ -0,0 +1,14 @@
+{
+ "name" : "Sales Management - Reporting",
+ "version" : "1.0",
+ "author" : "Tiny",
+ "website" : "http://tinyerp.com/module_project.html",
+ "depends" : ["project"],
+ "category" : "Generic Modules/Sales & Purchases",
+ "description": "A module that adds some reports on the sales",
+ "init_xml" : [],
+ "demo_xml" : [],
+ "update_xml" : ["report_project_view.xml"],
+ "active": False,
+ "installable": True
+}
diff --git a/addons/report_project/report_project.py b/addons/report_project/report_project.py
new file mode 100644
index 00000000000..51286cdb814
--- /dev/null
+++ b/addons/report_project/report_project.py
@@ -0,0 +1,109 @@
+##############################################################################
+#
+# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
+#
+# $Id: project.py 1005 2005-07-25 08:41:42Z nicoe $
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# 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 2
+# 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.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+##############################################################################
+
+from osv import fields,osv
+
+class report_project_task_user(osv.osv):
+ _name = "report.project.task.user"
+ _description = "Tasks by user and project"
+ _auto = False
+ _columns = {
+ 'name': fields.date('Month', readonly=True),
+ 'user_id':fields.many2one('res.users', 'User', readonly=True, relate=True),
+ 'project_id':fields.many2one('project.project', 'Project', readonly=True, relate=True),
+ 'hours_planned': fields.float('Planned Hours', readonly=True),
+ 'hours_effective': fields.float('Effective Hours', readonly=True),
+ 'hours_delay': fields.float('Avg. Plan.-Eff.', readonly=True),
+ 'closing_days': fields.char('Avg Closing Delay', size=64, readonly=True),
+ 'task_closed': fields.integer('Task Closed', readonly=True),
+ }
+ _order = 'name desc, project_id'
+ def init(self, cr):
+ cr.execute("""
+ create or replace view report_project_task_user as (
+ select
+ min(t.id) as id,
+ substring(date_close for 7)||'-01' as name,
+ count(distinct t.id) as task_closed,
+ t.user_id,
+ t.project_id,
+ sum(planned_hours) as hours_planned,
+ to_char(avg(date_close::abstime-t.create_date::timestamp), 'DD"d" HH12:MI:SS') as closing_days,
+ sum(w.hours) as hours_effective,
+ ((sum(planned_hours)-sum(w.hours))/count(distinct t.id))::decimal(16,2) as hours_delay
+ from project_task t
+ left join project_task_work w on (t.id=w.task_id)
+ where
+ t.state='done'
+ group by
+ substring(date_close for 7),t.user_id,project_id
+ )
+ """)
+report_project_task_user()
+
+
+class report_project_task(osv.osv):
+ _name = "report.project.task"
+ _description = "Tasks by project"
+ _auto = False
+ _columns = {
+ 'name': fields.date('Month', readonly=True),
+ 'project_id':fields.many2one('project.project', 'Project', readonly=True, relate=True),
+ 'hours_planned': fields.float('Planned Hours', readonly=True),
+ 'hours_effective': fields.float('Effective Hours', readonly=True),
+ 'hours_delay': fields.float('Avg. Plan.-Eff.', readonly=True),
+ 'closing_days': fields.char('Avg Closing Delay', size=64, readonly=True),
+ 'task_closed': fields.integer('Task Closed', readonly=True),
+ }
+ _order = 'name desc, project_id'
+ def init(self, cr):
+ cr.execute("""
+ create or replace view report_project_task as (
+ select
+ min(t.id) as id,
+ substring(date_close for 7)||'-01' as name,
+ count(distinct t.id) as task_closed,
+ t.project_id,
+ sum(planned_hours) as hours_planned,
+ to_char(avg(date_close::abstime-t.create_date::timestamp), 'DD"d" HH12:MI:SS') as closing_days,
+ sum(w.hours) as hours_effective,
+ ((sum(planned_hours)-sum(w.hours))/count(distinct t.id))::decimal(16,2) as hours_delay
+ from project_task t
+ left join project_task_work w on (t.id=w.task_id)
+ where
+ t.state='done'
+ group by
+ substring(date_close for 7),project_id
+ )
+ """)
+report_project_task()
+
+
+
+
diff --git a/addons/report_project/report_project_view.xml b/addons/report_project/report_project_view.xml
new file mode 100644
index 00000000000..be369824d43
--- /dev/null
+++ b/addons/report_project/report_project_view.xml
@@ -0,0 +1,116 @@
+<?xml version="1.0"?>
+<terp>
+<data>
+
+ #
+ # Tasks by projects and users
+ #
+
+ <record model="ir.ui.view" id="view_task_project_user_form">
+ <field name="name">report.project.task.user.form</field>
+ <field name="model">report.project.task.user</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Tasks by Project and User">
+ <field name="name" select="1"/>
+ <field name="user_id" select="1"/>
+ <field name="project_id" select="1"/>
+ <field name="task_closed" select="1"/>
+ <field name="hours_planned" select="1"/>
+ <field name="hours_effective" select="1"/>
+ <field name="hours_delay" select="1"/>
+ <field name="closing_days"/>
+ </form>
+ </field>
+ </record>
+
+
+ <record model="ir.ui.view" id="view_task_project_user_tree">
+ <field name="name">report.project.task.user.tree</field>
+ <field name="model">report.project.task.user</field>
+ <field name="type">tree</field>
+ <field name="arch" type="xml">
+ <tree string="Tasks by projects and users">
+ <field name="name" select="1"/>
+ <field name="user_id" select="1"/>
+ <field name="project_id" select="1"/>
+ <field name="task_closed" select="1"/>
+ <field name="hours_planned" select="1"/>
+ <field name="hours_effective" select="1"/>
+ <field name="hours_delay" select="1"/>
+ <field name="closing_days"/>
+ </tree>
+ </field>
+ </record>
+ <record model="ir.actions.act_window" id="action_project_task_user_tree_month">
+ <field name="name">report.project.task.user.tree</field>
+ <field name="res_model">report.project.task.user</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">tree</field>
+ <field name="domain">[('name','=',time.strftime('%Y-%m-01'))]</field>
+ </record>
+ <menuitem name="Project/Reporting/This Month/Tasks finnished this month by project and user" action="action_project_task_user_tree_month" id="menu_project_task_user_tree_month"/>
+
+ <record model="ir.actions.act_window" id="action_project_task_user_tree">
+ <field name="name">report.project.task.user.tree</field>
+ <field name="res_model">report.project.task.user</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">tree</field>
+ </record>
+ <menuitem name="Project/Reporting/All Months/Tasks closed by project and user" action="action_project_task_user_tree" id="menu_project_task_user_tree"/>
+
+ #
+ # Tasks by projects
+ #
+
+ <record model="ir.ui.view" id="view_task_project_form">
+ <field name="name">report.project.task.form</field>
+ <field name="model">report.project.task</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Tasks by Project">
+ <field name="name" select="1"/>
+ <field name="project_id" select="1"/>
+ <field name="task_closed" select="1"/>
+ <field name="hours_planned" select="1"/>
+ <field name="hours_effective" select="1"/>
+ <field name="hours_delay" select="1"/>
+ <field name="closing_days"/>
+ </form>
+ </field>
+ </record>
+ <record model="ir.ui.view" id="view_task_project_tree">
+ <field name="name">report.project.task.tree</field>
+ <field name="model">report.project.task</field>
+ <field name="type">tree</field>
+ <field name="arch" type="xml">
+ <tree string="Tasks by project">
+ <field name="name" select="1"/>
+ <field name="project_id" select="1"/>
+ <field name="task_closed" select="1"/>
+ <field name="hours_planned" select="1"/>
+ <field name="hours_effective" select="1"/>
+ <field name="hours_delay" select="1"/>
+ <field name="closing_days"/>
+ </tree>
+ </field>
+ </record>
+ <record model="ir.actions.act_window" id="action_project_task_tree_month">
+ <field name="name">report.project.task.tree</field>
+ <field name="res_model">report.project.task</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">tree</field>
+ <field name="domain">[('name','=',time.strftime('%Y-%m-01'))]</field>
+ </record>
+ <menuitem name="Project/Reporting/This Month/Tasks finnished this month by project" action="action_project_task_tree_month" id="menu_project_task_tree_month"/>
+
+ <record model="ir.actions.act_window" id="action_project_task_tree">
+ <field name="name">report.project.task.tree</field>
+ <field name="res_model">report.project.task</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">tree</field>
+ </record>
+ <menuitem name="Project/Reporting/All Months/Tasks closed by project" action="action_project_task_tree" id="menu_project_task_tree"/>
+
+</data>
+</terp>