[IMP] *improved translatability
* When delegating a task twice: * don't put twice 'CHECK: ' * remove check if already in title *When closing tasks, reopen parent only if all childs are done/cancelled bzr revid: qdp@tinyerp.com-20090316140732-isoyrsf3a6ac7qym
This commit is contained in:
@@ -24,6 +24,7 @@ from lxml import etree
|
||||
from mx import DateTime
|
||||
from mx.DateTime import now
|
||||
import time
|
||||
from tools.translate import _
|
||||
|
||||
from osv import fields, osv
|
||||
|
||||
@@ -335,7 +336,7 @@ class task(osv.osv):
|
||||
if project:
|
||||
if project.warn_manager and project.manager and (project.manager.id != uid):
|
||||
request.create(cr, uid, {
|
||||
'name': "Task '%s' closed" % task.name,
|
||||
'name': _("Task '%s' closed") % task.name,
|
||||
'state': 'waiting',
|
||||
'act_from': uid,
|
||||
'act_to': project.manager.id,
|
||||
@@ -345,7 +346,12 @@ class task(osv.osv):
|
||||
})
|
||||
self.write(cr, uid, [task.id], {'state': 'done', 'date_close':time.strftime('%Y-%m-%d %H:%M:%S'), 'remaining_hours': 0.0})
|
||||
if task.parent_id and task.parent_id.state in ('pending','draft'):
|
||||
self.do_reopen(cr, uid, [task.parent_id.id])
|
||||
reopen = True
|
||||
for child in task.parent_id.child_ids:
|
||||
if child.id != task.id and child.state not in ('done','cancelled'):
|
||||
reopen = False
|
||||
if reopen:
|
||||
self.do_reopen(cr, uid, [task.parent_id.id])
|
||||
return True
|
||||
|
||||
def do_reopen(self, cr, uid, ids, *args):
|
||||
@@ -355,7 +361,7 @@ class task(osv.osv):
|
||||
project = task.project_id
|
||||
if project and project.warn_manager and project.manager.id and (project.manager.id != uid):
|
||||
request.create(cr, uid, {
|
||||
'name': "Task '%s' set in progress" % task.name,
|
||||
'name': _("Task '%s' set in progress") % task.name,
|
||||
'state': 'waiting',
|
||||
'act_from': uid,
|
||||
'act_to': project.manager.id,
|
||||
@@ -374,7 +380,7 @@ class task(osv.osv):
|
||||
project = task.project_id
|
||||
if project.warn_manager and project.manager and (project.manager.id != uid):
|
||||
request.create(cr, uid, {
|
||||
'name': "Task '%s' cancelled" % task.name,
|
||||
'name': _("Task '%s' cancelled") % task.name,
|
||||
'state': 'waiting',
|
||||
'act_from': uid,
|
||||
'act_to': project.manager.id,
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
import wizard
|
||||
from tools import email_send as email
|
||||
import pooler
|
||||
from tools.translate import _
|
||||
|
||||
ask_form = """<?xml version="1.0" ?>
|
||||
<form string="Delegate this task to a user">
|
||||
@@ -51,7 +52,6 @@ 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)
|
||||
newname = task.name
|
||||
newname = data['form']['prefix'] or ''
|
||||
task_obj.copy(cr, uid, data['id'], {
|
||||
'name': data['form']['name'],
|
||||
@@ -77,12 +77,16 @@ class wizard_delegate(wizard.interface):
|
||||
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)
|
||||
if task.name.startswith(_('CHECK: ')):
|
||||
newname = task.name.strip(_('CHECK: '))
|
||||
else:
|
||||
newname = task.name
|
||||
return {
|
||||
'name':task.name,
|
||||
'name': newname,
|
||||
'user_id': False,
|
||||
'planned_hours': task.remaining_hours,
|
||||
'planned_hours_me': 1.0,
|
||||
'prefix': 'CHECK: '+ (task.name or ''),
|
||||
'prefix': _('CHECK: ')+ (task.name or ''),
|
||||
'include_info': 1,
|
||||
'state': 'pending'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user