[IMP] Project TODO, CRM TODO

bzr revid: fp@tinyerp.com-20111107221337-if1e6us8r95jdfel
This commit is contained in:
Fabien Pinckaers 2011-11-07 23:13:37 +01:00
commit 9fd3158961
11 changed files with 257 additions and 78 deletions

View File

@ -0,0 +1,22 @@
# -*- 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 crm_todo

View File

@ -0,0 +1,38 @@
# -*- 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/>.
#
##############################################################################
{
'name': 'To Do List for CRM',
'version': '1.0',
'category': 'Sales',
'description': """
Todo list for CRM leads and opportunities.
""",
'author': 'OpenERP SA',
'depends': ['crm','project_gtd'],
'update_xml': [
'crm_todo_view.xml',
],
'demo': [
'crm_todo_demo.xml',
],
}

View File

@ -0,0 +1,37 @@
# -*- 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 osv import fields, osv
class project_task(osv.osv):
_inherit = 'project.task'
_columns = {
'lead_id': fields.many2one('crm.lead', 'Lead / Opportunity')
}
class crm_todo(osv.osv):
_inherit = 'crm.lead'
_columns = {
'task_ids': fields.one2many('project.task', 'lead_id', 'Tasks'),
}

View File

@ -0,0 +1,16 @@
<?xml version="1.0" ?>
<openerp>
<data>
<record id="project.project_task_188" model="project.task">
<field name="lead_id" ref="crm.crm_case_fabiendupont"/>
</record>
<record id="project.project_task_186" model="project.task">
<field name="lead_id" ref="crm.crm_case_fabiendupont"/>
</record>
<record id="project.project_task_184" model="project.task">
<field name="lead_id" ref="crm.crm_case_dirtminingltdunits25"/>
</record>
</data>
</openerp>

View File

@ -0,0 +1,62 @@
<?xml version="1.0" ?>
<openerp>
<data>
<record id="crm_todo_opportunity_add" model="ir.ui.view">
<field name="name">Opportunities - Tasks</field>
<field name="model">crm.lead</field>
<field name="type">form</field>
<field name="inherit_id" ref="crm.crm_case_form_view_oppor" />
<field name="arch" type="xml">
<data>
<page string="Extra Info" position="before">
<page string="Tasks">
<field name="task_ids" colspan="4" nolabel="1">
<tree editable="bottom" string="Tasks">
<field name="name"/>
<field name="user_id"/>
<field string="Timebox" name="timebox_id"/>
<button name="prev_timebox" type="object" icon="gtk-go-back" string="Previous" states="draft,pending,open"/>
<button name="next_timebox" type="object" icon="gtk-go-forward" string="Next" states="draft,pending,open"/>
<field name="state"/>
<button name="do_cancel" states="draft,open,pending" string="Cancel" type="object" icon="gtk-cancel" help="For cancelling the task"/>
<button name="action_close" states="draft,pending,open" string="Done" type="object" icon="terp-dialog-close" help="For changing to done state"/>
</tree>
</field>
</page>
</page>
</data>
</field>
</record>
<record model="ir.ui.view" id="project_task_crm_tree">
<field name="name">project.task.tree.crm</field>
<field name="model">project.task</field>
<field name="type">tree</field>
<field name="priority">20</field>
<field name="inherit_id" ref="project.view_task_tree2" />
<field name="arch" type="xml">
<field name="remaining_hours" position="after">
<field name="lead_id" invisible="not context.get('lead_id', False)"/>
</field>
</field>
</record>
<record model="ir.actions.act_window" id="crm_todo_action">
<field name="name">Todo List</field>
<field name="res_model">project.task</field>
<field name="context">{'set_editable':True,'set_visible':True,'gtd':True,'user_invisible':True, 'search_default_user_id':uid, "search_default_current": 1, "search_default_open": 1, "lead_id": 1}</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar,gantt,graph,kanban</field>
</record>
<menuitem name="Tasks"
id="menu_crm_todo"
parent="base.menu_sales"
action="crm_todo_action"/>
</data>
</openerp>

View File

