From 8fc7f3ddc371bbc919ac51ad4573f2f8b81e4bb9 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Thu, 21 Jan 2010 09:21:47 +0100 Subject: [PATCH] [IMP] better views project mgt bzr revid: fp@tinyerp.com-20100121082147-8rpf0qh611z78f94 --- addons/project/project.py | 4 +++- addons/project/project_view.xml | 9 +++++---- addons/project_gtd/project_gtd.py | 12 ++++++++---- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/addons/project/project.py b/addons/project/project.py index 815f69ecf3d..a104238ec05 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -493,7 +493,9 @@ class task(osv.osv): typeid = typ.type.id types = map(lambda x:x.id, typ.project_id.type_ids) if types: - if typeid and typeid in types and types.index(typeid) != len(types)-1 : + if not typeid: + self.write(cr, uid, typ.id, {'type': types[0]}) + elif typeid and typeid in types and types.index(typeid) != len(types)-1 : index = types.index(typeid) self.write(cr, uid, typ.id, {'type': types[index+1]}) return True diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index cee6d9ac2e2..888efaadae8 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -471,10 +471,6 @@ - - - - @@ -488,6 +484,11 @@ + + + + + diff --git a/addons/project_gtd/project_gtd.py b/addons/project_gtd/project_gtd.py index a6df9823cf1..076b3ae4b9e 100644 --- a/addons/project_gtd/project_gtd.py +++ b/addons/project_gtd/project_gtd.py @@ -29,6 +29,7 @@ import tools import netsvc from osv import fields, osv import ir +from tools.translate import _ class project_gtd_context(osv.osv): _name = "project.gtd.context" @@ -148,9 +149,12 @@ class project_task(osv.osv): timebox_ids = timebox_obj.search(cr,uid,[]) for task in self.browse(cr,uid,ids): timebox = task.timebox_id.id - if timebox and timebox_ids.index(timebox) != 0 : - index = timebox_ids.index(timebox) - self.write(cr, uid, task.id, {'timebox_id': timebox_ids[index - 1]}) + if timebox: + if timebox_ids.index(timebox): + index = timebox_ids.index(timebox) + self.write(cr, uid, task.id, {'timebox_id': timebox_ids[index - 1]}) + else: + self.write(cr, uid, task.id, {'timebox_id': False}) return True def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): @@ -159,7 +163,7 @@ class project_task(osv.osv): timebox_obj = self.pool.get('project.gtd.timebox') if res['type'] == 'search': tt = timebox_obj.browse(cr, uid, timebox_obj.search(cr,uid,[])) - search_extended ='''''' % (len(tt)+6,) + search_extended ='''''' % (len(tt)+6,_('Getting Things Done')) search_extended += '''''' search_extended += '''''' for time in tt: