diff --git a/addons/project/project.py b/addons/project/project.py index 111c2d22267..27bbb2f8c7f 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -686,7 +686,7 @@ class task(osv.osv): def prev_type(self, cr, uid, ids, *args): for task in self.browse(cr, uid, ids): typeid = task.type_id.id - types = map(lambda x:x.id, task.project_id.type_ids) + types = map(lambda x:x.id, task.project_id and task.project_id.type_ids or []) if types: if typeid and typeid in types: index = types.index(typeid) diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index b0332a7ca27..5e5be5ee4b0 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -484,7 +484,7 @@ - Task Stages + Stages project.task.type form diff --git a/addons/project_issue/board_project_issue_view.xml b/addons/project_issue/board_project_issue_view.xml index 30b6815e450..1784ba942aa 100644 --- a/addons/project_issue/board_project_issue_view.xml +++ b/addons/project_issue/board_project_issue_view.xml @@ -35,7 +35,7 @@ graph - + diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index e2b2a66f472..d892c8cdf87 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -177,7 +177,7 @@ class project_issue(crm.crm_case, osv.osv): 'partner_name': fields.char("Employee's Name", size=64), 'partner_mobile': fields.char('Mobile', size=32), 'partner_phone': fields.char('Phone', size=32), - 'stage_id': fields.many2one ('crm.case.stage', 'Resolution', domain="[('object_id.model', '=', 'project.issue')]"), + 'type_id': fields.many2one ('project.task.type', 'Resolution', domain="[('object_id.model', '=', 'project.issue')]"), 'project_id':fields.many2one('project.project', 'Project'), 'duration': fields.float('Duration'), 'task_id': fields.many2one('project.task', 'Task', domain="[('project_id','=',project_id)]"), @@ -279,16 +279,29 @@ class project_issue(crm.crm_case, osv.osv): def convert_to_bug(self, cr, uid, ids, context=None): return self._convert(cr, uid, ids, 'bug_categ', context=context) - def onchange_stage_id(self, cr, uid, ids, stage_id, context=None): - if context is None: - context = {} - if not stage_id: - return {'value':{}} - stage = self.pool.get('crm.case.stage').browse(cr, uid, stage_id, context) - if not stage.on_change: - return {'value':{}} - return {'value':{}} - + + def next_type(self, cr, uid, ids, *args): + for task in self.browse(cr, uid, ids): + typeid = task.type_id.id + types = map(lambda x:x.id, task.project_id.type_ids or []) + if types: + if not typeid: + self.write(cr, uid, task.id, {'type_id': types[0]}) + elif typeid and typeid in types and types.index(typeid) != len(types)-1 : + index = types.index(typeid) + self.write(cr, uid, task.id, {'type_id': types[index+1]}) + return True + + def prev_type(self, cr, uid, ids, *args): + for task in self.browse(cr, uid, ids): + typeid = task.type_id.id + types = map(lambda x:x.id, task.project_id and task.project_id.type_ids or []) + if types: + if typeid and typeid in types: + index = types.index(typeid) + self.write(cr, uid, task.id, {'type_id': index and types[index-1] or False}) + return True + def onchange_task_id(self, cr, uid, ids, task_id, context=None): if context is None: context = {} @@ -370,31 +383,6 @@ class project_issue(crm.crm_case, osv.osv): return res - def get_stage_dict(self, cr, uid, ids, context=None): - """This function gives dictionary for stage according to stage levels - @param self: The object pointer - @param cr: the current row, from the database cursor, - @param uid: the current user’s ID for security checks, - @param ids: List of case IDs - @param context: A standard dictionary for contextual values""" - if not context: - context = {} - stage_obj = self.pool.get('crm.case.stage') - domain = [('object_id.model', '=', self._name)] - if 'force_domain' in context and context['force_domain']: - domain += context['force_domain'] - sid = stage_obj.search(cr, uid, domain, context=context) - s = {} - previous = {} - section = self._name - - for stage in stage_obj.browse(cr, uid, sid, context=context): - s.setdefault(section, {}) - s[section][previous.get(section, False)] = stage.id - previous[section] = stage.id - return s - - def message_update(self, cr, uid, ids, vals={}, msg="", default_act='pending', context=None): if context is None: context = {} diff --git a/addons/project_issue/project_issue_data.xml b/addons/project_issue/project_issue_data.xml index 738f734e35a..8f0f097cb87 100644 --- a/addons/project_issue/project_issue_data.xml +++ b/addons/project_issue/project_issue_data.xml @@ -31,39 +31,5 @@ v3.0 - - - - - Accepted as Bug - - - - - Fixed - - - - - Won't fix - - - - - Invalid - - - - - Awaiting Response - - - - - Works For Me - - - - diff --git a/addons/project_issue/project_issue_demo.xml b/addons/project_issue/project_issue_demo.xml index 7c5ae6083ed..539cef5579e 100644 --- a/addons/project_issue/project_issue_demo.xml +++ b/addons/project_issue/project_issue_demo.xml @@ -12,7 +12,6 @@ - @@ -30,7 +29,6 @@ - @@ -45,7 +43,6 @@ - @@ -61,7 +58,6 @@ - @@ -76,7 +72,6 @@ - @@ -92,7 +87,6 @@ - @@ -108,7 +102,6 @@ - @@ -124,7 +117,6 @@ - @@ -139,7 +131,6 @@ - @@ -155,7 +146,6 @@ - @@ -171,7 +161,6 @@ - @@ -187,7 +176,6 @@ - @@ -204,7 +192,6 @@ - @@ -222,7 +209,6 @@ - @@ -238,7 +224,6 @@ - @@ -254,7 +239,6 @@ - diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml index f600765b9ed..feb92e51d0a 100644 --- a/addons/project_issue/project_issue_view.xml +++ b/addons/project_issue/project_issue_view.xml @@ -44,17 +44,6 @@ - - Issue Stages - crm.case.stage - form - - [('object_id.model', '=', 'project.issue')] - {'object_id':'project.issue'} - - - - Project Issue Tracker Form project.issue @@ -68,9 +57,9 @@ - -