@ -398,9 +398,9 @@
<field name="user_id" invisible="context.get('user_invisible', False)"/>
<field name="delegated_user_id" invisible="context.get('show_delegated', True)"/>
<field name="total_hours" invisible="1"/>
<field name="planned_hours"/>
<field name="planned_hours" invisible="context.get('set_visible',False)"/>
<field name="effective_hours" widget="float_time" sum="Spent Hours" invisible="1"/>
<field name="remaining_hours" widget="float_time" sum="Remaining Hours" on_change="onchange_remaining(remaining_hours,planned_hours)"/>
<field name="remaining_hours" widget="float_time" sum="Remaining Hours" on_change="onchange_remaining(remaining_hours,planned_hours)" invisible="context.get('set_visible',False)"/>
<field name="date_deadline" invisible="context.get('deadline_visible',True)"/>
<field name="type_id" groups="base.group_extended" invisible="context.get('set_visible',False)"/>
<button name="next_type" invisible="context.get('set_visible',False)"
@ -485,6 +485,7 @@
<filter domain="[('project_id.user_id','=',uid)]" help="My Projects" icon="terp-personal"/>
</field>
<field name="user_id">
<filter domain="[('user_id','=',uid)]" help="My Tasks" icon="terp-personal" />
<filter domain="[('user_id','=',False)]" help="Unassigned Tasks" icon="terp-personal-" />
</field>
</group>
@ -513,7 +514,7 @@
<field name="view_mode">tree,form,calendar,gantt,graph,kanban</field>
<field eval="False" name="filter"/>
<field name="view_id" ref="view_task_tree2"/>
<field name="context">{"search_default_user_id":uid, "search_default_draft": 1, "search_default_open":1 }</field>
<field name="context">{"search_default_draft": 1, "search_default_open":1 }</field>
<field name="search_view_id" ref="view_task_search_form"/>
<field name="help">A task represents a work that has to be done. Each user works in his own list of tasks where he can record his task work in hours. He can work and close the task itself or delegate it to another user. If you delegate a task to another user, you get a new task in pending state, which will be reopened when you have to review the work achieved. If you install the project_timesheet module, task work can be invoiced based on the project configuration. With the project_mrp module, sales orders can create tasks automatically when they are confirmed.</field>
</record>

View File

@ -104,25 +104,22 @@ class project_task(osv.osv):
res = super(project_task,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu)
search_extended = False
timebox_obj = self.pool.get('project.gtd.timebox')
access_pool = self.pool.get('ir.model.access')
if (res['type'] == 'search') and access_pool.check_groups(cr, uid, "project_gtd.group_project_getting"):
if (res['type'] == 'search') and context.get('gtd', False):
tt = timebox_obj.browse(cr, uid, timebox_obj.search(cr,uid,[]), context=context)
search_extended ='''<newline/><group col="%d" expand="%d" string="%s">''' % (len(tt)+7,1,_('Getting Things Done'))
search_extended += '''<filter domain="[('timebox_id','=', False)]" context="{'set_editable':True,'set_visible':True,'gtd_visible':True,'user_invisible':True}" icon="gtk-new" help="Undefined Timebox" string="%s"/>''' % (_('Inbox'),)
search_extended += '''<filter context="{'set_editable':True,'set_visible':True,'gtd_visible':True,'user_invisible':True}" icon="gtk-new" help="Getting things done" string="%s"/>''' % (_('GTD'),)
search_extended ='''<newline/>'''
search_extended += '''<filter domain="[('timebox_id','=', False)]" context="{'set_editable':True,'set_visible':True,'user_invisible':True}" icon="gtk-new" help="Undefined Timebox" string="%s"/>''' % (_('Inbox'),)
search_extended += '''<separator orientation="vertical"/>'''
for time in tt:
if time.icon:
icon = time.icon
else :
icon=""
search_extended += '''<filter domain="[('timebox_id','=', ''' + str(time.id) + ''')]" icon="''' + icon + '''" string="''' + time.name + '''" context="{'gtd_visible':True, 'user_invisible': True}"/>'''
search_extended += '''<filter domain="[('timebox_id','=', ''' + str(time.id) + ''')]" icon="''' + icon + '''" string="''' + time.name + '''" context="{'user_invisible': True}"/>'''
search_extended += '''
<separator orientation="vertical"/>
<field name="context_id" select="1" widget="selection"/>
</group>
</search> '''
if search_extended:
</search>'''
res['arch'] = unicode(res['arch'], 'utf8').replace('</search>', search_extended)
attrs_sel = self.pool.get('project.gtd.context').name_search(cr, uid, '', [], context=context)
context_id_info = self.pool.get('project.task').fields_get(cr, uid, ['context_id'], context=context)

View File

@ -1,8 +1,5 @@
<?xml version="1.0" ?>
<openerp>
<data>
<record model="res.groups" id="group_project_getting">
<field name="name">Project / Methodology / Getting Things Done</field>
</record>
</data>
</openerp>

View File

@ -31,7 +31,7 @@
<field name="help">Contexts are defined in the "Getting Things Done" methodology. It allows you to categorize your tasks according to the context in which they have to be done: at the office, at home, when I take my car, etc.</field>
</record>
<menuitem name="Contexts" id="menu_open_gtd_time_contexts" groups="group_project_getting"
<menuitem name="Contexts" id="menu_open_gtd_time_contexts"
parent="project.menu_tasks_config" action="open_gtd_context_tree"/>
<record model="ir.ui.view" id="view_gtd_timebox_tree">
@ -79,10 +79,10 @@
<field name="inherit_id" ref="project.view_task_tree2" />
<field name="arch" type="xml">
<field name="remaining_hours" position="after">
<field string="Timebox" name="timebox_id" groups="project_gtd.group_project_getting" invisible=" not context.get('gtd_visible', False)"/>
<button name="prev_timebox" type="object" icon="gtk-go-back" string="Previous" states="draft,pending,open" groups="project_gtd.group_project_getting" invisible=" not context.get('gtd_visible',False)"/>
<button name="next_timebox" type="object" icon="gtk-go-forward" string="Next" states="draft,pending,open" groups="project_gtd.group_project_getting" invisible=" not context.get('gtd_visible',False)"/>
<field name="context_id" groups="project_gtd.group_project_getting" invisible="not context.get('gtd_visible', False)" widget="selection"/>
<field string="Timebox" name="timebox_id" invisible=" not context.get('gtd', False)"/>
<button name="prev_timebox" type="object" icon="gtk-go-back" string="Previous" states="draft,pending,open" invisible=" not context.get('gtd',False)"/>
<button name="next_timebox" type="object" icon="gtk-go-forward" string="Next" states="draft,pending,open" invisible=" not context.get('gtd',False)"/>
<field name="context_id" invisible="not context.get('gtd', False)" widget="selection"/>
<button name="do_reopen" states="done,cancelled" string="Reactivate" type="object" icon="gtk-convert" help="For reopening the tasks" invisible="not context.get('set_visible',False)"/>
</field>
</field>
@ -95,11 +95,22 @@
<field name="inherit_id" ref="project.view_task_form2" />
<field name="arch" type="xml">
<field name="progress" position="after">
<field name="context_id" widget="selection" groups="project_gtd.group_project_getting"/>
<field name="timebox_id" widget="selection" select="1" groups="project_gtd.group_project_getting"/>
<field name="context_id" widget="selection"/>
<field name="timebox_id" widget="selection" select="1"/>
</field>
</field>
</record>
<record model="ir.actions.act_window" id="open_gtd_task">
<field name="name">Todo List</field>
<field name="res_model">project.task</field>
<field name="context">{'set_editable':True,'set_visible':True,'gtd':True,'user_invisible':True, 'search_default_user_id':uid, "search_default_draft": 1, "search_default_open": 1}</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar,gantt,graph,kanban</field>
</record>
<menuitem action="open_gtd_task" id="menu_open_gtd_timebox_tree" parent="project.menu_project_management" sequence="4"/>
</data>
</openerp>

View File

@ -1,6 +1,4 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_project_gtd_context","project.gtd.context","model_project_gtd_context","group_project_getting",1,1,1,1
"access_project_gtd_timebox","project.gtd.timebox","model_project_gtd_timebox","group_project_getting",1,1,1,1
"access_project_gtd_context_user","project.gtd.context project user","model_project_gtd_context","project.group_project_user",1,0,0,0
"access_project_gtd_timebox_user","project.gtd.timebox project user","model_project_gtd_timebox","project.group_project_user",1,0,0,0
"access_project_gtd_context_manager","project.gtd.context project manager","model_project_gtd_context","project.group_project_manager",1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
access_project_gtd_context project.gtd.context model_project_gtd_context group_project_getting 1 1 1 1
access_project_gtd_timebox project.gtd.timebox model_project_gtd_timebox group_project_getting 1 1 1 1
2 access_project_gtd_context_user project.gtd.context project user model_project_gtd_context project.group_project_user 1 0 0 0
3 access_project_gtd_timebox_user project.gtd.timebox project user model_project_gtd_timebox project.group_project_user 1 0 0 0
4 access_project_gtd_context_manager project.gtd.context project manager model_project_gtd_context project.group_project_manager 1 1 1 1