summaryrefslogtreecommitdiff
path: root/addons/project_issue
diff options
context:
space:
mode:
authorThibault Delavallée <tde@openerp.com>2013-07-19 11:47:06 +0200
committerThibault Delavallée <tde@openerp.com>2013-07-19 11:47:06 +0200
commitf37497aaa8ad395b0a5cfd9c8b8be8d8fef1e15b (patch)
tree0f15262560a8cbd820685924829b5e2139fed071 /addons/project_issue
parent67ac805e51133fe8be5681d1252f46949ec89ca5 (diff)
parent573220c2864d718ce07ee1adef1698c7108fcb6a (diff)
[MERGE] [REF] project task/issue stage management cleaning
Using stages and states is not easy to manage. Indeed those two fields mess with the same basic concept. This task remove the state on project.task and project.issue models, leaving only stages. Main features: - removed base_stage inheritance on project.task and project.issue models - removed state field on project.task and project.issue models - removed state field on project.task.type model - added date_last_stage_update on project.task and project.issue models, holding the date of the last stage change, allowing reporting and analysis on time spend in stages - date_open is set when assigning an user to the task / isuse; date_open now means assignation date This allows to remove all buttons on the form view, leaving only a dynamic stage management using the statusbar. Subtypes have been updated : - new: stage_id.sequence=1 - stage changed: stage_id changed, not new - user assigned: when user_id is set Misc: - [IMP] views accordingly; - [IMP] reports accordingly, added date_last_stage_update in reports; - [IMP] subtypes - [REM] [REF] [TESTS] removed some tests because they are not applicable anymore; rewrite some tests and moved some of them into unittests - [DOC] doc directory + changelog + stage explanation in project and project_issue; - [REM] removed project.task.reevaluate wizard bzr revid: tde@openerp.com-20130719094706-ea0hbwjj99pochzo
Diffstat (limited to 'addons/project_issue')
-rw-r--r--addons/project_issue/__openerp__.py1
-rw-r--r--addons/project_issue/board_project_issue_view.xml5
-rw-r--r--addons/project_issue/doc/changelog.rst13
-rw-r--r--addons/project_issue/doc/index.rst22
-rw-r--r--addons/project_issue/doc/stage_status.rst54
-rw-r--r--addons/project_issue/project_issue.py96
-rw-r--r--addons/project_issue/project_issue_data.xml24
-rw-r--r--addons/project_issue/project_issue_view.xml26
-rw-r--r--addons/project_issue/report/project_issue_report.py20
-rw-r--r--addons/project_issue/report/project_issue_report_view.xml16
-rw-r--r--addons/project_issue/test/cancel_issue.yml60
-rw-r--r--addons/project_issue/test/issue_process.yml42
12 files changed, 152 insertions, 227 deletions
diff --git a/addons/project_issue/__openerp__.py b/addons/project_issue/__openerp__.py
index 2c5f311c044..d41144253dd 100644
--- a/addons/project_issue/__openerp__.py
+++ b/addons/project_issue/__openerp__.py
@@ -55,7 +55,6 @@ It allows the manager to quickly check the issues, assign them and decide on the
'test': [
'test/subscribe_issue.yml',
'test/issue_process.yml',
- 'test/cancel_issue.yml',
'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..6eb48f5572d 100644
--- a/addons/project_issue/board_project_issue_view.xml
+++ b/addons/project_issue/board_project_issue_view.xml
@@ -6,7 +6,7 @@
<field name="name">Project Issue Board Tree</field>
<field name="model">project.issue</field>
<field name="arch" type="xml">
- <tree string="Issue Tracker Tree" colors="black:state=='open';blue:state=='pending';grey:state in ('cancel', 'done')">
+ <tree string="Issue Tracker Tree">
<field name="id"/>
<field name="create_date"/>
<field name="name"/>
@@ -16,7 +16,6 @@
<field name="version_id" widget="selection"/>
<field name="progress" widget="progressbar" attrs="{'invisible':[('task_id','=',False)]}"/>
<field name="stage_id" widget="selection" readonly="1"/>
- <field name="state" invisible="1"/>
<field name="categ_ids" invisible="1"/>
<field name="task_id" invisible="1"/>
</tree>
@@ -28,7 +27,7 @@
<field name="res_model">project.issue</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
- <field name="domain">[('state','not in',('cancel','done')),('user_id','=',uid)]</field>
+ <field name="domain">[('user_id', '=', uid)]</field>
<field name="view_id" ref="project_issue_board_tree_view"/>
</record>
diff --git a/addons/project_issue/doc/changelog.rst b/addons/project_issue/doc/changelog.rst
new file mode 100644
index 00000000000..e74516f1600
--- /dev/null
+++ b/addons/project_issue/doc/changelog.rst
@@ -0,0 +1,13 @@
+.. _changelog:
+
+Changelog
+=========
+
+`trunk (saas-2)`
+----------------
+
+- Stage/state update
+
+ - ``project.issue``: removed inheritance from ``base_stage`` class and removed
+ ``state`` field. Added ``date_last_stage_update`` field holding last stage_id
+ modification. Updated reports.
diff --git a/addons/project_issue/doc/index.rst b/addons/project_issue/doc/index.rst
new file mode 100644
index 00000000000..9e12eef2124
--- /dev/null
+++ b/addons/project_issue/doc/index.rst
@@ -0,0 +1,22 @@
+=====================
+Project Issue DevDoc
+=====================
+
+Project Issue module documentation
+===================================
+
+Documentation topics
+''''''''''''''''''''
+
+.. toctree::
+ :maxdepth: 1
+
+ stage_status.rst
+
+Changelog
+'''''''''
+
+.. toctree::
+ :maxdepth: 1
+
+ changelog.rst
diff --git a/addons/project_issue/doc/stage_status.rst b/addons/project_issue/doc/stage_status.rst
new file mode 100644
index 00000000000..6afd4508cd9
--- /dev/null
+++ b/addons/project_issue/doc/stage_status.rst
@@ -0,0 +1,54 @@
+.. _stage_status:
+
+Stage and Status
+================
+
+.. versionchanged:: 8.0 saas-2 state/stage cleaning
+
+Stage
++++++
+
+This revision removed the concept of state on project.issue objects. The ``state``
+field has been totally removed and replaced by stages, using ``stage_id``. The
+following models are impacted:
+
+ - ``project.issue`` now use only stages. However a convention still exists about
+ 'New' stage. An issue is consdered as ``new`` when it has the following
+ properties:
+
+ - ``stage_id and stage_id.sequence = 1``
+
+ - ``project.task.type`` do not have any ``state`` field anymore.
+ - ``project.issue.report`` do not have any ``state`` field anymore.
+
+By default a newly created issue is in a new stage. It means that it will
+fetch the stage having ``sequence = 1``. Stage mangement is done using the
+kanban view or the clikable statusbar. It is not done using buttons anymore.
+
+Stage analysis
+++++++++++++++
+
+Stage analysis can be performed using the newly introduced ``date_last_stage_update``
+datetime field. This field is updated everytime ``stage_id`` is updated.
+
+``project.issue.report`` model also uses the ``date_last_stage_update`` field.
+This allows to group and analyse the time spend in the various stages.
+
+Open / Assignation date
++++++++++++++++++++++++
+
+The ``date_open`` field meaning has been updated. It is now set when the ``user_id``
+(responsible) is set. It is therefore the assignation date.
+
+Subtypes
+++++++++
+
+The following subtypes are triggered on ``project.issue``:
+
+ - ``mt_issue_new``: new tasks. Condition: ``obj.stage_id and obj.stage_id.sequence == 1``
+ - ``mt_issue_stage``: stage changed. Condition: ``obj.stage_id and obj.stage_id.sequence != 1``
+ - ``mt_issue_assigned``: user assigned. condition: ``obj.user_id and obj.user_id.id``
+ - ``mt_issue_blocked``: kanban state blocked. Condition: ``obj.kanban_state == 'blocked'``
+
+Those subtypes are also available on the ``project.project`` model and are used
+for the auto subscription.
diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py
index 91b5633f6d6..30ca08c0ae7 100644
--- a/addons/project_issue/project_issue.py
+++ b/addons/project_issue/project_issue.py
@@ -19,19 +19,16 @@
#
##############################################################################
+from datetime import datetime
+
from openerp import SUPERUSER_ID
-from openerp.addons.base_status.base_stage import base_stage
-from openerp.addons.project.project import _TASK_STATE
+from openerp import tools
from openerp.addons.crm import crm
-from datetime import datetime
from openerp.osv import fields, osv, orm
-from openerp.tools.translate import _
-import binascii
-import time
-from openerp import tools
from openerp.tools import html2plaintext
+from openerp.tools.translate import _
-class project_issue_version(osv.osv):
+class project_issue_version(osv.Model):
_name = "project.issue.version"
_order = "name desc"
_columns = {
@@ -42,36 +39,25 @@ class project_issue_version(osv.osv):
'active': 1,
}
-class project_issue(base_stage, osv.osv):
+class project_issue(osv.Model):
_name = "project.issue"
_description = "Project Issue"
_order = "priority, create_date desc"
_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_new': lambda self, cr, uid, obj, ctx=None: obj.stage_id and obj.stage_id.sequence == 1,
+ 'project_issue.mt_issue_stage': lambda self, cr, uid, obj, ctx=None: obj.stage_id and obj.stage_id.sequence != 1,
+ },
+ 'user_id': {
+ 'project_issue.mt_issue_assigned': lambda self, cr, uid, obj, ctx=None: obj.user_id and obj.user_id.id,
},
'kanban_state': {
'project_issue.mt_issue_blocked': lambda self, cr, uid, obj, ctx=None: obj.kanban_state == 'blocked',
},
}
- def create(self, cr, uid, vals, context=None):
- if context is None:
- context = {}
- if vals.get('project_id') and not context.get('default_project_id'):
- context['default_project_id'] = vals.get('project_id')
-
- # context: no_log, because subtype already handle this
- create_context = dict(context, mail_create_nolog=True)
- return super(project_issue, self).create(cr, uid, vals, context=create_context)
-
def _get_default_partner(self, cr, uid, context=None):
""" Override of base_stage to add project specific behavior """
project_id = self._get_default_project_id(cr, uid, context)
@@ -79,7 +65,7 @@ class project_issue(base_stage, osv.osv):
project = self.pool.get('project.project').browse(cr, uid, project_id, context=context)
if project and project.partner_id:
return project.partner_id.id
- return super(project_issue, self)._get_default_partner(cr, uid, context=context)
+ return False
def _get_default_project_id(self, cr, uid, context=None):
""" Gives default project by checking if present in the context """
@@ -88,7 +74,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, [('sequence', '=', 1)], 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'
@@ -258,13 +244,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"
@@ -278,6 +257,7 @@ class project_issue(base_stage, osv.osv):
# Project Issue fields
'date_closed': fields.datetime('Closed', readonly=True,select=True),
'date': fields.datetime('Date'),
+ 'date_last_stage_update': fields.datetime('Last Stage Update', select=True),
'channel_id': fields.many2one('crm.case.channel', 'Channel', help="Communication channel."),
'categ_ids': fields.many2many('project.category', string='Tags'),
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority', select=True),
@@ -313,13 +293,11 @@ class project_issue(base_stage, osv.osv):
_defaults = {
'active': 1,
- 'partner_id': lambda s, cr, uid, c: s._get_default_partner(cr, uid, c),
- 'email_from': lambda s, cr, uid, c: s._get_default_email(cr, uid, c),
'stage_id': lambda s, cr, uid, c: s._get_default_stage_id(cr, uid, c),
- 'section_id': lambda s, cr, uid, c: s._get_default_section_id(cr, uid, c),
'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.helpdesk', context=c),
'priority': crm.AVAILABLE_PRIORITIES[2][0],
'kanban_state': 'normal',
+ 'date_last_stage_update': fields.datetime.now(),
'user_id': lambda obj, cr, uid, context: uid,
}
@@ -373,7 +351,7 @@ class project_issue(base_stage, osv.osv):
})
vals = {
'task_id': new_task_id,
- 'stage_id': self.stage_find(cr, uid, [bug], bug.project_id.id, [('state', '=', 'pending')], context=context),
+ 'stage_id': self.stage_find(cr, uid, [bug], bug.project_id.id, [('sequence', '=', 1)], context=context),
}
message = _("Project issue <b>converted</b> to task.")
self.message_post(cr, uid, [bug.id], body=message, context=context)
@@ -401,19 +379,23 @@ class project_issue(base_stage, osv.osv):
return super(project_issue, self).copy(cr, uid, id, default=default,
context=context)
+ def create(self, cr, uid, vals, context=None):
+ if context is None:
+ context = {}
+ if vals.get('project_id') and not context.get('default_project_id'):
+ context['default_project_id'] = vals.get('project_id')
+
+ # context: no_log, because subtype already handle this
+ create_context = dict(context, mail_create_nolog=True)
+ return super(project_issue, self).create(cr, uid, vals, context=create_context)
+
def write(self, cr, uid, ids, vals, context=None):
-
- #Update last action date every time the user changes the stage
+ # stage change: update date_last_stage_update
if 'stage_id' in vals:
- 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'):
- 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)
+ vals['date_last_stage_update'] = fields.datetime.now()
+ # user_id change: update date_start
+ if vals.get('user_id'):
+ vals['date_start'] = fields.datetime.now()
return super(project_issue, self).write(cr, uid, ids, vals, context)
@@ -423,13 +405,6 @@ class project_issue(base_stage, osv.osv):
task = self.pool.get('project.task').browse(cr, uid, task_id, context=context)
return {'value': {'user_id': task.user_id.id, }}
- def case_reset(self, cr, uid, ids, context=None):
- """Resets case as draft
- """
- res = super(project_issue, self).case_reset(cr, uid, ids, context)
- self.write(cr, uid, ids, {'date_open': False, 'date_closed': False})
- return res
-
def get_empty_list_help(self, cr, uid, help, context=None):
context['empty_list_help_model'] = 'project.project'
context['empty_list_help_id'] = context.get('default_project_id')
@@ -478,11 +453,6 @@ class project_issue(base_stage, osv.osv):
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
-
def case_escalate(self, cr, uid, ids, context=None):
cases = self.browse(cr, uid, ids)
for case in cases:
@@ -591,7 +561,7 @@ class project_issue(base_stage, osv.osv):
context = {}
res = super(project_issue, self).message_post(cr, uid, thread_id, body=body, subject=subject, type=type, subtype=subtype, parent_id=parent_id, attachments=attachments, context=context, content_subtype=content_subtype, **kwargs)
if thread_id and subtype:
- self.write(cr, SUPERUSER_ID, thread_id, {'date_action_last': time.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT)}, context=context)
+ self.write(cr, SUPERUSER_ID, thread_id, {'date_action_last': fields.datetime.now()}, context=context)
return res
@@ -605,7 +575,7 @@ 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'):
+ if issue.stage_id and not issue.stage_id.fold:
res[issue.project_id.id] += 1
return res
diff --git a/addons/project_issue/project_issue_data.xml b/addons/project_issue/project_issue_data.xml
index 2e43ca69193..25a336d4094 100644
--- a/addons/project_issue/project_issue_data.xml
+++ b/addons/project_issue/project_issue_data.xml
@@ -35,11 +35,11 @@ Access all issues from the top Project menu, and access the issues of a specific
<field name="default" eval="False"/>
<field name="description">Issue created</field>
</record>
- <record id="mt_issue_started" model="mail.message.subtype">
- <field name="name">Issue Started</field>
+ <record id="mt_issue_assigned" model="mail.message.subtype">
+ <field name="name">Issue Assigned</field>
<field name="res_model">project.issue</field>
<field name="default" eval="False"/>
- <field name="description">Issue started</field>
+ <field name="description">Issue assigned</field>
</record>
<record id="mt_issue_blocked" model="mail.message.subtype">
<field name="name">Issue Blocked</field>
@@ -47,12 +47,6 @@ Access all issues from the top Project menu, and access the issues of a specific
<field name="default" eval="False"/>
<field name="description">Issue blocked</field>
</record>
- <record id="mt_issue_closed" model="mail.message.subtype">
- <field name="name">Issue Closed</field>
- <field name="res_model">project.issue</field>
- <field name="default" eval="False"/>
- <field name="description">Issue closed</field>
- </record>
<record id="mt_issue_stage" model="mail.message.subtype">
<field name="name">Stage Changed</field>
<field name="res_model">project.issue</field>
@@ -67,11 +61,11 @@ Access all issues from the top Project menu, and access the issues of a specific
<field name="parent_id" eval="ref('mt_issue_new')"/>
<field name="relation_field">project_id</field>
</record>
- <record id="mt_project_issue_started" model="mail.message.subtype">
- <field name="name">Issue Started</field>
+ <record id="mt_project_issue_assigned" model="mail.message.subtype">
+ <field name="name">Issue Assigned</field>
<field name="res_model">project.project</field>
<field name="default" eval="False"/>
- <field name="parent_id" eval="ref('mt_issue_started')"/>
+ <field name="parent_id" eval="ref('mt_issue_assigned')"/>
<field name="relation_field">project_id</field>
</record>
<record id="mt_project_issue_blocked" model="mail.message.subtype">
@@ -80,12 +74,6 @@ Access all issues from the top Project menu, and access the issues of a specific
<field name="parent_id" eval="ref('mt_issue_blocked')"/>
<field name="relation_field">project_id</field>
</record>
- <record id="mt_project_issue_closed" model="mail.message.subtype">
- <field name="name">Issue Closed</field>
- <field name="res_model">project.project</field>
- <field name="parent_id" eval="ref('mt_issue_closed')"/>
- <field name="relation_field">project_id</field>
- </record>
<record id="mt_project_issue_stage" model="mail.message.subtype">
<field name="name">Issue Stage Changed</field>
<field name="res_model">project.project</field>
diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml
index da3034c72f5..1fbea33f3df 100644
--- a/addons/project_issue/project_issue_view.xml
+++ b/addons/project_issue/project_issue_view.xml
@@ -48,12 +48,6 @@
<field name="arch" type="xml">
<form string="Issue" version="7.0">
<header>
- <button name="case_close" string="Done" type="object"
- states="open" groups="base.group_user"/>
- <button name="case_close" string="Done" type="object"
- states="draft,pending" groups="base.group_user"/>
- <button name="case_cancel" string="Cancel Issue" type="object"
- states="draft,open,pending" groups="base.group_user"/>
<field name="stage_id" widget="statusbar" clickable="True"/>
</header>
<sheet string="Issue">
@@ -76,7 +70,7 @@
<label for="project_id"/>
<div>
<field name="project_id" on_change="on_change_project(project_id)" class="oe_inline" context="{'default_use_issues':1}"/>
- <button name="case_escalate" string="⇒ Escalate" type="object" states="draft,open,pending" class="oe_link"
+ <button name="case_escalate" string="⇒ Escalate" type="object" class="oe_link"
groups="base.group_user"/>
</div>
</group>
@@ -106,7 +100,6 @@
</group>
<group string="Status" groups="base.group_no_one">
<field name="active"/>
- <field name="state" string="Status"/>
</group>
</page>
</notebook>
@@ -123,7 +116,7 @@
<field name="name">Project Issue Tracker Tree</field>
<field name="model">project.issue</field>
<field name="arch" type="xml">
- <tree string="Issue Tracker Tree" fonts="bold:message_unread==True" colors="black:state=='open';blue:state=='pending';grey:state in ('cancel', 'done')">
+ <tree string="Issue Tracker Tree" fonts="bold:message_unread==True">
<field name="message_unread" invisible="1"/>
<field name="id"/>
<field name="name"/>
@@ -135,7 +128,6 @@
<field name="user_id"/>
<field name="progress" widget="progressbar" attrs="{'invisible':[('task_id','=',False)]}"/>
<field name="stage_id" widget="selection" readonly="1"/>
- <field name="state" invisible="1"/>
<field name="categ_ids" invisible="1"/>
<field name="task_id" invisible="1"/>
</tree>
@@ -149,17 +141,16 @@
<search string="Issue Tracker Search">
<field name="name" string="Issue" filter_domain="['|', '|', '|', ('partner_id','child_of',self), ('description','ilike',self),('email_from','ilike',self),('name','ilike',self)]"/>
<field name="id"/>
- <filter icon="terp-mail-message-new" string="Unread Messages" name="message_unread" domain="[('message_unread','=',True)]"/>
- <separator/>
- <filter name="filter_new" string="New" icon="terp-document-new" domain="[('state','=','draft')]" help="New Issues"/>
- <filter name="filter_open" string="To Do" domain="[('state','=','open')]" help="To Do Issues" icon="terp-check"/>
+ <field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
+ <filter string="Unassigned" name="unassigned" domain="[('user_id', '=', False)]"/>
+ <filter string="New" name="draft" domain="[('stage_id.sequence', '=', 1)]"/>
<separator/>
- <filter string="Unassigned Issues" domain="[('user_id','=',False)]" help="Unassigned Issues" icon="terp-personal-"/>
+ <filter string="Unread Messages" name="message_unread" domain="[('message_unread','=',True)]"/>
<separator/>
<field name="user_id"/>
<field name="project_id"/>
<field name="categ_ids"/>
- <field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
+ <field name="stage_id" domain="[]"/>
<group expand="0" string="Group By..." >
<filter string="Responsible" name="group_user_id" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
<filter string="Contact" name="group_partner_id" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
@@ -269,7 +260,7 @@
<field name="name">Project Issue- Feature Tracker Tree</field>
<field name="model">project.issue</field>
<field name="arch" type="xml">
- <tree string="Feature Tracker Tree" fonts="bold:message_unread==True" colors="red:state=='open';black:state in ('draft', 'cancel','done','pending')">
+ <tree string="Feature Tracker Tree" fonts="bold:message_unread==True">
<field name="id"/>
<field name="message_unread" invisible="1"/>
<field name="name" string="Feature description"/>
@@ -278,7 +269,6 @@
<field name="version_id"/>
<field name="user_id"/>
<field name="stage_id" widget="selection" readonly="1"/>
- <field name="state" groups="base.group_no_one"/>
</tree>
</field>
</record>
diff --git a/addons/project_issue/report/project_issue_report.py b/addons/project_issue/report/project_issue_report.py
index 5cca0ff8689..5f59b51f290 100644
--- a/addons/project_issue/report/project_issue_report.py
+++ b/addons/project_issue/report/project_issue_report.py
@@ -20,17 +20,10 @@
#
##############################################################################
-from openerp.osv import fields,osv
+from openerp.osv import fields, osv
from openerp import tools
from openerp.addons.crm import crm
-AVAILABLE_STATES = [
- ('draft','Draft'),
- ('open','Open'),
- ('cancel', 'Cancelled'),
- ('done', 'Closed'),
- ('pending','Pending')
-]
class project_issue_report(osv.osv):
_name = "project.issue.report"
_auto = False
@@ -38,18 +31,13 @@ class project_issue_report(osv.osv):
_columns = {
'name': fields.char('Year', size=64, required=False, readonly=True),
'section_id':fields.many2one('crm.case.section', 'Sale Team', readonly=True),
- 'state': fields.selection(AVAILABLE_STATES, 'Status', size=16, 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),
+ 'month':fields.selection(fields.date.MONTHS, 'Month', readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'day': fields.char('Day', size=128, readonly=True),
'opening_date': fields.date('Date of Opening', readonly=True),
'creation_date': fields.date('Creation Date', readonly=True),
'date_closed': fields.date('Date of Closing', readonly=True),
+ 'date_last_stage_update': fields.date('Last Stage Update', readonly=True),
'stage_id': fields.many2one('project.task.type', 'Stage'),
'nbr': fields.integer('# of Issues', readonly=True),
'working_hours_open': fields.float('Avg. Working Hours to Open', readonly=True, group_operator="avg"),
@@ -80,7 +68,7 @@ class project_issue_report(osv.osv):
to_char(c.create_date, 'YYYY-MM-DD') as day,
to_char(c.date_open, 'YYYY-MM-DD') as opening_date,
to_char(c.create_date, 'YYYY-MM-DD') as creation_date,
- c.state,
+ date_trunc('day',c.date_last_stage_update) as date_last_stage_update,
c.user_id,
c.working_hours_open,
c.working_hours_close,
diff --git a/addons/project_issue/report/project_issue_report_view.xml b/addons/project_issue/report/project_issue_report_view.xml
index a885dcd8a7f..f9ca7168841 100644
--- a/addons/project_issue/report/project_issue_report_view.xml
+++ b/addons/project_issue/report/project_issue_report_view.xml
@@ -20,7 +20,7 @@
<field name="partner_id" invisible="1"/>
<field name="task_id" invisible="1"/>
<field name="date_closed" invisible="1"/>
- <field name="state" invisible="1"/>
+ <field name="date_last_stage_update" invisible="1"/>
<field name="day" invisible="1"/>
<field name="nbr" string="#Project Issues" sum="#Number of Project Issues"/>
<field name="delay_open" avg="Avg Opening Delay"/>
@@ -36,9 +36,9 @@
<field name="model">project.issue.report</field>
<field name="arch" type="xml">
<graph orientation="horizontal" string="Project Issue" type="bar">
- <field name="state"/>
<field name="nbr" operator="+"/>
- <field group="True" name="user_id"/>
+ <field name="user_id" group="True"/>
+ <field name="stage_id" group="True"/>
</graph>
</field>
</record>
@@ -49,14 +49,15 @@
<field name="arch" type="xml">
<search string="Search">
<field name="creation_date"/>
- <filter icon="terp-camera_test" string="New" domain="[('state','=','draft')]"/>
- <filter icon="terp-check" string="To Do" domain="[('state','=','open')]"/>
- <filter icon="terp-gtk-media-pause" string="Pending" domain="[('state','=','pending')]"/>
- <filter icon="terp-dialog-close" string="Done" domain="[('state','=','done')]"/>
<field name="project_id"/>
<field name="user_id"/>
<field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
<field name="version_id"/>
+ <field name="stage_id"/>
+ <filter string="Unassigned" name="unassigned" domain="[('user_id','=',False)]"/>
+ <filter string="New" name="new" domain="[('stage_id.sequence', '=', 1)]"/>
+ <filter string="Done" name="done" domain="[('stage_id.fold', '=', True)]"
+ help="Tasks beloging to a folded stage"/>
<group expand="1" string="Group By...">
<filter string="Assigned to" name="Responsible" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}" />
<filter string="Contact" icon="terp-partner" context="{'group_by':'partner_id'}" />
@@ -70,6 +71,7 @@
<filter string="Day" icon="terp-go-today" domain="[]" context="{'group_by':'day'}" help="Creation Date"/>
<filter string="Month" icon="terp-go-month" domain="[]" context="{'group_by':'month'}" help="Creation Date"/>
<filter string="Year" icon="terp-go-year" domain="[]" context="{'group_by':'name'}" help="Creation Date"/>
+ <filter string="Last Stage Update" context="{'group_by':'date_last_stage_update'}"/>
</group>
</search>
</field>
diff --git a/addons/project_issue/test/cancel_issue.yml b/addons/project_issue/test/cancel_issue.yml
deleted file mode 100644
index 76ffa212638..00000000000
--- a/addons/project_issue/test/cancel_issue.yml
+++ /dev/null
@@ -1,60 +0,0 @@
--
- In order to test process of issue tracking in OpenERP, I cancel the unqualified Issue.
--
- !python {model: project.issue}: |
- self.case_cancel(cr, uid, [ref("crm_case_buginaccountsmodule0")])
--
- I check the issue is in cancel state.
--
- !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue is in cancel state}:
- - state == 'cancelled'
--
- I re-open the Issue.
--
- !python {model: project.issue}: |
- self.case_open(cr, uid, [ref("crm_case_buginaccountsmodule0")])
--
- I check the state of issue after open it.
--
- !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue is in open state}:
- - state == 'open'
--
- I put the issue in pending state.
--
- !python {model: project.issue}: |
- self.case_pending(cr, uid, [ref("crm_case_buginaccountsmodule0")])
--
- I check the state of issue after put it in pending state.
--
- !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue should be in pending state}:
- - state == 'pending'
--
- I cancel the issue is in pending state.
--
- !python {model: project.issue}: |
- self.case_cancel(cr, uid, [ref("crm_case_buginaccountsmodule0")])
--
- I check the issue is in cancel state.
--
- !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue is in cancel state}:
- - state == 'cancelled'
--
- I close Issue.
--
- !python {model: project.issue}: |
- self.case_close(cr, uid, [ref("crm_case_buginaccountsmodule0")])
--
- I check state of Issue after close.
--
- !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue is in done state}:
- - state == 'done'
--
- I cancel the issue is in done state.
--
- !python {model: project.issue}: |
- self.case_cancel(cr, uid, [ref("crm_case_buginaccountsmodule0")])
--
- I check the issue is in cancel state.
--
- !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue is in cancel state}:
- - state == 'cancelled'
diff --git a/addons/project_issue/test/issue_process.yml b/addons/project_issue/test/issue_process.yml
index afb68a9b6c2..280df50ebea 100644
--- a/addons/project_issue/test/issue_process.yml
+++ b/addons/project_issue/test/issue_process.yml
@@ -1,24 +1,4 @@
-
- In order to test process of issue tracking in OpenERP, I Open the Issue.
--
- !python {model: project.issue}: |
- self.case_open(cr, uid, [ref("crm_case_buginaccountsmodule0")])
--
- I check state of Issue after opened it.
--
- !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue should be in open state}:
- - state == 'open'
--
- Now I put Issue in pending due to need more information.
--
- !python {model: project.issue}: |
- self.case_pending(cr, uid, [ref("crm_case_buginaccountsmodule0")])
--
- I check state after put in pending.
--
- !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue should be in pending state}:
- - state == 'pending'
--
I send mail to get more details. TODO revert mail.mail to mail.compose.message (conversion to customer should be automatic).
-
!python {model: mail.mail }: |
@@ -29,29 +9,9 @@
new_id = self.create(cr, uid, {'email_from': 'support@mycompany.com','email_to': 'Robert_Adersen@yahoo.com', 'subject': 'Regarding error in account module we nees more details'})
self.send_mail(cr, uid, [new_id], context=ctx)
except Exception, e:
- pass
--
- After getting sufficient details, I re-open Issue from pending state.
--
- !python {model: project.issue}: |
- self.case_open(cr, uid, [ref("crm_case_buginaccountsmodule0")])
--
- I check state of Issue after re-opened.
--
- !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue should be in open state}:
- - state == 'open'
+ pass
-
I create Task for Issue.
-
!python {model: project.issue}: |
self.convert_issue_task(cr, uid, [ref("crm_case_buginaccountsmodule0")])
--
- I close Issue after resolving it
--
- !python {model: project.issue}: |
- self.case_close(cr, uid, [ref("crm_case_buginaccountsmodule0")])
--
- I Check state of Issue after closed.
--
- !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue should be in done state}:
- - state == 'done'