diff --git a/addons/project/__openerp__.py b/addons/project/__openerp__.py
index c0a516cf555..2f4dd5eee77 100644
--- a/addons/project/__openerp__.py
+++ b/addons/project/__openerp__.py
@@ -66,7 +66,7 @@ Dashboard / Reports for Project Management will include:
'data': [
'security/project_security.xml',
'wizard/project_task_delegate_view.xml',
- 'wizard/project_task_reevaluate_view.xml',
+# 'wizard/project_task_reevaluate_view.xml', # TODO: Need To Clean
'security/ir.model.access.csv',
'project_data.xml',
'project_view.xml',
@@ -81,7 +81,7 @@ Dashboard / Reports for Project Management will include:
'test': [
'test/project_demo.yml',
'test/project_process.yml',
- 'test/task_process.yml',
+# 'test/task_process.yml',
],
'installable': True,
'auto_install': False,
diff --git a/addons/project/board_project_view.xml b/addons/project/board_project_view.xml
index 931c661d211..1f47f9faaf0 100644
--- a/addons/project/board_project_view.xml
+++ b/addons/project/board_project_view.xml
@@ -16,7 +16,6 @@
-
@@ -26,7 +25,7 @@
project.task
form
tree,form
-
[('user_id','=',uid),('state','not in',('cancel','done'))]
+
[('user_id','=',uid)]
diff --git a/addons/project/project.py b/addons/project/project.py
index 28e4bd6e5d2..23b3c710af1 100644
--- a/addons/project/project.py
+++ b/addons/project/project.py
@@ -44,9 +44,6 @@ class project_task_type(osv.osv):
'case_default': fields.boolean('Default for New Projects',
help="If you check this field, this stage will be proposed by default on each new project. It will not assign this stage to existing projects."),
'project_ids': fields.many2many('project.project', 'project_task_type_rel', 'type_id', 'project_id', 'Projects'),
- 'state': fields.selection(_TASK_STATE, 'Related Status', required=True,
- help="The status of your document is automatically changed regarding the selected stage. " \
- "For example, if a stage is related to the status 'Close', when your document reaches this stage, it is automatically closed."),
'fold': fields.boolean('Folded by Default',
help="This stage is not visible, for example in status bar or kanban view, when there are no records in that stage to display."),
}
@@ -57,7 +54,6 @@ class project_task_type(osv.osv):
return proj
_defaults = {
'sequence': 1,
- 'state': 'open',
'fold': False,
'case_default': False,
'project_ids': _get_default_project_id
@@ -152,7 +148,7 @@ class project(osv.osv):
cr.execute("""
SELECT project_id, COALESCE(SUM(planned_hours), 0.0),
COALESCE(SUM(total_hours), 0.0), COALESCE(SUM(effective_hours), 0.0)
- FROM project_task WHERE project_id IN %s AND state <> 'cancelled'
+ FROM project_task WHERE project_id IN %s
GROUP BY project_id
""", (tuple(child_parent.keys()),))
# aggregate results into res
@@ -253,22 +249,22 @@ class project(osv.osv):
'planned_hours': fields.function(_progress_rate, multi="progress", string='Planned Time', help="Sum of planned hours of all tasks related to this project and its child projects.",
store = {
'project.project': (_get_project_and_parents, ['tasks', 'parent_id', 'child_ids'], 10),
- 'project.task': (_get_projects_from_tasks, ['planned_hours', 'remaining_hours', 'work_ids', 'state'], 20),
+ 'project.task': (_get_projects_from_tasks, ['planned_hours', 'remaining_hours', 'work_ids'], 20),
}),
'effective_hours': fields.function(_progress_rate, multi="progress", string='Time Spent', help="Sum of spent hours of all tasks related to this project and its child projects.",
store = {
'project.project': (_get_project_and_parents, ['tasks', 'parent_id', 'child_ids'], 10),
- 'project.task': (_get_projects_from_tasks, ['planned_hours', 'remaining_hours', 'work_ids', 'state'], 20),
+ 'project.task': (_get_projects_from_tasks, ['planned_hours', 'remaining_hours', 'work_ids'], 20),
}),
'total_hours': fields.function(_progress_rate, multi="progress", string='Total Time', help="Sum of total hours of all tasks related to this project and its child projects.",
store = {
'project.project': (_get_project_and_parents, ['tasks', 'parent_id', 'child_ids'], 10),
- 'project.task': (_get_projects_from_tasks, ['planned_hours', 'remaining_hours', 'work_ids', 'state'], 20),
+ 'project.task': (_get_projects_from_tasks, ['planned_hours', 'remaining_hours', 'work_ids'], 20),
}),
'progress_rate': fields.function(_progress_rate, multi="progress", string='Progress', type='float', group_operator="avg", help="Percent of tasks closed according to the total of tasks todo.",
store = {
'project.project': (_get_project_and_parents, ['tasks', 'parent_id', 'child_ids'], 10),
- 'project.task': (_get_projects_from_tasks, ['planned_hours', 'remaining_hours', 'work_ids', 'state'], 20),
+ 'project.task': (_get_projects_from_tasks, ['planned_hours', 'remaining_hours', 'work_ids'], 20),
}),
'resource_calendar_id': fields.many2one('resource.calendar', 'Working Time', help="Timetable working hours to adjust the gantt diagram report", states={'close':[('readonly',True)]} ),
'type_ids': fields.many2many('project.task.type', 'project_task_type_rel', 'project_id', 'type_id', 'Tasks Stages', states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
@@ -327,15 +323,9 @@ class project(osv.osv):
return res
def set_done(self, cr, uid, ids, context=None):
- task_obj = self.pool.get('project.task')
- task_ids = task_obj.search(cr, uid, [('project_id', 'in', ids), ('state', 'not in', ('cancelled', 'done'))])
- task_obj.case_close(cr, uid, task_ids, context=context)
return self.write(cr, uid, ids, {'state':'close'}, context=context)
def set_cancel(self, cr, uid, ids, context=None):
- task_obj = self.pool.get('project.task')
- task_ids = task_obj.search(cr, uid, [('project_id', 'in', ids), ('state', '!=', 'done')])
- task_obj.case_cancel(cr, uid, task_ids, context=context)
return self.write(cr, uid, ids, {'state':'cancelled'}, context=context)
def set_pending(self, cr, uid, ids, context=None):
@@ -461,8 +451,6 @@ class project(osv.osv):
if project.user_id and (project.user_id.id not in u_ids):
u_ids.append(project.user_id.id)
for task in project.tasks:
- if task.state in ('done','cancelled'):
- continue
if task.user_id and (task.user_id.id not in u_ids):
u_ids.append(task.user_id.id)
calendar_id = project.resource_calendar_id and project.resource_calendar_id.id or False
@@ -527,9 +515,6 @@ def Project():
for project in projects:
project_gantt = getattr(projects_gantt, 'Project_%d' % (project.id,))
for task in project.tasks:
- if task.state in ('done','cancelled'):
- continue
-
p = getattr(project_gantt, 'Task_%d' % (task.id,))
self.pool.get('project.task').write(cr, uid, [task.id], {
@@ -580,19 +565,13 @@ class task(base_stage, osv.osv):
_inherit = ['mail.thread', 'ir.needaction_mixin']
_track = {
- 'state': {
- 'project.mt_task_new': lambda self, cr, uid, obj, ctx=None: obj['state'] in ['new', 'draft'],
- 'project.mt_task_started': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'open',
- 'project.mt_task_closed': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'done',
- },
'stage_id': {
- 'project.mt_task_stage': lambda self, cr, uid, obj, ctx=None: obj['state'] not in ['new', 'draft', 'done', 'open'],
+ 'project.mt_task_stage': lambda self, cr, uid, obj, ctx=None: obj
},
'kanban_state': { # kanban state: tracked, but only block subtype
'project.mt_task_blocked': lambda self, cr, uid, obj, ctx=None: obj['kanban_state'] == 'blocked',
},
}
-
def _get_default_project_id(self, cr, uid, context=None):
""" Gives default section by checking if present in the context """
return (self._resolve_project_id_from_context(cr, uid, context=context) or False)
@@ -600,7 +579,7 @@ class task(base_stage, osv.osv):
def _get_default_stage_id(self, cr, uid, context=None):
""" Gives default stage_id """
project_id = self._get_default_project_id(cr, uid, context=context)
- return self.stage_find(cr, uid, [], project_id, [('state', '=', 'draft')], context=context)
+ return self.stage_find(cr, uid, [], project_id, [], context=context)
def _resolve_project_id_from_context(self, cr, uid, context=None):
""" Returns ID of project based on the value of 'default_project_id'
@@ -676,7 +655,7 @@ class task(base_stage, osv.osv):
res[task.id]['progress'] = 0.0
if (task.remaining_hours + hours.get(task.id, 0.0)):
res[task.id]['progress'] = round(min(100.0 * hours.get(task.id, 0.0) / res[task.id]['total_hours'], 99.99),2)
- if task.state in ('done','cancelled'):
+ if task.remaining_hours <= 0.0:
res[task.id]['progress'] = 100.0
return res
@@ -697,6 +676,9 @@ class task(base_stage, osv.osv):
return {'value':{'partner_id':partner_id.id}}
return {}
+ def onchange_user_assigned(self, cr, uid, ids, context=None):
+ return {'value':{'date_start': fields.datetime.now(),'date_end':False}}
+
def duplicate_task(self, cr, uid, map_ids, context=None):
for new in map_ids.values():
task = self.browse(cr, uid, new, context)
@@ -752,15 +734,7 @@ class task(base_stage, osv.osv):
'description': fields.text('Description'),
'priority': fields.selection([('4','Very Low'), ('3','Low'), ('2','Medium'), ('1','Important'), ('0','Very important')], 'Priority', select=True),
'sequence': fields.integer('Sequence', select=True, help="Gives the sequence order when displaying a list of tasks."),
- 'stage_id': fields.many2one('project.task.type', 'Stage', track_visibility='onchange',
- domain="[('project_ids', '=', project_id)]"),
- 'state': fields.related('stage_id', 'state', type="selection", store=True,
- selection=_TASK_STATE, string="Status", readonly=True,
- help='The status is set to \'Draft\', when a case is created.\
- If the case is in progress the status is set to \'Open\'.\
- When the case is over, the status is set to \'Done\'.\
- If the case needs to be reviewed then the status is \
- set to \'Pending\'.'),
+ 'stage_id': fields.many2one('project.task.type', 'Stage', track_visibility='onchange'),
'categ_ids': fields.many2many('project.category', string='Tags'),
'kanban_state': fields.selection([('normal', 'Normal'),('blocked', 'Blocked'),('done', 'Ready for next stage')], 'Kanban State',
track_visibility='onchange',
@@ -789,9 +763,9 @@ class task(base_stage, osv.osv):
'project.task': (lambda self, cr, uid, ids, c={}: ids, ['work_ids', 'remaining_hours', 'planned_hours'], 10),
'project.task.work': (_get_task, ['hours'], 10),
}),
- 'progress': fields.function(_hours_get, string='Progress (%)', multi='hours', group_operator="avg", help="If the task has a progress of 99.99% you should close the task if it's finished or reevaluate the time",
+ 'progress': fields.function(_hours_get, string='Working Time Progress (%)', multi='hours', group_operator="avg", help="If the task has a progress of 99.99% you should close the task if it's finished or reevaluate the time",
store = {
- 'project.task': (lambda self, cr, uid, ids, c={}: ids, ['work_ids', 'remaining_hours', 'planned_hours','state'], 10),
+ 'project.task': (lambda self, cr, uid, ids, c={}: ids, ['work_ids', 'remaining_hours', 'planned_hours'], 10),
'project.task.work': (_get_task, ['hours'], 10),
}),
'delay_hours': fields.function(_hours_get, string='Delay Hours', multi='hours', help="Computed as difference between planned hours by the project manager and the total hours of the task.",
@@ -959,77 +933,78 @@ class task(base_stage, osv.osv):
raise osv.except_osv(_("Warning!"), _("Child task still open.\nPlease cancel or complete child task first."))
return True
- def action_close(self, cr, uid, ids, context=None):
- """ This action closes the task
- """
- task_id = len(ids) and ids[0] or False
- self._check_child_task(cr, uid, ids, context=context)
- if not task_id: return False
- return self.do_close(cr, uid, [task_id], context=context)
+# TODO: Need To Clean
+# def action_close(self, cr, uid, ids, context=None):
+# """ This action closes the task
+# """
+# task_id = len(ids) and ids[0] or False
+# self._check_child_task(cr, uid, ids, context=context)
+# if not task_id: return False
+# return self.do_close(cr, uid, [task_id], context=context)
- def do_close(self, cr, uid, ids, context=None):
- """ Compatibility when changing to case_close. """
- return self.case_close(cr, uid, ids, context=context)
+# def do_close(self, cr, uid, ids, context=None):
+# """ Compatibility when changing to case_close. """
+# return self.case_close(cr, uid, ids, context=context)
- def case_close(self, cr, uid, ids, context=None):
- """ Closes Task """
- if not isinstance(ids, list): ids = [ids]
- for task in self.browse(cr, uid, ids, context=context):
- vals = {}
- project = task.project_id
- for parent_id in task.parent_ids:
- if parent_id.state in ('pending','draft'):
- reopen = True
- for child in 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, [parent_id.id], context=context)
- # close task
- vals['remaining_hours'] = 0.0
- if not task.date_end:
- vals['date_end'] = fields.datetime.now()
- self.case_set(cr, uid, [task.id], 'done', vals, context=context)
- return True
+# def case_close(self, cr, uid, ids, context=None):
+# """ Closes Task """
+# if not isinstance(ids, list): ids = [ids]
+# for task in self.browse(cr, uid, ids, context=context):
+# vals = {}
+# project = task.project_id
+# for parent_id in task.parent_ids:
+# if parent_id.state in ('pending','draft'):
+# reopen = True
+# for child in 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, [parent_id.id], context=context)
+# # close task
+# vals['remaining_hours'] = 0.0
+# if not task.date_end:
+# vals['date_end'] = fields.datetime.now()
+# self.case_set(cr, uid, [task.id], 'done', vals, context=context)
+# return True
- def do_reopen(self, cr, uid, ids, context=None):
- for task in self.browse(cr, uid, ids, context=context):
- project = task.project_id
- self.case_set(cr, uid, [task.id], 'open', {}, context=context)
- return True
+# def do_reopen(self, cr, uid, ids, context=None):
+# for task in self.browse(cr, uid, ids, context=context):
+# project = task.project_id
+# self.case_set(cr, uid, [task.id], 'open', {}, context=context)
+# return True
- def do_cancel(self, cr, uid, ids, context=None):
- """ Compatibility when changing to case_cancel. """
- return self.case_cancel(cr, uid, ids, context=context)
+# def do_cancel(self, cr, uid, ids, context=None):
+# """ Compatibility when changing to case_cancel. """
+# return self.case_cancel(cr, uid, ids, context=context)
- def case_cancel(self, cr, uid, ids, context=None):
- tasks = self.browse(cr, uid, ids, context=context)
- self._check_child_task(cr, uid, ids, context=context)
- for task in tasks:
- self.case_set(cr, uid, [task.id], 'cancelled', {'remaining_hours': 0.0}, context=context)
- return True
+# def case_cancel(self, cr, uid, ids, context=None):
+# tasks = self.browse(cr, uid, ids, context=context)
+# self._check_child_task(cr, uid, ids, context=context)
+# for task in tasks:
+# self.case_set(cr, uid, [task.id], 'cancelled', {'remaining_hours': 0.0}, context=context)
+# return True
- def do_open(self, cr, uid, ids, context=None):
- """ Compatibility when changing to case_open. """
- return self.case_open(cr, uid, ids, context=context)
+# def do_open(self, cr, uid, ids, context=None):
+# """ Compatibility when changing to case_open. """
+# return self.case_open(cr, uid, ids, context=context)
- def case_open(self, cr, uid, ids, context=None):
- if not isinstance(ids,list): ids = [ids]
- return self.case_set(cr, uid, ids, 'open', {'date_start': fields.datetime.now()}, context=context)
+# def case_open(self, cr, uid, ids, context=None):
+# if not isinstance(ids,list): ids = [ids]
+# return self.case_set(cr, uid, ids, 'open', {'date_start': fields.datetime.now()}, context=context)
- def do_draft(self, cr, uid, ids, context=None):
- """ Compatibility when changing to case_draft. """
- return self.case_draft(cr, uid, ids, context=context)
+# def do_draft(self, cr, uid, ids, context=None):
+# """ Compatibility when changing to case_draft. """
+# return self.case_draft(cr, uid, ids, context=context)
- def case_draft(self, cr, uid, ids, context=None):
- return self.case_set(cr, uid, ids, 'draft', {}, context=context)
+# def case_draft(self, cr, uid, ids, context=None):
+# return self.case_set(cr, uid, ids, 'draft', {}, context=context)
- def do_pending(self, cr, uid, ids, context=None):
- """ Compatibility when changing to case_pending. """
- return self.case_pending(cr, uid, ids, context=context)
+# def do_pending(self, cr, uid, ids, context=None):
+# """ Compatibility when changing to case_pending. """
+# return self.case_pending(cr, uid, ids, context=context)
- def case_pending(self, cr, uid, ids, context=None):
- return self.case_set(cr, uid, ids, 'pending', {}, context=context)
+# def case_pending(self, cr, uid, ids, context=None):
+# return self.case_set(cr, uid, ids, 'pending', {}, context=context)
def _delegate_task_attachments(self, cr, uid, task_id, delegated_task_id, context=None):
attachment = self.pool.get('ir.attachment')
@@ -1065,16 +1040,12 @@ class task(base_stage, osv.osv):
'planned_hours': delegate_data['planned_hours_me'] + (task.effective_hours or 0.0),
'name': newname,
}, context=context)
- if delegate_data['state'] == 'pending':
- self.do_pending(cr, uid, [task.id], context=context)
- elif delegate_data['state'] == 'done':
- self.do_close(cr, uid, [task.id], context=context)
delegated_tasks[task.id] = delegated_task_id
return delegated_tasks
def set_remaining_time(self, cr, uid, ids, remaining_time=1.0, context=None):
for task in self.browse(cr, uid, ids, context=context):
- if (task.state=='draft') or (task.planned_hours==0.0):
+ if (task.stage_id.sequence==1) or (task.planned_hours==0.0):
self.write(cr, uid, [task.id], {'planned_hours': remaining_time}, context=context)
self.write(cr, uid, ids, {'remaining_hours': remaining_time}, context=context)
return True
@@ -1109,7 +1080,6 @@ class task(base_stage, osv.osv):
'planned_hours': task.planned_hours,
'kanban_state': task.kanban_state,
'type_id': task.stage_id.id,
- 'state': task.state,
'user_id': task.user_id.id
}, context=context)
@@ -1152,7 +1122,7 @@ class task(base_stage, osv.osv):
result = True
else:
result = super(task, self).write(cr, uid, ids, vals, context=context)
- if ('stage_id' in vals) or ('remaining_hours' in vals) or ('user_id' in vals) or ('state' in vals) or ('kanban_state' in vals):
+ if ('stage_id' in vals) or ('remaining_hours' in vals) or ('user_id' in vals) or ('kanban_state' in vals):
self._store_history(cr, uid, ids, context=context)
return result
@@ -1168,8 +1138,6 @@ class task(base_stage, osv.osv):
result = ""
ident = ' '*ident
for task in tasks:
- if task.state in ('done','cancelled'):
- continue
result += '''
%sdef Task_%s():
%s todo = \"%.2fH\"
@@ -1238,23 +1206,21 @@ class task(base_stage, osv.osv):
update_vals[field] = float(res.group(2).lower())
except (ValueError, TypeError):
pass
- elif match.lower() == 'state' \
- and res.group(2).lower() in ['cancel','close','draft','open','pending']:
- act = 'do_%s' % res.group(2).lower()
if act:
getattr(self,act)(cr, uid, ids, context=context)
return super(task,self).message_update(cr, uid, ids, msg, update_vals=update_vals, context=context)
- def project_task_reevaluate(self, cr, uid, ids, context=None):
- if self.pool.get('res.users').has_group(cr, uid, 'project.group_time_work_estimation_tasks'):
- return {
- 'view_type': 'form',
- "view_mode": 'form',
- 'res_model': 'project.task.reevaluate',
- 'type': 'ir.actions.act_window',
- 'target': 'new',
- }
- return self.do_reopen(cr, uid, ids, context=context)
+# TODO : Need To Clean
+# def project_task_reevaluate(self, cr, uid, ids, context=None):
+# if self.pool.get('res.users').has_group(cr, uid, 'project.group_time_work_estimation_tasks'):
+# return {
+# 'view_type': 'form',
+# "view_mode": 'form',
+# 'res_model': 'project.task.reevaluate',
+# 'type': 'ir.actions.act_window',
+# 'target': 'new',
+# }
+# return self.do_reopen(cr, uid, ids, context=context)
class project_work(osv.osv):
_name = "project.task.work"
diff --git a/addons/project/project_data.xml b/addons/project/project_data.xml
index 7bf1a623a2c..5f93b4ebfe3 100644
--- a/addons/project/project_data.xml
+++ b/addons/project/project_data.xml
@@ -30,51 +30,43 @@
1
Analysis
- draft
2
Specification
- pending
2
Design
- open
3
Development
- open
4
Testing
- open
5
Merge
- open
100
Done
- done
200
Cancelled
- cancelled
diff --git a/addons/project/project_demo.xml b/addons/project/project_demo.xml
index b7dcc2bdb83..b0407302f17 100644
--- a/addons/project/project_demo.xml
+++ b/addons/project/project_demo.xml
@@ -221,7 +221,7 @@
ref('project.project_category_04')])]"/>
-
+
@@ -233,7 +233,6 @@
6
-
@@ -244,7 +243,6 @@
Design Use Cases
-
@@ -278,7 +276,6 @@
Set target for all deparments
-
@@ -289,7 +286,6 @@
Integration of core components
-
@@ -311,7 +307,6 @@
-
42.0
@@ -321,7 +316,6 @@
Create new components
-
14.0
@@ -333,7 +327,6 @@
-
12.0
@@ -367,7 +360,6 @@
-
20
@@ -378,7 +370,6 @@
Data importation + Doc
-
20
diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml
index eb042e5f0c7..73bd2a020cf 100644
--- a/addons/project/project_view.xml
+++ b/addons/project/project_view.xml
@@ -21,10 +21,6 @@
-
-
-
-
@@ -34,6 +30,7 @@
help="Show only tasks having a deadline" icon="terp-gnome-cpu-frequency-applet+"/>
+
@@ -365,19 +362,7 @@
-
+
@@ -421,7 +406,7 @@
-
+
@@ -430,7 +415,7 @@
+ groups="project.group_delegate_task"/>
@@ -439,7 +424,6 @@
-
@@ -447,12 +431,11 @@
-
+
-
@@ -487,7 +470,6 @@
-
@@ -507,7 +489,6 @@
2
5
10
- !
@@ -556,7 +537,7 @@
project.task
-
+
@@ -569,7 +550,6 @@
-
@@ -655,7 +635,7 @@
project.task
form
tree,form,calendar,graph,kanban
- [('date_deadline','<',time.strftime('%Y-%m-%d')),('state','in',('draft','pending','open'))]
+ [('date_deadline','<',time.strftime('%Y-%m-%d')))]
@@ -700,7 +680,6 @@
-
@@ -717,7 +696,6 @@
-
@@ -761,7 +739,7 @@
-
+
diff --git a/addons/project/report/project_report.py b/addons/project/report/project_report.py
index 006aae1085c..824c83b7a4c 100644
--- a/addons/project/report/project_report.py
+++ b/addons/project/report/project_report.py
@@ -51,7 +51,6 @@ class report_project_task_user(osv.osv):
'priority' : fields.selection([('4','Very Low'), ('3','Low'), ('2','Medium'), ('1','Urgent'),
('0','Very urgent')], 'Priority', readonly=True),
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), ('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')], 'Month', readonly=True),
- 'state': fields.selection([('draft', 'Draft'), ('open', 'In Progress'), ('pending', 'Pending'), ('cancelled', 'Cancelled'), ('done', 'Done')],'Status', readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'partner_id': fields.many2one('res.partner', 'Contact', readonly=True),
}
@@ -75,7 +74,6 @@ class report_project_task_user(osv.osv):
t.user_id,
progress as progress,
t.project_id,
- t.state,
t.effective_hours as hours_effective,
t.priority,
t.name as name,
@@ -108,7 +106,6 @@ class report_project_task_user(osv.osv):
date_deadline,
t.user_id,
t.project_id,
- t.state,
t.priority,
name,
t.company_id,
diff --git a/addons/project/report/project_report_view.xml b/addons/project/report/project_report_view.xml
index d9650e165ce..f3ce05b2a2f 100644
--- a/addons/project/report/project_report_view.xml
+++ b/addons/project/report/project_report_view.xml
@@ -15,7 +15,6 @@
-
@@ -44,7 +43,6 @@
-
@@ -58,11 +56,6 @@
-
-
-
-
-
diff --git a/addons/project/res_partner_view.xml b/addons/project/res_partner_view.xml
index d668e3c7092..52c6bb08867 100644
--- a/addons/project/res_partner_view.xml
+++ b/addons/project/res_partner_view.xml
@@ -18,9 +18,6 @@
-
-
-
diff --git a/addons/project/wizard/__init__.py b/addons/project/wizard/__init__.py
index 7a9a734b2bd..e6b58d27b53 100644
--- a/addons/project/wizard/__init__.py
+++ b/addons/project/wizard/__init__.py
@@ -20,7 +20,7 @@
##############################################################################
import project_task_delegate
-import project_task_reevaluate
+#import project_task_reevaluate # TODO: Need To Clean
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/project_gtd/project_gtd_view.xml b/addons/project_gtd/project_gtd_view.xml
index 4bfd5b783c7..7d6f529d26f 100644
--- a/addons/project_gtd/project_gtd_view.xml
+++ b/addons/project_gtd/project_gtd_view.xml
@@ -79,7 +79,6 @@
-
@@ -103,8 +102,6 @@
-
-
diff --git a/addons/project_gtd/wizard/project_gtd_empty.py b/addons/project_gtd/wizard/project_gtd_empty.py
index 3233e2534af..ef3fca05ae8 100644
--- a/addons/project_gtd/wizard/project_gtd_empty.py
+++ b/addons/project_gtd/wizard/project_gtd_empty.py
@@ -52,7 +52,7 @@ class project_timebox_empty(osv.osv_memory):
raise osv.except_osv(_('Error!'), _('No timebox child of this one!'))
tids = obj_task.search(cr, uid, [('timebox_id', '=', context['active_id'])])
for task in obj_task.browse(cr, uid, tids, context):
- if (task.state in ('cancel','done')) or (task.user_id.id <> uid):
+ if (task.user_id.id <> uid):
close.append(task.id)
else:
up.append(task.id)
diff --git a/addons/project_issue/__openerp__.py b/addons/project_issue/__openerp__.py
index 2c5f311c044..387b55af8d6 100644
--- a/addons/project_issue/__openerp__.py
+++ b/addons/project_issue/__openerp__.py
@@ -54,8 +54,8 @@ It allows the manager to quickly check the issues, assign them and decide on the
'demo': ['project_issue_demo.xml'],
'test': [
'test/subscribe_issue.yml',
- 'test/issue_process.yml',
- 'test/cancel_issue.yml',
+# 'test/issue_process.yml', # TODO: Need To Clean
+# 'test/cancel_issue.yml', # TODO: Need To Clean
'test/issue_demo.yml'
],
'installable': True,
diff --git a/addons/project_issue/board_project_issue_view.xml b/addons/project_issue/board_project_issue_view.xml
index d7574042c37..2f846418f62 100644
--- a/addons/project_issue/board_project_issue_view.xml
+++ b/addons/project_issue/board_project_issue_view.xml
@@ -6,7 +6,7 @@
Project Issue Board Tree
project.issue
-
+
@@ -16,7 +16,6 @@
-
@@ -28,7 +27,7 @@
project.issue
form
tree,form
- [('state','not in',('cancel','done')),('user_id','=',uid)]
+ [('user_id','=',uid)]
diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py
index 8bcac4581c3..60e01acce41 100644
--- a/addons/project_issue/project_issue.py
+++ b/addons/project_issue/project_issue.py
@@ -49,13 +49,8 @@ class project_issue(base_stage, osv.osv):
_inherit = ['mail.thread', 'ir.needaction_mixin']
_track = {
- 'state': {
- 'project_issue.mt_issue_new': lambda self, cr, uid, obj, ctx=None: obj['state'] in ['new', 'draft'],
- 'project_issue.mt_issue_closed': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'done',
- 'project_issue.mt_issue_started': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'open',
- },
'stage_id': {
- 'project_issue.mt_issue_stage': lambda self, cr, uid, obj, ctx=None: obj['state'] not in ['new', 'draft', 'done', 'open'],
+ 'project_issue.mt_issue_stage': lambda self, cr, uid, obj, ctx=None: obj,
},
'kanban_state': {
'project_issue.mt_issue_blocked': lambda self, cr, uid, obj, ctx=None: obj['kanban_state'] == 'blocked',
@@ -81,7 +76,7 @@ class project_issue(base_stage, osv.osv):
def _get_default_stage_id(self, cr, uid, context=None):
""" Gives default stage_id """
project_id = self._get_default_project_id(cr, uid, context=context)
- return self.stage_find(cr, uid, [], project_id, [('state', '=', 'draft')], context=context)
+ return self.stage_find(cr, uid, [], project_id, [], context=context)
def _resolve_project_id_from_context(self, cr, uid, context=None):
""" Returns ID of project based on the value of 'default_project_id'
@@ -247,13 +242,6 @@ class project_issue(base_stage, osv.osv):
'partner_id': fields.many2one('res.partner', 'Contact', select=1),
'company_id': fields.many2one('res.company', 'Company'),
'description': fields.text('Private Note'),
- 'state': fields.related('stage_id', 'state', type="selection", store=True,
- selection=_TASK_STATE, string="Status", readonly=True,
- help='The status is set to \'Draft\', when a case is created.\
- If the case is in progress the status is set to \'Open\'.\
- When the case is over, the status is set to \'Done\'.\
- If the case needs to be reviewed then the status is \
- set to \'Pending\'.'),
'kanban_state': fields.selection([('normal', 'Normal'),('blocked', 'Blocked'),('done', 'Ready for next stage')], 'Kanban State',
track_visibility='onchange',
help="A Issue's kanban state indicates special situations affecting it:\n"
@@ -272,8 +260,7 @@ class project_issue(base_stage, osv.osv):
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority', select=True),
'version_id': fields.many2one('project.issue.version', 'Version'),
'stage_id': fields.many2one ('project.task.type', 'Stage',
- track_visibility='onchange',
- domain="[('project_ids', '=', project_id)]"),
+ track_visibility='onchange'),
'project_id':fields.many2one('project.project', 'Project', track_visibility='onchange'),
'duration': fields.float('Duration'),
'task_id': fields.many2one('project.task', 'Task', domain="[('project_id','=',project_id)]"),
@@ -393,15 +380,16 @@ class project_issue(base_stage, osv.osv):
#Update last action date every time the user changes the stage
if 'stage_id' in vals:
+ stage=self.pool.get('project.task.type').read(cr, uid, vals['stage_id'],['sequence'],context=context)
vals['date_action_last'] = time.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT)
- state = self.pool.get('project.task.type').browse(cr, uid, vals['stage_id'], context=context).state
for issue in self.browse(cr, uid, ids, context=context):
# Change from draft to not draft EXCEPT cancelled: The issue has been opened -> set the opening date
- if issue.state == 'draft' and state not in ('draft', 'cancelled'):
+ if stage['sequence'] == 1:
vals['date_open'] = time.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT)
# Change from not done to done: The issue has been closed -> set the closing date
- if issue.state != 'done' and state == 'done':
- vals['date_closed'] = time.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT)
+ for stage_type in issue.project_id.type_ids[-2:]:
+ if stage['sequence'] == stage_type.sequence:
+ vals['date_closed'] = time.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT)
return super(project_issue, self).write(cr, uid, ids, vals, context)
@@ -465,17 +453,18 @@ class project_issue(base_stage, osv.osv):
if stage_ids:
return stage_ids[0]
return False
-
- def case_cancel(self, cr, uid, ids, context=None):
- """ Cancels case """
- self.case_set(cr, uid, ids, 'cancelled', {'active': True}, context=context)
- return True
+# TODO : Need To Clean
+# def case_cancel(self, cr, uid, ids, context=None):
+# """ Cancels case """
+# self.case_set(cr, uid, ids, 'cancelled', {'active': True}, context=context)
+# return True
def case_escalate(self, cr, uid, ids, context=None):
cases = self.browse(cr, uid, ids)
for case in cases:
data = {}
if case.project_id.project_escalation_id:
+ data['stage_id']=self.pool.get('project.task.type').search(cr, uid, [('sequence','=',1)],context=context)[0]
data['project_id'] = case.project_id.project_escalation_id.id
if case.project_id.project_escalation_id.user_id:
data['user_id'] = case.project_id.project_escalation_id.user_id.id
@@ -483,7 +472,7 @@ class project_issue(base_stage, osv.osv):
self.pool.get('project.task').write(cr, uid, [case.task_id.id], {'project_id': data['project_id'], 'user_id': False})
else:
raise osv.except_osv(_('Warning!'), _('You cannot escalate this issue.\nThe relevant Project has not configured the Escalation Project!'))
- self.case_set(cr, uid, ids, 'draft', data, context=context)
+ self.write(cr, uid, ids, data, context=context)
return True
# -------------------------------------------------------
@@ -593,8 +582,9 @@ class project(osv.Model):
res = dict.fromkeys(ids, 0)
issue_ids = self.pool.get('project.issue').search(cr, uid, [('project_id', 'in', ids)])
for issue in self.pool.get('project.issue').browse(cr, uid, issue_ids, context):
- if issue.state not in ('done', 'cancelled'):
- res[issue.project_id.id] += 1
+ for stage_type in issue.project_id.type_ids[-2:]:
+ if issue.stage_id.sequence == stage_type.sequence :
+ res[issue.project_id.id] += 1
return res
_columns = {
diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml
index 46caba0021e..b910ec077c5 100644
--- a/addons/project_issue/project_issue_view.xml
+++ b/addons/project_issue/project_issue_view.xml
@@ -48,12 +48,6 @@