diff options
Diffstat (limited to 'addons/project/wizard/task_delegate.py')
| -rw-r--r-- | addons/project/wizard/task_delegate.py | 63 |
1 files changed, 28 insertions, 35 deletions
diff --git a/addons/project/wizard/task_delegate.py b/addons/project/wizard/task_delegate.py index a6c2ed3649f..07fa278a460 100644 --- a/addons/project/wizard/task_delegate.py +++ b/addons/project/wizard/task_delegate.py @@ -1,30 +1,22 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved. +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved +# $Id$ # -# $Id$ +# 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 3 of the License, or +# (at your option) any later version. # -# 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 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. # -# 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. +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## @@ -46,13 +38,13 @@ ask_form = """<?xml version="1.0" ?> </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'}, - 'include_info': {'string':'Copy Description', 'type':'boolean'}, - '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')]}, + 'name': {'string': 'Delegated Title', 'type': 'char', 'required': 'True', 'size':64, 'help':"New title of the task delegated to the user."}, + 'prefix': {'string': 'Your Task Title', 'type': 'char', 'required': 'True', 'size':64, 'help':"New title of your own task to validate the work done."}, + 'user_id': {'string':'Assign To', 'type':'many2one', 'relation': 'res.users', 'required':'True', 'help':"User you want to delegate this task to."}, + 'include_info': {'string':'Copy Description', 'type':'boolean', 'help':"Reinclude the description of the task in the task of the user."}, + 'planned_hours': {'string':'Planned Hours', 'type':'float', 'widget':'float_time', 'help':"Estimated time to close this task by the delegated user."}, + 'planned_hours_me': {'string':'Hours to Validate', 'type':'float', 'widget':'float_time', 'help':"Estimated time for you to validate the work done by the user to whom you delegate this task."}, + 'state': {'string':'Validation State', 'type':'selection', 'selection': [('pending','Pending'),('done','Done')], 'help':"New state of your own task. Pending will be reopened automatically when the delegated task is closed.", 'required':True}, } class wizard_delegate(wizard.interface): @@ -60,19 +52,20 @@ class wizard_delegate(wizard.interface): task_obj = pooler.get_pool(cr.dbname).get('project.task') task = task_obj.browse(cr, uid, data['id'], context) newname = task.name - if not task.name.startswith(data['form']['prefix'] or '++'): - newname = (data['form']['prefix'] or '')+task.name + newname = data['form']['prefix'] or '' task_obj.copy(cr, uid, data['id'], { 'name': data['form']['name'], 'user_id': data['form']['user_id'], 'planned_hours': data['form']['planned_hours'], + 'remaining_hours': data['form']['planned_hours'], 'parent_id': data['id'], 'state': 'open', 'description': data['form']['include_info'] and task.description or '', - 'child_ids': [] + 'child_ids': [], + 'work_ids': [] }) task_obj.write(cr, uid, data['id'], { - 'planned_hours': data['form']['planned_hours_me'], + 'remaining_hours': data['form']['planned_hours_me'], 'name': newname }) if data['form']['state']=='pending': @@ -87,9 +80,9 @@ class wizard_delegate(wizard.interface): return { 'name':task.name, 'user_id': False, - 'planned_hours': task.planned_hours, - 'planned_hours_me': task.planned_hours / 5.0, - 'prefix': 'CHECK: ', + 'planned_hours': task.remaining_hours, + 'planned_hours_me': 1.0, + 'prefix': 'CHECK: '+ (task.name or ''), 'state': 'pending' } |
