Dashboard for project users and managers
Statistics and planning module on analytic account Statistics on timesheets bzr revid: pinky-aba8a5cb10e2b551eaed0931d3508999004f7e0f
This commit is contained in:
parent
484630fc57
commit
f87849b8a8
|
@ -0,0 +1,29 @@
|
|||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
# Fabien Pinckaers <fp@tiny.Be>
|
||||
#
|
||||
# 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 board
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"name":"Dashboard main module",
|
||||
"version":"1.0",
|
||||
"author":"Tiny",
|
||||
"category":"Board",
|
||||
"depends":["base"],
|
||||
"demo_xml":[],
|
||||
"update_xml":["board_view.xml"],
|
||||
"active":False,
|
||||
"installable":True,
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
# Fabien Pinckaers <fp@tiny.Be>
|
||||
#
|
||||
# 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 time
|
||||
from osv import fields,osv
|
||||
|
||||
class board(osv.osv):
|
||||
_name = 'board.board'
|
||||
def create(self, cr, user, vals, context={}):
|
||||
return False
|
||||
def copy(self, cr, uid, id, default=None, context={}):
|
||||
return False
|
||||
_columns = {
|
||||
'name': fields.char('Board', size=64),
|
||||
}
|
||||
board()
|
||||
|
||||
|
||||
class board_note_type(osv.osv):
|
||||
_name = 'board.note.type'
|
||||
_columns = {
|
||||
'name': fields.char('Note Type', size=64, required=True),
|
||||
}
|
||||
board_note_type()
|
||||
|
||||
def _type_get(self, cr, uid, context={}):
|
||||
obj = self.pool.get('board.note.type')
|
||||
ids = obj.search(cr, uid, [])
|
||||
res = obj.read(cr, uid, ids, ['name'], context)
|
||||
res = [(r['name'], r['name']) for r in res]
|
||||
return res
|
||||
|
||||
class board_note(osv.osv):
|
||||
_name = 'board.note'
|
||||
_columns = {
|
||||
'name': fields.char('Subject', size=128, required=True),
|
||||
'note': fields.text('Note'),
|
||||
'user_id': fields.many2one('res.users', 'Author', size=64),
|
||||
'date': fields.date('Date', size=64, required=True),
|
||||
'type': fields.char('Note type', size=64),
|
||||
'type': fields.selection(_type_get, 'Note type', size=64),
|
||||
}
|
||||
_defaults = {
|
||||
'user_id': lambda object,cr,uid,context: uid,
|
||||
'date': lambda object,cr,uid,context: time.strftime('%Y-%m-%d'),
|
||||
}
|
||||
board_note()
|
|
@ -0,0 +1,40 @@
|
|||
<?xml version="1.0"?>
|
||||
<terp>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="view_board_note_tree">
|
||||
<field name="name">board.note.tree</field>
|
||||
<field name="model">board.note</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Notes">
|
||||
<field name="name"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="view_board_note_form">
|
||||
<field name="name">board.note.form</field>
|
||||
<field name="model">board.note</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Note">
|
||||
<field name="name" select="1"/>
|
||||
<field name="type" select="1"/>
|
||||
<field name="user_id" select="1"/>
|
||||
<field name="date" select="1"/>
|
||||
<field name="note" colspan="3"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="action_view_board_note_form">
|
||||
<field name="name">Publish a note</field>
|
||||
<field name="res_model">board.note</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form,tree</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Dashboards/Notes"
|
||||
action="action_view_board_note_form"
|
||||
sequence="100"
|
||||
id="menu_view_board_note_form"/>
|
||||
</data>
|
||||
</terp>
|
|
@ -0,0 +1,28 @@
|
|||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
# Fabien Pinckaers <fp@tiny.Be>
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
##############################################################################
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"name":"Board for project users",
|
||||
"version":"1.0",
|
||||
"author":"Tiny",
|
||||
"category":"Board",
|
||||
"depends":["project","report_timesheet","board"],
|
||||
"demo_xml":[],
|
||||
"update_xml":["board_project_view.xml"],
|
||||
"active":False,
|
||||
"installable":True,
|
||||
}
|
|
@ -0,0 +1,127 @@
|
|||
<?xml version="1.0"?>
|
||||
<terp>
|
||||
<data>
|
||||
|
||||
<record model="board.note.type" id="note_project_type">
|
||||
<field name="name">Project managers</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_task_tree">
|
||||
<field name="name">project.task.tree</field>
|
||||
<field name="model">project.task</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="99"/>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="My tasks" colors="red:date_deadline<current_date;blue:date_deadline==current_date">
|
||||
<field name="name"/>
|
||||
<field name="project_id"/>
|
||||
<field name="date_deadline"/>
|
||||
<field name="planned_hours"/>
|
||||
<field name="effective_hours"/>
|
||||
<field name="priority"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="action_view_task_tree">
|
||||
<field name="name">My open tasks</field>
|
||||
<field name="res_model">project.task</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,graph</field>
|
||||
<field name="domain">[('user_id','=',uid),('state','=','open')]</field>
|
||||
<field name="view_id" ref="view_task_tree" />
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="action_view_task_tree_deadline">
|
||||
<field name="name">My task's deadlines</field>
|
||||
<field name="res_model">project.task</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,graph</field>
|
||||
<field name="domain">[('user_id','=',uid),('state','=','open'),('date_deadline','<>',False)]</field>
|
||||
<field name="view_id" ref="view_task_tree" />
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_view_board_note_tree">
|
||||
<field name="name">Public notes</field>
|
||||
<field name="res_model">board.note</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="domain">[('type','=','Project')]</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="board_project_form">
|
||||
<field name="name">board.project.form</field>
|
||||
<field name="model">board.board</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Project">
|
||||
<hpaned>
|
||||
|
||||
<child1>
|
||||
|
||||
<action
|
||||
string="My open tasks"
|
||||
name="%(action_view_task_tree)d"
|
||||
colspan="4"
|
||||
height="220"
|
||||
width="510"/>
|
||||
|
||||
<action
|
||||
string="My deadlines"
|
||||
name="%(action_view_task_tree_deadline)d"
|
||||
height="150"
|
||||
colspan="4"/>
|
||||
|
||||
<action
|
||||
string="Public notes"
|
||||
name="%(action_view_board_note_tree)d"
|
||||
colspan="2"
|
||||
height="150"/>
|
||||
<action
|
||||
string="Public notes"
|
||||
name="%(action_view_board_note_tree)d"
|
||||
colspan="2"
|
||||
height="150"/>
|
||||
|
||||
|
||||
</child1>
|
||||
|
||||
<child2>
|
||||
<button
|
||||
string="Menu"
|
||||
name="%(base.action_menu_admin)d"
|
||||
icon="gtk-ok"
|
||||
type="action"
|
||||
colspan="4"/>
|
||||
|
||||
<action
|
||||
string="My timesheet"
|
||||
name="%(report_timesheet.action_timesheet_user_stat)d"
|
||||
colspan="4"/>
|
||||
|
||||
<action
|
||||
string="My work"
|
||||
name="%(report_analytic_line.action_account_analytic_planning_stat_my_form)d"
|
||||
colspan="4"/>
|
||||
|
||||
|
||||
</child2>
|
||||
</hpaned>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="open_board_sales_manager">
|
||||
<field name="name">Dashboard project member</field>
|
||||
<field name="res_model">board.board</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="usage">menu</field>
|
||||
<field name="view_id" ref="board_project_form"/>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
name="Dashboards/Project member"
|
||||
action="open_board_sales_manager"
|
||||
sequence="1"
|
||||
id="menu_board_sales_manager"/>
|
||||
</data>
|
||||
</terp>
|
|
@ -0,0 +1,127 @@
|
|||
<?xml version="1.0"?>
|
||||
<terp>
|
||||
<data>
|
||||
|
||||
<record model="board.note.type" id="note_project_type">
|
||||
<field name="name">Project</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_task_tree">
|
||||
<field name="name">project.task.tree</field>
|
||||
<field name="model">project.task</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="99"/>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="My tasks" colors="red:date_deadline<current_date;blue:date_deadline==current_date">
|
||||
<field name="name"/>
|
||||
<field name="project_id"/>
|
||||
<field name="date_deadline"/>
|
||||
<field name="planned_hours"/>
|
||||
<field name="effective_hours"/>
|
||||
<field name="priority"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="action_view_task_tree">
|
||||
<field name="name">My open tasks</field>
|
||||
<field name="res_model">project.task</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,graph</field>
|
||||
<field name="domain">[('user_id','=',uid),('state','=','open')]</field>
|
||||
<field name="view_id" ref="view_task_tree" />
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="action_view_task_tree_deadline">
|
||||
<field name="name">My task's deadlines</field>
|
||||
<field name="res_model">project.task</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,graph</field>
|
||||
<field name="domain">[('user_id','=',uid),('state','=','open'),('date_deadline','<>',False)]</field>
|
||||
<field name="view_id" ref="view_task_tree" />
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_view_board_note_tree">
|
||||
<field name="name">Public notes</field>
|
||||
<field name="res_model">board.note</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="domain">[('type','=','Project')]</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="board_project_form">
|
||||
<field name="name">board.project.form</field>
|
||||
<field name="model">board.board</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Project">
|
||||
<hpaned>
|
||||
|
||||
<child1>
|
||||
|
||||
<action
|
||||
string="My open tasks"
|
||||
name="%(action_view_task_tree)d"
|
||||
colspan="4"
|
||||
height="220"
|
||||
width="510"/>
|
||||
|
||||
<action
|
||||
string="My deadlines"
|
||||
name="%(action_view_task_tree_deadline)d"
|
||||
height="150"
|
||||
colspan="4"/>
|
||||
|
||||
<action
|
||||
string="Public notes"
|
||||
name="%(action_view_board_note_tree)d"
|
||||
colspan="2"
|
||||
height="150"/>
|
||||
<action
|
||||
string="Public notes"
|
||||
name="%(action_view_board_note_tree)d"
|
||||
colspan="2"
|
||||
height="150"/>
|
||||
|
||||
|
||||
</child1>
|
||||
|
||||
<child2>
|
||||
<button
|
||||
string="Menu"
|
||||
name="%(base.action_menu_admin)d"
|
||||
icon="gtk-ok"
|
||||
type="action"
|
||||
colspan="4"/>
|
||||
|
||||
<action
|
||||
string="My timesheet"
|
||||
name="%(report_timesheet.action_timesheet_user_stat)d"
|
||||
colspan="4"/>
|
||||
|
||||
<action
|
||||
string="My work"
|
||||
name="%(report_analytic_line.action_account_analytic_planning_stat_my_form)d"
|
||||
colspan="4"/>
|
||||
|
||||
|
||||
</child2>
|
||||
</hpaned>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="open_board_sales_manager">
|
||||
<field name="name">Dashboard project member</field>
|
||||
<field name="res_model">board.board</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="usage">menu</field>
|
||||
<field name="view_id" ref="board_project_form"/>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
name="Dashboards/Project member"
|
||||
action="open_board_sales_manager"
|
||||
sequence="1"
|
||||
id="menu_board_sales_manager"/>
|
||||
</data>
|
||||
</terp>
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"name":"Board for sale",
|
||||
"name":"Dashboard for sales",
|
||||
"version":"1.0",
|
||||
"author":"Tiny",
|
||||
"category":"Board",
|
||||
"depends":["base","sale", "report_crm", "report_sale"],
|
||||
"category":"Sales dashboard",
|
||||
"depends":["board","sale", "report_crm", "report_sale"],
|
||||
"demo_xml":[],
|
||||
"update_xml":["board_sale_view.xml"],
|
||||
"active":False,
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
<?xml version="1.0"?>
|
||||
<terp>
|
||||
<data>
|
||||
<record model="board.note.type" id="note_sale_type">
|
||||
<field name="name">Sales</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="board_sales_manager_form">
|
||||
<field name="name">board.sales.manager.form</field>
|
||||
<field name="model">ir.board</field>
|
||||
<field name="model">board.board</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Sales manager board">
|
||||
|
@ -32,7 +35,7 @@
|
|||
|
||||
<record model="ir.actions.act_window" id="open_board_sales_manager">
|
||||
<field name="name">board.sales.manager</field>
|
||||
<field name="res_model">ir.board</field>
|
||||
<field name="res_model">board.board</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="board_sales_manager_form"/>
|
||||
|
|
|
@ -28,3 +28,4 @@
|
|||
##############################################################################
|
||||
|
||||
import report_analytic_line
|
||||
import report_analytic_planning
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
"version" : "1.0",
|
||||
"author" : "Tiny",
|
||||
"website" : "http://tinyerp.com",
|
||||
"depends" : ["account", "hr_timesheet_invoice"],
|
||||
"depends" : ["account", "hr_timesheet_invoice","project"],
|
||||
"category" : "Generic Modules/Accounting",
|
||||
"description": "A report on analytic lines, costs by products, months and accounts.",
|
||||
"init_xml" : [],
|
||||
"demo_xml" : [],
|
||||
"update_xml" : ["report_analytic_line_view.xml"],
|
||||
"update_xml" : ["report_analytic_line_view.xml", "report_analytic_planning_view.xml"],
|
||||
"active": False,
|
||||
"installable": True
|
||||
}
|
||||
|
|
|
@ -0,0 +1,173 @@
|
|||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# $Id: sale.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_account_analytic_planning(osv.osv):
|
||||
_name = "report_account_analytic.planning"
|
||||
_description = "Planning"
|
||||
_columns = {
|
||||
'name': fields.char('Planning Name', size=32, required=True),
|
||||
'user_id': fields.many2one('res.users', 'Responsible', required=True),
|
||||
'date_from':fields.date('Start date', required=True),
|
||||
'date_to':fields.date('End date', required=True),
|
||||
'line_ids': fields.one2many('report_account_analytic.planning.line', 'planning_id', 'Planning lines'),
|
||||
'stat_ids': fields.one2many('report_account_analytic.planning.stat', 'planning_id', 'Planning analysis', readonly=True),
|
||||
'stat_user_ids': fields.one2many('report_account_analytic.planning.stat.user', 'planning_id', 'Planning by user', readonly=True),
|
||||
'stat_account_ids': fields.one2many('report_account_analytic.planning.stat.account', 'planning_id', 'Planning by account', readonly=True),
|
||||
}
|
||||
_order = 'date_from desc'
|
||||
report_account_analytic_planning()
|
||||
|
||||
class report_account_analytic_planning_line(osv.osv):
|
||||
_name = "report_account_analytic.planning.line"
|
||||
_description = "Planning Line"
|
||||
_rec_name = 'user_id'
|
||||
_columns = {
|
||||
'account_id':fields.many2one('account.analytic.account', 'Analytic account', required=True),
|
||||
'planning_id': fields.many2one('report_account_analytic.planning', 'Planning', required=True, ondelete='cascade'),
|
||||
'user_id': fields.many2one('res.users', 'User', required=True),
|
||||
'amount': fields.float('Quantity', required=True),
|
||||
'amount_unit':fields.many2one('product.uom', 'Qty UoM', required=True),
|
||||
}
|
||||
_order = 'user_id,account_id'
|
||||
report_account_analytic_planning_line()
|
||||
|
||||
class report_account_analytic_planning_stat_account(osv.osv):
|
||||
_name = "report_account_analytic.planning.stat.account"
|
||||
_description = "Planning account stat"
|
||||
_rec_name = 'account_id'
|
||||
_auto = False
|
||||
_columns = {
|
||||
'planning_id': fields.many2one('report_account_analytic.planning', 'Planning'),
|
||||
'account_id': fields.many2one('account.analytic.account', 'Analytic Account', required=True),
|
||||
'quantity': fields.float('Quantity', required=True)
|
||||
}
|
||||
def init(self, cr):
|
||||
cr.execute("""
|
||||
create or replace view report_account_analytic_planning_stat_account as (
|
||||
select
|
||||
min(l.id) as id,
|
||||
l.account_id as account_id,
|
||||
sum(l.amount*u.factor) as quantity,
|
||||
l.planning_id
|
||||
from
|
||||
report_account_analytic_planning_line l
|
||||
left join
|
||||
product_uom u on (l.amount_unit = u.id)
|
||||
group by
|
||||
planning_id, account_id
|
||||
)
|
||||
""")
|
||||
report_account_analytic_planning_stat_account()
|
||||
|
||||
class report_account_analytic_planning_stat(osv.osv):
|
||||
_name = "report_account_analytic.planning.stat"
|
||||
_description = "Planning stat"
|
||||
_rec_name = 'user_id'
|
||||
_auto = False
|
||||
def _sum_amount_real(self, cr, uid, ids, name, args, context):
|
||||
result = {}
|
||||
for line in self.browse(cr, uid, ids, context):
|
||||
cr.execute('select sum(unit_amount) from account_analytic_line where user_id=%d and account_id=%d and date>=%s and date<=%s', (line.user_id.id,line.account_id.id,line.planning_id.date_from,line.planning_id.date_to))
|
||||
result[line.id] = cr.fetchone()[0]
|
||||
return result
|
||||
def _sum_amount_tasks(self, cr, uid, ids, name, args, context):
|
||||
result = {}
|
||||
for line in self.browse(cr, uid, ids, context):
|
||||
cr.execute('''select
|
||||
sum(planned_hours)
|
||||
from
|
||||
project_task
|
||||
where
|
||||
user_id=%d and
|
||||
project_id in (select id from project_project where category_id=%d) and
|
||||
date_close>=%s and
|
||||
date_close<=%s''', (
|
||||
line.user_id.id,
|
||||
line.account_id.id,
|
||||
line.planning_id.date_from,
|
||||
line.planning_id.date_to)
|
||||
)
|
||||
result[line.id] = cr.fetchone()[0]
|
||||
return result
|
||||
_columns = {
|
||||
'planning_id': fields.many2one('report_account_analytic.planning', 'Planning'),
|
||||
'user_id': fields.many2one('res.users', 'User', required=True),
|
||||
'account_id': fields.many2one('account.analytic.account', 'Account', required=True),
|
||||
'sum_amount': fields.float('Planned Work', required=True),
|
||||
'sum_amount_real': fields.function(_sum_amount_real, method=True, string='Work made'),
|
||||
'sum_amount_tasks': fields.function(_sum_amount_tasks, method=True, string='Tasks made'),
|
||||
}
|
||||
def init(self, cr):
|
||||
cr.execute("""
|
||||
create or replace view report_account_analytic_planning_stat as (
|
||||
select
|
||||
min(l.id) as id,
|
||||
l.user_id as user_id,
|
||||
l.account_id as account_id,
|
||||
sum(l.amount*u.factor) as sum_amount,
|
||||
l.planning_id
|
||||
from
|
||||
report_account_analytic_planning_line l
|
||||
left join
|
||||
product_uom u on (l.amount_unit = u.id)
|
||||
group by
|
||||
planning_id, user_id, account_id
|
||||
)
|
||||
""")
|
||||
report_account_analytic_planning_stat()
|
||||
|
||||
class report_account_analytic_planning_stat_user(osv.osv):
|
||||
_name = "report_account_analytic.planning.stat.user"
|
||||
_description = "Planning user stat"
|
||||
_rec_name = 'user_id'
|
||||
_auto = False
|
||||
_columns = {
|
||||
'planning_id': fields.many2one('report_account_analytic.planning', 'Planning'),
|
||||
'user_id': fields.many2one('res.users', 'User', required=True),
|
||||
'quantity': fields.float('Quantity', required=True)
|
||||
}
|
||||
def init(self, cr):
|
||||
cr.execute("""
|
||||
create or replace view report_account_analytic_planning_stat_user as (
|
||||
select
|
||||
min(l.id) as id,
|
||||
l.user_id as user_id,
|
||||
sum(l.amount*u.factor) as quantity,
|
||||
l.planning_id
|
||||
from
|
||||
report_account_analytic_planning_line l
|
||||
left join
|
||||
product_uom u on (l.amount_unit = u.id)
|
||||
group by
|
||||
planning_id, user_id
|
||||
)
|
||||
""")
|
||||
report_account_analytic_planning_stat_user()
|
|
@ -0,0 +1,153 @@
|
|||
<?xml version="1.0"?>
|
||||
<terp>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="account_analytic_planning_view_tree">
|
||||
<field name="name">report.account.analytic.planning.tree</field>
|
||||
<field name="model">report_account_analytic.planning</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Planning by account">
|
||||
<field name="name"/>
|
||||
<field name="user_id"/>
|
||||
<field name="date_from"/>
|
||||
<field name="date_to"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="account_analytic_planning_view_form">
|
||||
<field name="name">report.account.analytic.planning.form</field>
|
||||
<field name="model">report_account_analytic.planning</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Planning by account">
|
||||
<notebook>
|
||||
<page string="Planning">
|
||||
<field name="name" select="1"/>
|
||||
<field name="user_id" select="1"/>
|
||||
<field name="date_from"/>
|
||||
<field name="date_to"/>
|
||||
<field name="line_ids" colspan="4" nolabel="1">
|
||||
<tree string="Planning line" editable="bottom">
|
||||
<field name="user_id"/>
|
||||
<field name="account_id"/>
|
||||
<field name="amount"/>
|
||||
<field name="amount_unit"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page><page string="Analysis">
|
||||
<field name="stat_ids" colspan="4" nolabel="1" readonly="1">
|
||||
<tree string="Planning line" editable="bottom">
|
||||
<field name="user_id"/>
|
||||
<field name="account_id"/>
|
||||
<field name="sum_amount"/>
|
||||
<field name="sum_amount_real"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page><page string="Time by user">
|
||||
<field name="stat_user_ids" colspan="4" nolabel="1">
|
||||
<tree string="Quantities by user">
|
||||
<field name="user_id"/>
|
||||
<field name="quantity"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page><page string="Time by account">
|
||||
<field name="stat_account_ids" colspan="4" nolabel="1">
|
||||
<tree string="Quantities by account">
|
||||
<field name="account_id"/>
|
||||
<field name="quantity"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_account_analytic_planning_form">
|
||||
<field name="name">report_account_analytic.planning.form</field>
|
||||
<field name="res_model">report_account_analytic.planning</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form,tree</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Human Resources/Planning/Planning"
|
||||
id="menu_report_account_analytic_planning"
|
||||
action="action_account_analytic_planning_form" />
|
||||
|
||||
<!--
|
||||
Planning statistics
|
||||
-->
|
||||
<record model="ir.ui.view" id="account_analytic_planning_stat_view_form">
|
||||
<field name="name">report.account.analytic.planning.stat.form</field>
|
||||
<field name="model">report_account_analytic.planning.stat</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Planning statistics">
|
||||
<field name="planning_id" select="1"/>
|
||||
<field name="user_id" select="1"/>
|
||||
<field name="account_id" select="1"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="account_analytic_planning_stat_view_tree">
|
||||
<field name="name">report.account.analytic.planning.stat.tree</field>
|
||||
<field name="model">report_account_analytic.planning.stat</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Planning statistics">
|
||||
<field name="planning_id"/>
|
||||
<field name="user_id"/>
|
||||
<field name="account_id"/>
|
||||
<field name="sum_amount"/>
|
||||
<field name="sum_amount_real"/>
|
||||
<field name="sum_amount_tasks"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="account_analytic_planning_stat_view_graph">
|
||||
<field name="name">report.account.analytic.planning.stat.graph</field>
|
||||
<field name="model">report_account_analytic.planning.stat</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph string="Planning statistics" type="bar">
|
||||
<field name="account_id" group="True"/>
|
||||
<field name="sum_amount" operator="+"/>
|
||||
<field name="sum_amount_real" operator="+"/>
|
||||
<field name="sum_amount_tasks" operator="+"/>
|
||||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
<record model="ir.actions.act_window" id="action_account_analytic_planning_stat_form">
|
||||
<field name="name">report_account_analytic.planning.stat.graph</field>
|
||||
<field name="res_model">report_account_analytic.planning.stat</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">graph,tree</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Human Resources/Planning/Planning statistics for all users"
|
||||
id="menu_report_account_analytic_planning_stat"
|
||||
action="action_account_analytic_planning_stat_form" />
|
||||
|
||||
<record model="ir.actions.act_window" id="action_account_analytic_planning_stat_my_form">
|
||||
<field name="name">report_account_analytic.planning.stat.graph</field>
|
||||
<field name="res_model">report_account_analytic.planning.stat</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain">[('user_id','=',uid)]</field>
|
||||
<field name="view_mode">graph,tree</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Human Resources/Planning/My planning statistics"
|
||||
id="menu_report_account_analytic_planning_stat_my"
|
||||
action="action_account_analytic_planning_stat_my_form" />
|
||||
|
||||
|
||||
|
||||
</data>
|
||||
</terp>
|
|
@ -58,6 +58,35 @@ class report_timesheet_user(osv.osv):
|
|||
""")
|
||||
report_timesheet_user()
|
||||
|
||||
class report_timesheet_account(osv.osv):
|
||||
_name = "report_timesheet.account"
|
||||
_description = "Timesheet per account"
|
||||
_auto = False
|
||||
_columns = {
|
||||
'name': fields.date('Month', readonly=True),
|
||||
'user_id':fields.many2one('res.users', 'User', readonly=True, relate=True),
|
||||
'account_id':fields.many2one('account.analytic.account', 'User', readonly=True, relate=True),
|
||||
'quantity': fields.float('Quantity', readonly=True),
|
||||
}
|
||||
_order = 'name desc,user_id desc'
|
||||
def init(self, cr):
|
||||
cr.execute("""
|
||||
create or replace view report_timesheet_account as (
|
||||
select
|
||||
min(id) as id,
|
||||
substring(create_date for 7)||'-01' as name,
|
||||
user_id,
|
||||
account_id,
|
||||
sum(unit_amount) as quantity
|
||||
from
|
||||
account_analytic_line
|
||||
group by
|
||||
substring(create_date for 7), user_id, account_id
|
||||
)
|
||||
""")
|
||||
report_timesheet_account()
|
||||
|
||||
|
||||
class report_timesheet_invoice(osv.osv):
|
||||
_name = "report_timesheet.invoice"
|
||||
_description = "Costs to invoice"
|
||||
|
@ -96,4 +125,3 @@ class report_timesheet_invoice(osv.osv):
|
|||
)
|
||||
""")
|
||||
report_timesheet_invoice()
|
||||
|
||||
|
|
|
@ -47,10 +47,10 @@
|
|||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_timesheet_user_stat">
|
||||
<field name="name">report_timesheet.user.tree</field>
|
||||
<field name="name">report_timesheet.user.graph</field>
|
||||
<field name="res_model">report_timesheet.user</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,graph</field>
|
||||
<field name="view_mode">graph,tree</field>
|
||||
<field name="domain">[('name','>=',time.strftime('%Y-%m-01'))]</field>
|
||||
</record>
|
||||
<menuitem
|
||||
|
|
Loading…
Reference in New Issue