diff --git a/addons/project/project.py b/addons/project/project.py
index 43db99d9e62..71db629bfbd 100644
--- a/addons/project/project.py
+++ b/addons/project/project.py
@@ -93,7 +93,7 @@ class project(osv.osv):
'name': fields.char("Project name", size=128, required=True),
'active': fields.boolean('Active'),
'category_id': fields.many2one('account.analytic.account','Analytic Account'),
- 'priority': fields.integer('Priority'),
+ 'priority': fields.integer('Sequence'),
'manager': fields.many2one('res.users', 'Project manager'),
'warn_manager': fields.boolean('Warn manager'),
'members': fields.many2many('res.users', 'project_user_rel', 'project_id', 'uid', 'Project members'),
@@ -167,6 +167,7 @@ project_task_type()
class task(osv.osv):
_name = "project.task"
_description = "Task"
+ _date_name = "date_deadline"
def _hours_effect(self, cr, uid, ids, name, args, context):
task_set = ','.join(map(str, ids))
cr.execute(("SELECT task_id, COALESCE(SUM(hours),0) FROM project_task_work WHERE task_id in (%s) GROUP BY task_id") % (task_set,))
@@ -181,8 +182,7 @@ class task(osv.osv):
'name': fields.char('Task summary', size=128, required=True),
'active': fields.boolean('Active'),
'description': fields.text('Description'),
- 'cust_desc': fields.text("Description for the customer"),
- 'priority' : fields.selection([('4','Very Low'), ('3','Low'), ('2','Medium'), ('1','Urgent'), ('0','Very urgent')], 'Priority'),
+ 'priority' : fields.selection([('4','Very Low'), ('3','Low'), ('2','Medium'), ('1','Urgent'), ('0','Very urgent')], 'Importance'),
'sequence': fields.integer('Sequence'),
'type': fields.many2one('project.task.type', 'Type'),
'state': fields.selection([('draft', 'Draft'),('open', 'Open'),('pending', 'Pending'), ('cancelled', 'Cancelled'), ('done', 'Done')], 'State'),
@@ -190,6 +190,8 @@ class task(osv.osv):
'date_deadline': fields.datetime('Deadline'),
'date_close': fields.datetime('Date Closed', readonly=True),
'project_id': fields.many2one('project.project', 'Project', ondelete='cascade'),
+ 'parent_id': fields.many2one('project.task', 'Parent Task'),
+ 'child_ids': fields.one2many('project.task', 'parent_id', 'Delegated Tasks'),
'notes': fields.text('Notes'),
'start_sequence': fields.boolean('Wait for previous sequences'),
'planned_hours': fields.float('Planned hours'),
@@ -229,6 +231,9 @@ class task(osv.osv):
'ref_doc2': 'project.project,%d'% (project.id,),
})
self.write(cr, uid, [task.id], {'state': 'done', 'date_close':time.strftime('%Y-%m-%d %H:%M:%S'), 'progress': 100})
+ if task.parent_id and task.parent_id.state in ('pending','draft'):
+ self.do_reopen(cr, uid, [task.parent_id.id])
+
if task.procurement_id:
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'mrp.procurement', task.procurement_id.id, 'subflow.done', cr)
diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml
index 932f7ec4595..6b25c71f387 100644
--- a/addons/project/project_view.xml
+++ b/addons/project/project_view.xml
@@ -77,11 +77,12 @@
-
+
+
@@ -93,12 +94,21 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -298,10 +308,11 @@
-
-
+
+
-
+
+
@@ -320,8 +331,17 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/project/project_wizard.xml b/addons/project/project_wizard.xml
index 088b6afef36..86114464c88 100644
--- a/addons/project/project_wizard.xml
+++ b/addons/project/project_wizard.xml
@@ -3,5 +3,6 @@
+
diff --git a/addons/project/wizard/__init__.py b/addons/project/wizard/__init__.py
index a382e0ebfa0..97391e3de6a 100644
--- a/addons/project/wizard/__init__.py
+++ b/addons/project/wizard/__init__.py
@@ -29,4 +29,5 @@
import billing
import close_task
+import task_delegate
diff --git a/addons/project/wizard/close_task.py b/addons/project/wizard/close_task.py
index 8795be0ec74..81ec9db5f08 100644
--- a/addons/project/wizard/close_task.py
+++ b/addons/project/wizard/close_task.py
@@ -79,15 +79,12 @@ class wizard_close(wizard.interface):
partner_id = task.partner_id or task.project_id.partner_id
if partner_id and partner_id.address[0].email:
email = partner_id.address[0].email
- return {'description': task.cust_desc or task.description, 'email':email}
+ return {'description': task.description, 'email':email}
def _data_send(self, cr, uid, data, context):
task_obj = pooler.get_pool(cr.dbname).get('project.task')
if data['form']['email']:
description = data['form'].get('description', False)
- if description:
- val = {'cust_desc': description}
- task_obj.write(cr, uid, [data['ids'][0]], val)
email_send(cr, uid, data['ids'], data['form']['email'], data['form']['description'])
return {}
diff --git a/addons/project/wizard/task_delegate.py b/addons/project/wizard/task_delegate.py
new file mode 100644
index 00000000000..2143e544cc6
--- /dev/null
+++ b/addons/project/wizard/task_delegate.py
@@ -0,0 +1,100 @@
+##############################################################################
+#
+# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
+#
+# 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 wizard
+from tools import email_send as email
+import pooler
+
+ask_form = """
+"""
+
+ask_fields = {
+ 'name': {'string': 'Title', 'type': 'char', 'required': 'True', 'size':64},
+ 'prefix': {'string': 'Prefix of Task', 'type': 'char', 'required': 'True', 'size':64},
+ 'user_id': {'string':'Assign To', 'type':'many2one', 'relation': 'res.users', 'required':'True'},
+ 'planned_hours': {'string':'Planned Hours', 'type':'float', 'widget':'float_time'},
+ 'planned_hours_me': {'string':'Hours to Validate', 'type':'float', 'widget':'float_time'},
+ 'state': {'string':'Validation State', 'type':'selection', 'selection': [('pending','Pending'),('done','Done')]},
+}
+
+class wizard_delegate(wizard.interface):
+ def _do_assign(self, cr, uid, data, context):
+ task_obj = pooler.get_pool(cr.dbname).get('project.task')
+ task = task_obj.browse(cr, uid, data['id'], context)
+ task_obj.copy(cr, uid, data['id'], {
+ 'name': data['form']['name'],
+ 'user_id': data['form']['user_id'],
+ 'planned_hours': data['form']['planned_hours'],
+ 'parent_id': data['id'],
+ 'state': 'open'
+ })
+ task_obj.write(cr, uid, data['id'], {
+ 'planned_hours': data['form']['planned_hours_me'],
+ 'name': (data['form']['prefix'] or '')+task.name
+ })
+ if data['form']['state']=='pending':
+ task_obj.do_pending(cr, uid, [data['id']])
+ else:
+ task_obj.do_close(cr, uid, [data['id']])
+ return {}
+
+ def _ask_auto_complete(self, cr, uid, data, context):
+ task_obj = pooler.get_pool(cr.dbname).get('project.task')
+ task = task_obj.browse(cr, uid, data['id'], context)
+ return {
+ 'name':task.name,
+ 'user_id': False,
+ 'planned_hours': task.planned_hours,
+ 'planned_hours_me': task.planned_hours / 5.0,
+ 'prefix': 'VALIDATION: ',
+ 'state': 'pending'
+ }
+
+ states = {
+ 'init': {
+ 'actions': [_ask_auto_complete],
+ 'result': {'type':'form', 'arch':ask_form, 'fields':ask_fields, 'state':[
+ ('end', 'Cancel'),
+ ('valid', 'Validate')
+ ]},
+ },
+ 'valid': {
+ 'actions': [_do_assign],
+ 'result': {'type':'state', 'state':'end'},
+ }
+ }
+wizard_delegate('project.task.delegate')
+