From 8f83656717dbf12197276fd8ce76701351e41746 Mon Sep 17 00:00:00 2001 From: "uco (OpenERP)" Date: Mon, 18 Jan 2010 18:24:12 +0530 Subject: [PATCH] [IMP]: *Added allowed task types field in project. *Removed 'All Attachments' wizard. *Added 'Next' and 'Previous' buttons on task for task type field. *Changed demo data for task type. bzr revid: uco@tinyerp.co.in-20100118125412-sbd1ujtwcir0qqxj --- addons/project/project.py | 48 ++++++++++++++++++----- addons/project/project_demo.xml | 32 +++++++++------- addons/project/project_view.xml | 19 +++++++-- addons/project/project_wizard.xml | 1 - addons/project/wizard/__init__.py | 1 - addons/project/wizard/task_attachment.py | 49 ------------------------ addons/project_gtd/project_gtd_demo.xml | 4 +- 7 files changed, 74 insertions(+), 80 deletions(-) delete mode 100644 addons/project/wizard/task_attachment.py diff --git a/addons/project/project.py b/addons/project/project.py index 8bd78c1c80f..f58ac88e284 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -28,6 +28,21 @@ from tools.translate import _ from osv import fields, osv from tools.translate import _ +class project_task_type(osv.osv): + _name = 'project.task.type' + _description = 'Project task type' + _columns = { + 'name': fields.char('Type', required=True, size=64, translate=True), + 'description': fields.text('Description'), + 'sequence': fields.integer('Sequence'), + } + _order = 'sequence' + + _defaults = { + 'sequence': lambda *args: 1 + } +project_task_type() + class project(osv.osv): _name = "project.project" _description = "Project" @@ -119,6 +134,7 @@ class project(osv.osv): help='The project can be in either if the states \'Template\' and \'Running\'.\n If it is template then we can make projects based on the template projects. If its in \'Running\' state it is a normal project.\ \n If it is to be reviewed then the state is \'Pending\'.\n When the project is completed the state is set to \'Done\'.'), 'company_id': fields.many2one('res.company', 'Company'), + 'allowed_task_type': fields.many2many('project.task.type', 'project_task_type_rel', 'project_id', 'type_id', 'Allowed Task Types'), } _defaults = { @@ -206,15 +222,6 @@ class project(osv.osv): return True project() -class project_task_type(osv.osv): - _name = 'project.task.type' - _description = 'Project task type' - _columns = { - 'name': fields.char('Type', required=True, size=64, translate=True), - 'description': fields.text('Description'), - } -project_task_type() - class task(osv.osv): _name = "project.task" _description = "Tasks" @@ -431,6 +438,29 @@ class task(osv.osv): self.write(cr, uid, ids, {'state': 'pending'}) return True + def next_type(self, cr, uid, ids, *args): + type_obj = self.pool.get('project.task.type') + type_ids = type_obj.search(cr,uid,[]) + for typ in self.browse(cr, uid, ids): + typeid = typ.type.id + if typeid and type_ids.index(typeid) != len(type_ids)-1 : + index = type_ids.index(typeid) + else: + index = -1 + self.write(cr, uid, typ.id, {'type': type_ids[index+1]}) + return True + + def prev_type(self, cr, uid, ids, *args): + type_obj = self.pool.get('project.task.type') + type_ids = type_obj.search(cr,uid,[]) + for typ in self.browse(cr, uid, ids): + typeid = typ.type.id + if typeid and type_ids.index(typeid) != 0 : + index = type_ids.index(typeid) + else: + index = len(type_ids) + self.write(cr, uid, typ.id, {'type': type_ids[index - 1]}) + return True task() diff --git a/addons/project/project_demo.xml b/addons/project/project_demo.xml index e762d3874ba..a6970365c90 100644 --- a/addons/project/project_demo.xml +++ b/addons/project/project_demo.xml @@ -9,17 +9,21 @@ - - Analysis + + 1 + Specification - - New Feature + + 2 + Development - - Quotation + + 3 + Testing - - Bug + + 4 + Merge @@ -53,7 +57,7 @@ 38.0 38.0 - + BoM, After sales returns, interventions. Tracability. @@ -62,7 +66,7 @@ 16.0 16.0 - + Data importation + Doc @@ -70,7 +74,7 @@ 16.0 16.0 - + Modifications asked by the customer. @@ -78,7 +82,7 @@ 16.0 16.0 - + 0 @@ -88,7 +92,7 @@ 15 8.0 8.0 - + Internal testing + Software Install @@ -98,7 +102,7 @@ 17 16.0 16.0 - + 2 open diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index c7cfee65d20..18989fbf6d0 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -84,7 +84,7 @@ - + @@ -99,6 +99,8 @@ + + @@ -351,7 +353,10 @@ - + +