[MERGE] merge the work of pap related to project management

bzr revid: qdp-launchpad@tinyerp.com-20100713190256-lxd8uq0s2b30o94y
This commit is contained in:
qdp-launchpad@tinyerp.com
2010-07-14 00:32:56 +05:30
15 changed files with 94 additions and 163 deletions
+2 -1
View File
@@ -56,7 +56,8 @@ work done on tasks, eso. It is able to render planning, order tasks, eso.
'board_project_demo.xml',
],
'test':[
'test/test_project.yml'
'test/test_project.yml',
'test/test_project_delegation.yml',
],
'installable': True,
'active': False,
+43 -3
View File
@@ -170,6 +170,9 @@ class project(osv.osv):
return res
def set_done(self, cr, uid, ids, context=None):
task_obj = self.pool.get('project.task')
for task in self.read(cr, uid, ids, ['tasks'])[0]['tasks']:
task_obj.write(cr, uid, task, {'state': 'done', 'date_end':time.strftime('%Y-%m-%d %H:%M:%S'), 'remaining_hours': 0.0})
self.write(cr, uid, ids, {'state':'close'}, context=context)
for (id, name) in self.name_get(cr, uid, ids):
message = _('Project ') + " '" + name + "' "+ _("is Closed.")
@@ -198,16 +201,37 @@ class project(osv.osv):
def copy(self, cr, uid, id, default={}, context=None):
if context is None:
context = {}
task_obj = self.pool.get('project.task')
proj = self.browse(cr, uid, id, context=context)
default = default or {}
context['active_test'] = False
default['state'] = 'open'
if not default.get('name', False):
default['name'] = proj.name+_(' (copy)')
default['name'] = proj.name+_(' (copy)')
res = super(project, self).copy(cr, uid, id, default, context)
task_ids = task_obj.search(cr, uid, [('project_id','=', res), ('active','=',False)])
tasks = task_obj.browse(cr, uid, task_ids)
for task in tasks:
date_deadline = None
date_end = None
if task.date_start:
ds = date(*time.strptime(task.date_start,'%Y-%m-%d %H:%M:%S')[:3])
if task.date_deadline:
dd = date(*time.strptime(task.date_deadline,'%Y-%m-%d')[:3])
diff = dd-ds
date_deadline = (datetime.now()+diff).strftime('%Y-%m-%d %H:%M:%S')
if task.date_end:
de = date(*time.strptime(task.date_end,'%Y-%m-%d %H:%M:%S')[:3])
diff = de-ds
date_end = (datetime.now()+diff).strftime('%Y-%m-%d %H:%M:%S')
task_obj.write(cr, uid, task.id, {'active':True,
'date_start':time.strftime('%Y-%m-%d %H:%M:%S'),
'date_deadline':date_deadline,
'date_end':date_end})
ids = self.search(cr, uid, [('parent_id','child_of', [res])])
if ids:
cr.execute('update project_task set active=True where project_id IN %s',(tuple(ids),))
return res
def duplicate_template(self, cr, uid, ids, context=None):
@@ -322,6 +346,13 @@ class task(osv.osv):
if task['date_start'] > task['date_end']:
return False
return True
def _check_deadline_date(self, cr, uid, ids, context=None):
task = self.read(cr, uid, ids[0], ['date_start', 'date_deadline'])
if task['date_start'] and task['date_deadline']:
if task['date_deadline'] < task['date_start']:
return False
return True
_columns = {
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the task without removing it."),
@@ -597,6 +628,15 @@ class config_compute_remaining(osv.osv_memory):
_columns = {
'remaining_hours' : fields.float('Remaining Hours', digits=(16,2), help="Put here the remaining hours required to close the task."),
}
def _get_analytic_account(self, cr, uid, context={}):
if context.get('account_id', False):
return context.get('account_id')
return False
_defaults = {
'account_id' : _get_analytic_account,
}
_defaults = {
'remaining_hours': _get_remaining
+3 -7
View File
@@ -31,7 +31,7 @@
<record id="project_project_9" model="project.project">
<field name="warn_manager">1</field>
<field name="name">Open ERP Integration</field>
<field name="manager" ref="base.user_root"/>
<field name="user_id" ref="base.user_root"/>
<field eval="[(6, 0, [ref('project_tt_specification'),ref('project_tt_development'),ref('project_tt_testing'),ref('project_tt_merge')])]" name="type_ids"/>
</record>
<record id="project_project_21" model="project.project">
@@ -39,21 +39,20 @@
<field name="priority">10</field>
<field name="parent_id" ref="project_project_9"/>
<field name="name">Study + Prototype</field>
<field name="manager" ref="base.user_root"/>
<field name="user_id" ref="base.user_root"/>
<field eval="[(6, 0, [ref('project_tt_specification'),ref('project_tt_development')])]" name="type_ids"/>
</record>
<record id="project_project_22" model="project.project">
<field name="priority">20</field>
<field name="parent_id" ref="project_project_9"/>
<field name="name">Specific Developments</field>
<field name="manager" ref="base.user_root"/>
<field name="user_id" ref="base.user_root"/>
<field eval="[(6, 0, [ref('project_tt_specification'), ref('project_tt_development')])]" name="type_ids"/>
</record>
<record id="project_project_23" model="project.project">
<field name="priority">30</field>
<field name="parent_id" ref="project_project_9"/>
<field name="name">Install, data import, configuration</field>
<field name="manager" ref="base.user_root"/>
<field eval="[(6, 0, [ref('project_tt_development')])]" name="type_ids"/>
</record>
@@ -100,7 +99,6 @@
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
<field name="project_id" ref="project_project_21"/>
<field name="name">Internal testing + Software Install</field>
<field name="date_deadline">2008-06-06</field>
</record>
<record id="project_task_188" model="project.task">
<field name="sequence">17</field>
@@ -214,7 +212,6 @@
<field name="project_id" ref="project_project_23"/>
<field name="state">open</field>
<field name="name">In house training</field>
<field name="date_deadline">2007-06-06</field>
</record>
<record id="project_task_202" model="project.task">
<field name="sequence">50</field>
@@ -257,7 +254,6 @@
<field name="name">Latest in house tests</field>
</record>
<record id="project_message_1" model="project.message">
<field name="date">2010-05-27</field>
<field name="project_id" ref="project.project_project_23"/>
<field name="user_id" ref="base.user_root"/>
<field name="description">Follow the procedure of Configuration wizard.
+23 -16
View File
@@ -45,7 +45,7 @@
</group>
<newline/>
<group col="9" colspan="8">
<field name="state" select="1"/>
<field name="state" select="1" readonly="1"/>
<button name="set_template" string="Set as Template" type="object" states="open" icon="gtk-convert"/>
<button name="set_open" string="Reactivate Project" type="object" states="pending,cancelled,done" icon="gtk-ok"/>
<button name="set_pending" string="Pending" type="object" states="open" icon="gtk-media-pause"/>
@@ -117,7 +117,6 @@
<field name="arch" type="xml">
<search string="Search Project">
<group col='15' colspan='4'>
<filter icon="terp-document-new" string="Draft" domain="[('state', 'in',('draft',))]" help="Draft Projects" default="1"/>
<filter icon="terp-check" string="Current" name="Current" domain="[('state', 'in',('open','pending'))]" help="Open and Pending Projects" default="1"/>
<separator orientation="vertical"/>
<filter icon="terp-personal" string="Manager" name="Manager" domain="[('user_id', '=', uid)]" help="Projects in which I am a manager."/>
@@ -322,11 +321,10 @@
<field name="partner_id"/>
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
<group col="4" colspan="2">
<field name="type" widget="selection" />
<field name="type" widget="selection" readonly="1"/>
<button name="prev_type" string="Previous" type="object" icon="gtk-go-back" help="Change to Previous Stage"/>
<button name="next_type" string="Next" type="object" icon="gtk-go-forward" help="Change to Next Stage"/>
</group>
<field name="active"/>
<separator colspan="4" string="Notes"/>
<field colspan="4" name="notes" nolabel="1"/>
</page>
@@ -342,18 +340,13 @@
<field eval="2" name="priority"/>
<field name="arch" type="xml">
<tree colors="grey:state in ('cancelled','done');blue:remaining_hours&lt;0 and state in ('pending');red:bool(date_deadline) and (date_deadline&lt;current_date) and (state in ('draft','open'));black:state not in ('cancelled','done')" string="Tasks">
<field name="sequence" />
<field name="sequence" invisible="not context.get('seq_visible', False)"/>
<field name="name"/>
<field name="project_id" icon="gtk-indent" domain="['|',('user_id','=',uid),('members','=',uid)]"/>
<field name="user_id"/>
<field name="delegated_user_id" invisible="context.get('show_delegated', True)"/>
<field name="planned_hours" widget="float_time" />
<field name="total_hours" widget="float_time"/>
<field name="remaining_hours" widget="float_time" sum="Remaining Hours" invisible="context.get('set_visible',False)"/>
<field name="date_deadline" invisible="context.get('set_visible',False)"/>
<field name="type" groups="base.group_extended" invisible="context.get('set_visible',False)"/>
<field name="date_start" invisible="1"/>
<field name="date_end" invisible="1"/>
<button name="next_type" invisible="context.get('set_visible',False)"
states="draft,open,pending"
string="Change Stage"
@@ -361,6 +354,9 @@
icon="gtk-go-forward"
groups="base.group_extended"
help="Change Type"/>
<field name="type" groups="base.group_extended" invisible="context.get('set_visible',False)"/>
<field name="date_start" invisible="1"/>
<field name="date_end" invisible="1"/>
<field name="progress" widget="progressbar" invisible="context.get('set_visible',False)"/>
<field name="state" invisible="context.get('set_visible',False)"/>
<button name="do_open" states="pending,draft,done,cancel" string="Start Task" type="object" icon="gtk-execute" help="For changing to open state" invisible="context.get('set_visible',False)"/>
@@ -418,18 +414,27 @@
<field name="arch" type="xml">
<search string="Task Edition">
<group col="20" colspan="4">
<filter string="Current" domain="[('state','in',('open','draft'))]" help="Draft, Open and Pending Tasks" icon="terp-check" default="1"/>
<filter string="Current" domain="[('state','in',('open','draft'))]" name="current" help="Draft, Open and Pending Tasks" icon="terp-check" default="1"/>
<filter string="In Progress" domain="[('state','=','open')]" help="Open Tasks" icon="terp-camera_test"/>
<filter string="Pending" domain="[('state','=','pending')]" context="{'show_delegated':False}" help="Pending Tasks" icon="terp-gtk-media-pause"/>
<filter name="edit"
string="Edit" context="{'set_editable':'True','seq_visible': True}"
icon="gtk-execute"
groups="base.group_extended"/>
<separator orientation="vertical"/>
<filter string="Deadlines" domain="[('date_deadline','&lt;&gt;',False)]" help="Show only tasks having a deadline" icon="terp-gnome-cpu-frequency-applet+"/>
<filter name="template" domain="[('active', '=', False)]"
string="Template"
icon="terp-project"
groups="base.group_extended"
help="Change Type"/>
<separator orientation="vertical"/>
<field name="name" select="1"/>
<field name="project_id" select="1">
<filter domain="[('project_id.user_id','=',uid)]" help="My Projects" icon="terp-folder-blue"/>
</field>
<field name="user_id" select="1">
<filter domain="[('user_id','=',False)]" help="Unassigned Tasks" icon="gtk-execute" separator="1"/>
<filter domain="[('user_id','=',False)]" help="Unassigned Tasks" icon="gtk-execute" separator="1"/>
</field>
</group>
<newline/>
@@ -454,7 +459,7 @@
<field name="view_mode">tree,form,calendar,gantt,graph</field>
<field eval="False" name="filter"/>
<field name="view_id" ref="view_task_tree2"/>
<field name="context">{"search_default_project_id":project_id,'search_default_user_id':uid, 'search_default_current': 1}</field>
<field name="context">{"search_default_project_id":project_id, "search_default_user_id":uid, 'search_default_current': 1}</field>
<field name="search_view_id" ref="view_task_search_form"/>
</record>
@@ -497,7 +502,8 @@
<form string="Task Stage">
<field name="name" select="1"/>
<field name="sequence"/>
<field colspan="4" name="description"/>
<separator string="Description" colspan="4"/>
<field colspan="4" name="description" nolabel="1"/>
</form>
</field>
</record>
@@ -515,7 +521,7 @@
</record>
<record id="open_task_type_form" model="ir.actions.act_window">
<field name="name">Types</field>
<field name="name">Task Stages</field>
<field name="res_model">project.task.type</field>
<field name="view_type">form</field>
<field name="view_id" ref="task_type_tree"/>
@@ -528,6 +534,7 @@
<act_window
domain="[('project_id', '=', active_id)]"
context="{'set_default_template':1}"
id="act_project_project_2_project_task_all"
name="Tasks"
res_model="project.task"
@@ -652,4 +659,4 @@
<act_window domain="[('project_id', '=', active_id)]" id="act_project_messages" name="Messages" res_model="project.message" src_model="project.project"/>
</data>
</openerp>
</openerp>
@@ -98,6 +98,8 @@ class project_close_task(osv.osv_memory):
body = u'%s\n%s\n%s\n\n-- \n%s' % (header, description, footer, signature)
email(from_adr, [to_adr], subject, body.encode('utf-8'), email_bcc=[from_adr])
task_obj.write(cr, uid, [task.id], {'state': 'done', 'date_end':time.strftime('%Y-%m-%d %H:%M:%S'), 'remaining_hours': 0.0})
message = _('Task ') + " '" + task.name + "' "+ _("is Done.")
self.log(cr, uid, task.id, message)
else:
raise osv.except_osv(_('Error'), _("Please specify the email address of partner."))
return {}
-2
View File
@@ -43,10 +43,8 @@ performing those tasks.
'update_xml': [
'project_gtd_data.xml',
'project_gtd_view.xml',
'project_gtd_wizard.xml',
'security/ir.model.access.csv',
'wizard/project_gtd_empty_view.xml',
'wizard/project_gtd_daily_view.xml',
'wizard/project_gtd_fill_view.xml',
],
'demo_xml': ['project_gtd_demo.xml'],
+2 -2
View File
@@ -80,8 +80,8 @@
<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('set_visible',True)"/>
<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('set_visible',True)"/>
<field string="Timebox" name="timebox_id" groups="project_gtd.group_project_getting" invisible=" not context.get('set_visible',True)"/>
<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('set_visible',False)"/>
<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>
@@ -96,7 +96,7 @@
<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" select="1" groups="project_gtd.group_project_getting"/>
<field name="timebox_id" widget="selection" select="1" groups="project_gtd.group_project_getting"/>
</field>
</field>
</record>
-27
View File
@@ -1,27 +0,0 @@
<?xml version="1.0" ?>
<openerp>
<data>
<!--<wizard string="My Daily Timebox"
model="project.gtd.timebox"
name="project.gtd.timebox.daily"
id="open_gtd_timebox_daily"/>-->
<!-- <menuitem name="My Daily Timebox" id="menu_open_time_daily_inbox" -->
<!-- parent="menu_open_time" action="open_gtd_timebox_daily"-->
<!-- icon="STOCK_JUSTIFY_FILL" type="wizard"/>-->
<!-- <wizard string="Plannify Timebox"
model="project.gtd.timebox"
name="project.gtd.timebox.fill"
id="open_gtd_timebox_fill"/>
-->
<!--<wizard string="Empty Timebox"
model="project.gtd.timebox"
name="project.gtd.timebox.empty"
id="open_gtd_timebox_empty"/>
-->
</data>
</openerp>
+1 -1
View File
@@ -19,8 +19,8 @@
#
##############################################################################
import project_gtd_daily
import project_gtd_empty
import project_gtd_fill
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -1,51 +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 osv import osv, fields
from tools.translate import _
class project_timebox_open(osv.osv_memory):
_name = 'project.timebox.open'
_description = 'Project Timebox Open'
def open_tb(self, cr, uid, data, context=None):
ids = self.pool.get('project.gtd.timebox').search(cr, uid, [])
if not len(ids):
raise osv.except_osv(_('Error !'), _('No timebox of the type defined !'))
if len(ids) >= 1:
domain = "[('id','in',["+','.join(map(str, ids))+"])]"
value = {
'domain': domain,
'name': 'My Daily Timebox',
'view_type': 'form',
'view_mode': 'form,tree',
'res_model': 'project.gtd.timebox',
'view_id': False,
'type': 'ir.actions.act_window'
}
if len(ids) == 1:
value['res_id'] = ids[0]
value['context'] = {'record_id':ids[0]}
return value
project_timebox_open()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -1,46 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_project_gtd_daily" model="ir.ui.view">
<field name="name">My Daily Timebox</field>
<field name="model">project.timebox.open</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="My Daily Timebox">
<group width="340" height="70">
<label string="You can open Daily Timebox"/>
<newline/>
<group>
<button icon="gtk-cancel" special="cancel" string="_Cancel"/>
<button name="open_tb" icon="gtk-ok" string="_Open Timebox" type="object" default_focus="1"/>
</group>
</group>
</form>
</field>
</record>
<record id="action_project_gtd_daily" model="ir.actions.act_window">
<field name="name">My Daily Timebox</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">project.timebox.open</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_project_gtd_daily"/>
<field name="context">{'record_id' : active_id}</field>
<field name="target">new</field>
</record>
<record model="ir.values" id="project_gtd_daily_values">
<field name="model_id" ref="model_project_gtd_timebox" />
<field name="object" eval="1" />
<field name="name">My Daily Timebox</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_project_gtd_daily'))" />
<field name="key">action</field>
<field name="model">project.gtd.timebox</field>
</record>
</data>
</openerp>
@@ -8,8 +8,8 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Plannify Timebox">
<field name="timebox_id" />
<field name="timebox_to_id" />
<field name="timebox_id" widget="selection"/>
<field name="timebox_to_id" widget="selection"/>
<field colspan="4" name="task_ids" nolabel="1" domain="[('timebox_id','=',timebox_id),('state','=','open')]" />
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="_Cancel"/>
+2
View File
@@ -297,6 +297,8 @@ class project_issue(osv.osv, crm.crm_case):
cases = self.browse(cr, uid, ids)
for case in cases:
data = {}
if case.task_id:
raise osv.except_osv(_('Warning !'), _('You cannot escalate this issue.\nThere is a task attached to it!'))
if case.project_id.project_escalation_id:
data['project_id'] = case.project_id.project_escalation_id.id
if case.project_id.project_escalation_id.user_id:
@@ -48,6 +48,15 @@ class hr_analytic_issue(osv.osv):
_columns = {
'issue_id' : fields.many2one('project.issue', 'Issue'),
}
def _get_analytic_account(self, cr, uid, context={}):
if context.get('account_id', False):
return context.get('account_id')
return False
_defaults = {
'account_id' : _get_analytic_account,
}
hr_analytic_issue()
@@ -10,13 +10,13 @@
<notebook colspan="4">
<page string="Worklogs">
<field name="analytic_account_id" invisible="1"/>
<field name="timesheet_ids" colspan="4" nolabel="1" context="{'default_user_id' : user_id, 'default_account_id' : analytic_account_id}">
<field name="timesheet_ids" colspan="4" nolabel="1" default_get="{'account_id':project_id}" context="{'default_user_id' : user_id, 'default_account_id' : analytic_account_id}">
<tree editable="top" string="Timesheet">
<field name="date"/>
<field name="name"/>
<field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)" widget="float_time"/>
<field name="account_id" invisible="0" domain="[('partner_id', '=', parent.partner_id)]" on_change="on_change_account_id(account_id)"/>
<field name="user_id"/>
<field name="account_id" invisible="0" domain="[('partner_id', '=', parent.partner_id)]" on_change="on_change_account_id(account_id)"/>
<field name="name"/>
<field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)" widget="float_time"/>
<field name="date"/>
<field invisible="1" name="journal_id"/>
<field invisible="1" name="product_id"/>
<field invisible="1" name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)"/>