diff options
| author | Thibault Delavallée <tde@openerp.com> | 2012-06-01 12:14:26 +0200 |
|---|---|---|
| committer | Thibault Delavallée <tde@openerp.com> | 2012-06-01 12:14:26 +0200 |
| commit | f9e6b60c9f48c48d7b0d2a9b67a3e2376e032fd2 (patch) | |
| tree | c602d1e223affb7b04a8c2cc0189fb4405441854 /addons/project_issue | |
| parent | b98e0bdf14d4537f338fcee4fe2f14bdf76ac9ce (diff) | |
| parent | d988ca61568707ee4c9dca9288ff269dca9c77a6 (diff) | |
[MERGE] Merged branch holding state/stage cleaning for lead/opportunities, hr_recruitment, project_issue, tasks, crm_claim. Those models now use stage as the main status flow; the state is a related field to the stage, and is not important anymore. Updated views accordingly (buttons, statusbar on stage_id). Also updated view of crm_meeting, crm_helpdesk and crm_phonecall. Old crm_base and crm_case are nos distinct from crm, and are in a new addon called 'base_status'. This module defines most of the methods related to the logic; models inheriting from base_state or base_stage have few methods to override to implement a particular behavior (mainly stage_find for base_stage).
bzr revid: tde@openerp.com-20120601101426-28e6gnsywhkxeber
Diffstat (limited to 'addons/project_issue')
| -rw-r--r-- | addons/project_issue/__openerp__.py | 1 | ||||
| -rw-r--r-- | addons/project_issue/board_project_issue_view.xml | 26 | ||||
| -rw-r--r-- | addons/project_issue/project_issue.py | 190 | ||||
| -rw-r--r-- | addons/project_issue/project_issue_demo.xml | 48 | ||||
| -rw-r--r-- | addons/project_issue/project_issue_view.xml | 93 | ||||
| -rw-r--r-- | addons/project_issue/report/project_issue_report.py | 4 | ||||
| -rw-r--r-- | addons/project_issue/report/project_issue_report_view.xml | 4 | ||||
| -rw-r--r-- | addons/project_issue/test/cancel_issue.yml | 6 |
8 files changed, 228 insertions, 144 deletions
diff --git a/addons/project_issue/__openerp__.py b/addons/project_issue/__openerp__.py index fc88372fe90..9037523d41e 100644 --- a/addons/project_issue/__openerp__.py +++ b/addons/project_issue/__openerp__.py @@ -38,6 +38,7 @@ and decide on their status as they evolve. 'website': 'http://www.openerp.com', 'images': ['images/issue_analysis.jpeg','images/project_issue.jpeg'], 'depends': [ + 'base_status', 'crm', 'project', ], diff --git a/addons/project_issue/board_project_issue_view.xml b/addons/project_issue/board_project_issue_view.xml index a070bdbe521..9945f006e43 100644 --- a/addons/project_issue/board_project_issue_view.xml +++ b/addons/project_issue/board_project_issue_view.xml @@ -35,7 +35,7 @@ <field name="type">graph</field> <field name="arch" type="xml"> <graph orientation="vertical" string="Project Issue" type="bar"> - <field name="type_id"/> + <field name="stage_id"/> <field name="nbr" operator="+"/> <field group="True" name="user_id"/> </graph> @@ -96,18 +96,22 @@ <field name="partner_id"/> <field name="project_id" /> <field name="priority" string="Priority"/> - <field name="type_id" widget="selection" readonly="1"/> - <button name="prev_type" string="Previous" type="object" icon="gtk-go-back" help="Change to Previous Stage"/> - <button name="next_type" string="Next" type="object" icon="gtk-go-forward" help="Change to Next Stage"/> <field name="version_id" widget="selection"/> <field name="progress" widget="progressbar" attrs="{'invisible':[('task_id','=',False)]}"/> - <field name="state"/> - <button name="case_cancel" string="Cancel" states="draft,open,pending" type="object" icon="gtk-cancel"/> - <button name="case_close" string="Done" states="open,draft,pending" type="object" icon="gtk-jump-to"/> - <button name="case_open" string="Open" states="draft,pending" type="object" icon="gtk-go-forward" help="To Do"/> - <button name="case_pending" string="Pending" states="draft,open" type="object" icon="gtk-media-pause"/> - <button name="case_escalate" string="Escalate" states="open,draft,pending" type="object" icon="gtk-go-up"/> - <button name="case_reset" string="Reset to Draft" states="done,cancel" type="object" icon="gtk-convert"/> + <field name="stage_id" widget="selection" readonly="1"/> + <button name="stage_previous" string="Previous" type="object" + icon="gtk-go-back" help="Change to Previous Stage" + attrs="{'invisible': [('stage_id','=', False)]}"/> + <button name="stage_next" string="Next" type="object" + icon="gtk-go-forward" help="Change to Next Stage" + attrs="{'invisible': [('stage_id','=', False)]}"/> + <field name="state" groups="base.group_no_one"/> + <button name="case_open" string="Open" type="object" + states="draft,pending" icon="gtk-go-forward"/> + <button name="case_close" string="Done" type="object" + states="draft,open,pending" icon="gtk-close"/> + <button name="case_cancel" string="Cancel" type="object" + states="draft,open,pending" icon="gtk-cancel"/> <field name="categ_id" invisible="1"/> <field name="task_id" invisible="1"/> </tree> diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index 176ffa61acd..177c21570cd 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -19,6 +19,7 @@ # ############################################################################## +from base_status.base_stage import base_stage from crm import crm from datetime import datetime from osv import fields,osv @@ -42,12 +43,62 @@ class project_issue_version(osv.osv): } project_issue_version() -class project_issue(crm.crm_case, osv.osv): +_ISSUE_STATE= [('draft', 'New'), ('open', 'In Progress'), ('cancel', 'Cancelled'), ('done', 'Done'),('pending', 'Pending')] + +class project_issue(base_stage, osv.osv): _name = "project.issue" _description = "Project Issue" _order = "priority, create_date desc" _inherit = ['ir.needaction_mixin', 'mail.thread'] + def _get_default_project_id(self, cr, uid, context=None): + """ Gives default project by checking if present in the context """ + return self._resolve_project_id_from_context(cr, uid, context=context) + + 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) + + def _resolve_project_id_from_context(self, cr, uid, context=None): + """ Returns ID of project based on the value of 'default_project_id' + context key, or None if it cannot be resolved to a single + project. + """ + if context is None: + context = {} + if type(context.get('default_project_id')) in (int, long): + return context.get('default_project_id') + if isinstance(context.get('default_project_id'), basestring): + project_name = context['default_project_id'] + project_ids = self.pool.get('project.project').name_search(cr, uid, name=project_name, context=context) + if len(project_ids) == 1: + return int(project_ids[0][0]) + return None + + def _read_group_stage_ids(self, cr, uid, ids, domain, read_group_order=None, access_rights_uid=None, context=None): + access_rights_uid = access_rights_uid or uid + stage_obj = self.pool.get('project.task.type') + order = stage_obj._order + # lame hack to allow reverting search, should just work in the trivial case + if read_group_order == 'stage_id desc': + order = "%s desc" % order + # retrieve section_id from the context and write the domain + # - ('id', 'in', 'ids'): add columns that should be present + # - OR ('case_default', '=', True), ('fold', '=', False): add default columns that are not folded + # - OR ('project_ids', 'in', project_id), ('fold', '=', False) if project_id: add project columns that are not folded + search_domain = [] + project_id = self._resolve_project_id_from_context(cr, uid, context=context) + if project_id: + search_domain += ['|', '&', ('project_ids', '=', project_id), ('fold', '=', False)] + search_domain += ['|', ('id', 'in', ids), '&', ('case_default', '=', True), ('fold', '=', False)] + # perform search + stage_ids = stage_obj._search(cr, uid, search_domain, order=order, access_rights_uid=access_rights_uid, context=context) + result = stage_obj.name_get(cr, access_rights_uid, stage_ids, context=context) + # restore order of the search + result.sort(lambda x,y: cmp(stage_ids.index(x[0]), stage_ids.index(y[0]))) + return result + def _compute_day(self, cr, uid, ids, fields, args, context=None): """ @param cr: the current row, from the database cursor, @@ -173,11 +224,13 @@ class project_issue(crm.crm_case, osv.osv): 'partner_id': fields.many2one('res.partner', 'Partner', select=1), 'company_id': fields.many2one('res.company', 'Company'), 'description': fields.text('Description'), - 'state': fields.selection([('draft', 'New'), ('cancel', 'Cancelled'), ('open', 'In Progress'),('pending', 'Pending'),('done', 'Done') ], 'Status', size=16, readonly=True, - help='The state is set to \'Draft\', when a case is created.\ - \nIf the case is in progress the state is set to \'Open\'.\ - \nWhen the case is over, the state is set to \'Done\'.\ - \nIf the case needs to be reviewed then the state is set to \'Pending\'.'), + 'state': fields.related('stage_id', 'state', type="selection", store=True, + selection=_ISSUE_STATE, string="State", readonly=True, + help='The state is set to \'Draft\', when a case is created.\ + If the case is in progress the state is set to \'Open\'.\ + When the case is over, the state is set to \'Done\'.\ + If the case needs to be reviewed then the state is \ + set to \'Pending\'.'), 'email_from': fields.char('Email', size=128, help="These people will receive email.", select=1), 'email_cc': fields.char('Watchers Emails', size=256, help="These email addresses will be added to the CC field of all inbound and outbound emails for this record before being sent. Separate multiple email addresses with a comma"), 'date_open': fields.datetime('Opened', readonly=True,select=True), @@ -188,7 +241,8 @@ class project_issue(crm.crm_case, osv.osv): 'categ_id': fields.many2one('crm.case.categ', 'Category', domain="[('object_id.model', '=', 'crm.project.bug')]"), 'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority', select=True), 'version_id': fields.many2one('project.issue.version', 'Version'), - 'type_id': fields.many2one ('project.task.type', 'Stages', domain="[('project_ids', '=', project_id)]"), + 'stage_id': fields.many2one ('project.task.type', 'Stages', + domain="['|', ('project_ids', '=', project_id), ('case_default', '=', True)]"), 'project_id':fields.many2one('project.project', 'Project'), 'duration': fields.float('Duration'), 'task_id': fields.many2one('project.task', 'Task', domain="[('project_id','=',project_id)]"), @@ -221,15 +275,20 @@ class project_issue(crm.crm_case, osv.osv): _defaults = { 'active': 1, - 'partner_id': crm.crm_case._get_default_partner, - 'email_from': crm.crm_case._get_default_email, + '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), 'state': 'draft', - 'section_id': crm.crm_case._get_section, + '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], 'categ_id' : lambda *a: False, } + _group_by_full = { + 'stage_id': _read_group_stage_ids + } + def set_priority(self, cr, uid, ids, priority): """Set lead priority """ @@ -312,36 +371,20 @@ 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 next_type(self, cr, uid, ids, context=None): - 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, context=None): - 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 copy(self, cr, uid, id, default=None, context=None): + issue = self.read(cr, uid, id, ['name'], context=context) + if not default: + default = {} + default = default.copy() + default['name'] = issue['name'] + _(' (copy)') + return super(project_issue, self).copy(cr, uid, id, default=default, + context=context) + def write(self, cr, uid, ids, vals, context=None): #Update last action date every time the user change the stage, the state or send a new email - logged_fields = ['type_id', 'state', 'message_ids'] + logged_fields = ['stage_id', 'state', 'message_ids'] if any([field in vals for field in logged_fields]): vals['date_action_last'] = time.strftime('%Y-%m-%d %H:%M:%S') - if vals.get('type_id', False): - stage = self.pool.get('project.task.type').browse(cr, uid, vals['type_id'], context=context) - self.message_append_note(cr, uid, ids, body=_("Stage changed to <b>%s</b>.") % stage.name, context=context) return super(project_issue, self).write(cr, uid, ids, vals, context) def onchange_task_id(self, cr, uid, ids, task_id, context=None): @@ -363,15 +406,51 @@ class project_issue(crm.crm_case, osv.osv): self.create_send_note(cr, uid, [obj_id], context=context) return obj_id - def case_open(self, cr, uid, ids, context=None): - res = super(project_issue, self).case_open(cr, uid, ids, context) - self.write(cr, uid, ids, {'date_open': time.strftime('%Y-%m-%d %H:%M:%S'), 'user_id' : uid}) - return res + # ------------------------------------------------------- + # Stage management + # ------------------------------------------------------- + + def stage_find(self, cr, uid, cases, section_id, domain=[], order='sequence', context=None): + """ Override of the base.stage method + Parameter of the stage search taken from the issue: + - type: stage type must be the same or 'both' + - section_id: if set, stages must belong to this section or + be a default case + """ + if isinstance(cases, (int, long)): + cases = self.browse(cr, uid, cases, context=context) + # collect all section_ids + section_ids = [] + if section_id: + section_ids.append(section_id) + for task in cases: + if task.project_id: + section_ids.append(task.project_id.id) + # OR all section_ids and OR with case_default + search_domain = [] + if section_ids: + search_domain += [('|')] * len(section_ids) + for section_id in section_ids: + search_domain.append(('project_ids', '=', section_id)) + search_domain.append(('case_default', '=', True)) + # AND with the domain in parameter + search_domain += list(domain) + # perform search, return the first found + stage_ids = self.pool.get('project.task.type').search(cr, uid, search_domain, order=order, context=context) + 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) + self.case_cancel_send_note(cr, uid, ids, context=context) + return True def case_escalate(self, cr, uid, ids, context=None): cases = self.browse(cr, uid, ids) for case in cases: - data = {'state' : 'draft'} + data = {} if case.project_id.project_escalation_id: data['project_id'] = case.project_id.project_escalation_id.id if case.project_id.project_escalation_id.user_id: @@ -380,10 +459,14 @@ class project_issue(crm.crm_case, 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.write(cr, uid, [case.id], data) - self.case_escalate_send_note(cr, uid, [case.id], context) + self.case_set(cr, uid, ids, 'draft', data, context=context) + self.case_escalate_send_note(cr, uid, [case.id], context=context) return True + # ------------------------------------------------------- + # Mail gateway + # ------------------------------------------------------- + def message_new(self, cr, uid, msg, custom_values=None, context=None): """Automatically called when new email message arrives""" if context is None: @@ -434,7 +517,7 @@ class project_issue(crm.crm_case, osv.osv): # Reassign the 'open' state to the case if this one is in pending or done for record in self.browse(cr, uid, ids, context=context): if record.state in ('pending', 'done'): - record.write({'state' : 'open'}) + self.case_set(cr, uid, ids, 'open', {}, context=context) vls = { } for line in msg['body_text'].split('\n'): @@ -448,15 +531,6 @@ class project_issue(crm.crm_case, osv.osv): res = self.write(cr, uid, ids, vals) self.message_append_dict(cr, uid, ids, msg, context=context) return res - - def copy(self, cr, uid, id, default=None, context=None): - issue = self.read(cr, uid, id, ['name'], context=context) - if not default: - default = {} - default = default.copy() - default['name'] = issue['name'] + _(' (copy)') - return super(project_issue, self).copy(cr, uid, id, default=default, - context=context) # ------------------------------------------------------- # OpenChatter methods and notifications @@ -475,9 +549,15 @@ class project_issue(crm.crm_case, osv.osv): if obj.user_id: sub_ids.append(obj.user_id.id) return self.pool.get('res.users').read(cr, uid, sub_ids, context=context) - + + def stage_set_send_note(self, cr, uid, ids, stage_id, context=None): + """ Override of the (void) default notification method. """ + stage_name = self.pool.get('project.task.type').name_get(cr, uid, [stage_id], context=context)[0][1] + return self.message_append_note(cr, uid, ids, body= _("Stage changed to <b>%s</b>.") % (stage_name), context=context) + def case_get_note_msg_prefix(self, cr, uid, id, context=None): - return 'Project issue ' + """ Override of default prefix for notifications. """ + return 'Project issue' def convert_to_task_send_note(self, cr, uid, ids, context=None): message = _("Project issue has been <b>converted</b> in to task.") diff --git a/addons/project_issue/project_issue_demo.xml b/addons/project_issue/project_issue_demo.xml index 358e9e55aa5..a213cb02c2e 100644 --- a/addons/project_issue/project_issue_demo.xml +++ b/addons/project_issue/project_issue_demo.xml @@ -7,7 +7,6 @@ <field eval=""5"" name="priority"/> <field name="user_id" ref="base.user_root"/> <field name="partner_id" ref="base.res_partner_agrolait"/> - <field eval=""open"" name="state"/> <field name="section_id" ref="crm.section_sales_department"/> <field eval="1" name="active"/> <field name="categ_id" ref="bug_categ"/> @@ -15,7 +14,7 @@ <field eval="15.0" name="duration"/> <field eval=""Bug in Accounts module"" name="name"/> <field eval=""agr@agrolait.com"" name="email_from"/> - <field name="type_id" ref="project.project_tt_specification"/> + <field name="stage_id" ref="project.project_tt_specification"/> </record> <record id="crm_case_programnotgivingproperoutput0" model="project.issue"> @@ -23,28 +22,26 @@ <field eval=""3"" name="priority"/> <field name="user_id" ref="base.user_root"/> <field name="partner_id" ref="base.res_partner_asus"/> - <field eval=""done"" name="state"/> <field name="section_id" ref="crm.section_sales_department"/> <field eval="1" name="active"/> <field eval="3.5" name="duration"/> <field name="categ_id" ref="bug_categ"/> <field eval=""Program not giving proper output"" name="name"/> <field name="project_id" ref="project.project_project_22"/> - <field name="type_id" ref="project.project_tt_specification"/> + <field name="stage_id" ref="project.project_tt_specification"/> </record> <record id="crm_case_outputincorrect0" model="project.issue"> <field eval="time.strftime('%Y-%m-18 14:30:00')" name="date"/> <field eval=""4"" name="priority"/> <field name="user_id" ref="base.user_demo"/> - <field eval=""cancel"" name="state"/> <field name="section_id" ref="crm.section_sales_department"/> <field eval="1" name="active"/> <field eval="2.3" name="duration"/> <field name="categ_id" ref="bug_categ"/> <field name="project_id" ref="project.project_project_23"/> <field eval=""Output incorrect"" name="name"/> - <field name="type_id" ref="project.project_tt_development"/> + <field name="stage_id" ref="project.project_tt_development"/> </record> <record id="crm_case_problemloadingpage0" model="project.issue"> @@ -52,14 +49,13 @@ <field eval=""3"" name="priority"/> <field name="user_id" ref="base.user_root"/> <field name="partner_id" ref="base.res_partner_14"/> - <field eval=""cancel"" name="state"/> <field name="section_id" ref="crm.section_sales_department"/> <field eval="1" name="active"/> <field eval="4.0" name="duration"/> <field name="categ_id" ref="bug_categ"/> <field name="project_id" ref="project.project_project_22"/> <field eval=""Problem loading page"" name="name"/> - <field name="type_id" ref="project.project_tt_testing"/> + <field name="stage_id" ref="project.project_tt_testing"/> </record> <record id="crm_case_pagenotfound0" model="project.issue"> @@ -67,14 +63,13 @@ <field eval=""3"" name="priority"/> <field name="user_id" ref="base.user_root"/> <field name="partner_id" ref="base.res_partner_desertic_hispafuentes"/> - <field eval=""draft"" name="state"/> <field name="section_id" ref="crm.section_sales_department"/> <field eval="1" name="active"/> <field eval="1.0" name="duration"/> <field name="categ_id" ref="bug_categ"/> <field name="project_id" ref="project.project_project_22"/> <field eval=""Page not Found"" name="name"/> - <field name="type_id" ref="project.project_tt_development"/> + <field name="stage_id" ref="project.project_tt_development"/> </record> <record id="crm_case_programmingerror0" model="project.issue"> @@ -82,14 +77,13 @@ <field eval=""3"" name="priority"/> <field name="user_id" ref="base.user_root"/> <field name="partner_id" ref="base.res_partner_5"/> - <field eval=""pending"" name="state"/> <field name="section_id" ref="crm.section_sales_department"/> <field eval="1" name="active"/> <field eval="4.0" name="duration"/> <field name="categ_id" ref="bug_categ"/> <field name="project_id" ref="project.project_project_22"/> <field eval=""Programming Error"" name="name"/> - <field name="type_id" ref="project.project_tt_testing"/> + <field name="stage_id" ref="project.project_tt_testing"/> </record> <record id="crm_case_logicalerrorinprogram0" model="project.issue"> @@ -97,14 +91,13 @@ <field eval=""2"" name="priority"/> <field name="user_id" ref="base.user_root"/> <field name="partner_id" ref="base.res_partner_6"/> - <field eval=""pending"" name="state"/> <field name="section_id" ref="crm.section_sales_department"/> <field eval="1" name="active"/> <field eval="2.0" name="duration"/> <field name="categ_id" ref="bug_categ"/> <field name="project_id" ref="project.project_project_9"/> <field eval=""Logical Error in Program"" name="name"/> - <field name="type_id" ref="project.project_tt_testing"/> + <field name="stage_id" ref="project.project_tt_testing"/> </record> <record id="crm_case_constrainterror0" model="project.issue"> @@ -112,14 +105,13 @@ <field eval=""2"" name="priority"/> <field name="user_id" ref="base.user_root"/> <field name="partner_id" ref="base.res_partner_6"/> - <field eval=""pending"" name="state"/> <field name="section_id" ref="crm.section_sales_department"/> <field eval="1" name="active"/> <field eval="7.3" name="duration"/> <field name="categ_id" ref="bug_categ"/> <field name="project_id" ref="project.project_project_9"/> <field eval=""Constraint Error"" name="name"/> - <field name="type_id" ref="project.project_tt_testing"/> + <field name="stage_id" ref="project.project_tt_testing"/> </record> <record id="crm_case_errorinprogram0" model="project.issue"> @@ -127,13 +119,12 @@ <field eval=""2"" name="priority"/> <field name="user_id" ref="base.user_demo"/> <field name="partner_id" ref="base.res_partner_5"/> - <field eval=""open"" name="state"/> <field eval="1" name="active"/> <field eval="1.3" name="duration"/> <field name="categ_id" ref="feature_request_categ"/> <field name="project_id" ref="project.project_project_22"/> <field eval=""Error in Program"" name="name"/> - <field name="type_id" ref="project.project_tt_testing"/> + <field name="stage_id" ref="project.project_tt_testing"/> </record> <record id="crm_case_patcheserrorinprogram0" model="project.issue"> @@ -141,14 +132,13 @@ <field eval=""2"" name="priority"/> <field name="user_id" ref="base.user_root"/> <field name="partner_id" ref="base.res_partner_2"/> - <field eval=""open"" name="state"/> <field name="section_id" ref="crm.section_sales_department"/> <field eval="1" name="active"/> <field eval="13.0" name="duration"/> <field name="categ_id" ref="feature_request_categ"/> <field name="project_id" ref="project.project_project_9"/> <field eval=""Patches Error in Program"" name="name"/> - <field name="type_id" ref="project.project_tt_testing"/> + <field name="stage_id" ref="project.project_tt_testing"/> </record> <record id="crm_case_newfeaturestobeadded0" model="project.issue"> @@ -156,14 +146,13 @@ <field eval=""4"" name="priority"/> <field name="user_id" ref="base.user_root"/> <field name="partner_id" ref="base.res_partner_maxtor"/> - <field eval=""open"" name="state"/> <field name="section_id" ref="crm.section_sales_department"/> <field eval="1" name="active"/> <field eval="3.2" name="duration"/> <field name="categ_id" ref="feature_request_categ"/> <field name="project_id" ref="project.project_project_21"/> <field eval=""New Features To Be Added"" name="name"/> - <field name="type_id" ref="project.project_tt_merge"/> + <field name="stage_id" ref="project.project_tt_merge"/> </record> <record id="crm_case_addmenustothemodule0" model="project.issue"> @@ -171,7 +160,6 @@ <field eval=""1"" name="priority"/> <field name="user_id" ref="base.user_demo"/> <field name="partner_id" ref="base.res_partner_9"/> - <field eval=""done"" name="state"/> <field name="section_id" ref="crm.section_sales_department"/> <field eval="1" name="active"/> <field eval="3.0" name="duration"/> @@ -179,7 +167,7 @@ <field name="project_id" ref="project.project_project_21"/> <field eval=""Add menus to the module"" name="name"/> <field eval=""info@opensides.be"" name="email_from"/> - <field name="type_id" ref="project.project_tt_development"/> + <field name="stage_id" ref="project.project_tt_development"/> </record> <record id="crm_case_includeattendancesheetinproject0" model="project.issue"> @@ -187,7 +175,6 @@ <field eval=""3"" name="priority"/> <field name="user_id" ref="base.user_root"/> <field name="partner_id" ref="base.res_partner_10"/> - <field eval=""cancel"" name="state"/> <field name="section_id" ref="crm.section_sales_department"/> <field eval="1" name="active"/> <field eval="2.0" name="duration"/> @@ -195,7 +182,7 @@ <field name="project_id" ref="project.project_project_9"/> <field eval=""Include Attendance sheet in Project"" name="name"/> <field eval=""contact@tecsas.fr"" name="email_from"/> - <field name="type_id" ref="project.project_tt_development"/> + <field name="stage_id" ref="project.project_tt_development"/> </record> <record id="crm_case_createnewobject0" model="project.issue"> @@ -203,14 +190,13 @@ <field eval=""3"" name="priority"/> <field name="user_id" ref="base.user_root"/> <field name="partner_id" ref="base.res_partner_6"/> - <field eval=""draft"" name="state"/> <field name="section_id" ref="crm.section_sales_department"/> <field eval="1" name="active"/> <field eval="2.45" name="duration"/> <field name="categ_id" ref="feature_request_categ"/> <field name="project_id" ref="project.project_project_22"/> <field eval=""Create new object"" name="name"/> - <field name="type_id" ref="project.project_tt_specification"/> + <field name="stage_id" ref="project.project_tt_specification"/> </record> <record id="crm_case_improvereportsinhrms0" model="project.issue"> @@ -218,14 +204,13 @@ <field eval=""4"" name="priority"/> <field name="user_id" ref="base.user_root"/> <field name="partner_id" ref="base.res_partner_11"/> - <field eval=""pending"" name="state"/> <field name="section_id" ref="crm.section_sales_department"/> <field eval="1" name="active"/> <field eval="15.0" name="duration"/> <field name="categ_id" ref="feature_request_categ"/> <field name="project_id" ref="project.project_project_22"/> <field eval=""Improve Reports in HRMS"" name="name"/> - <field name="type_id" ref="project.project_tt_development"/> + <field name="stage_id" ref="project.project_tt_development"/> </record> <record id="crm_case_improvereportsinpms0" model="project.issue"> @@ -233,14 +218,13 @@ <field eval=""2"" name="priority"/> <field name="user_id" ref="base.user_demo"/> <field name="partner_id" ref="base.res_partner_11"/> - <field eval=""pending"" name="state"/> <field name="section_id" ref="crm.section_sales_department"/> <field eval="1" name="active"/> <field eval="06.15" name="duration"/> <field name="categ_id" ref="feature_request_categ"/> <field name="project_id" ref="project.project_project_22"/> <field eval=""Improve Reports in PMS"" name="name"/> - <field name="type_id" ref="project.project_tt_specification"/> + <field name="stage_id" ref="project.project_tt_specification"/> </record> </data> diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml index 716a02f2f60..c3b4bf184be 100644 --- a/addons/project_issue/project_issue_view.xml +++ b/addons/project_issue/project_issue_view.xml @@ -52,14 +52,26 @@ <field name="arch" type="xml"> <form layout="manual"> <div class="oe_form_topbar"> - <button name="case_open" string="Open" states="draft,pending" type="object"/> - <button name="case_close" string="Done" states="open,draft,pending" type="object"/> - <button name="case_pending" string="Pending" states="draft,open" type="object"/> - <button name="case_reset" string="Reset to New" states="done,cancel" type="object"/> - <button name="case_escalate" string="Escalate" states="open,draft,pending" type="object"/> - <button name="case_cancel" string="Cancel" states="draft,open,pending" type="object"/> + <button name="case_open" string="Open" type="object" + states="draft,pending"/> + <button name="case_close" string="Done" type="object" + states="draft,open,pending"/> + <button name="case_pending" string="Pending" type="object" + states="draft,open"/> + <button name="case_escalate" string="Escalate" type="object" + states="draft,open,pending"/> + <button name="case_reset" string="Reset to New" type="object" + states="cancelled,done"/> + <button name="stage_previous" string="Previous Stage" type="object" + states="open,pending" icon="gtk-go-back" + attrs="{'invisible': [('stage_id','=', False)]}"/> + <button name="stage_next" string="Next Stage" type="object" + states="open,pending" icon="gtk-go-forward" + attrs="{'invisible': [('stage_id','=', False)]}"/> + <button name="case_cancel" string="Cancel" type="object" + states="draft,open,pending"/> <div class="oe_right"> - <field name="state" nolabel="1" widget="statusbar" statusbar_visible="draft,open,done" statusbar_colors='{"pending":"blue"}'/> + <field name="stage_id" nolabel="1" widget="statusbar"/> </div> <div class="oe_clear"/> </div> @@ -75,11 +87,7 @@ </group> <field name="user_id"/> <field name="version_id" colspan="2" widget="selection"/> - <group colspan="2" col="4"> - <field name="type_id" string="Stages" /> - <button name="prev_type" string="Previous" type="object" icon="gtk-go-back" help="Change to Previous Stage"/> - <button name="next_type" string="Next" type="object" icon="gtk-go-forward" help="Change to Next Stage"/> - </group> + <field name="state" groups="base.group_no_one"/> </group> <notebook colspan="4"> <page string="General"> @@ -138,19 +146,23 @@ <field name="partner_id"/> <field name="project_id" /> <field name="priority" string="Priority"/> - <field name="type_id" widget="selection" readonly="1" string="Stages" /> - <button name="prev_type" string="Previous" type="object" icon="gtk-go-back" help="Change to Previous Stage"/> - <button name="next_type" string="Next" type="object" icon="gtk-go-forward" help="Change to Next Stage"/> <field name="version_id" widget="selection"/> <field name="user_id"/> <field name="progress" widget="progressbar" attrs="{'invisible':[('task_id','=',False)]}"/> - <field name="state"/> - <button name="case_cancel" string="Cancel" states="draft,open,pending" type="object" icon="gtk-cancel"/> - <button name="case_close" string="Done" states="open,draft,pending" type="object" icon="gtk-jump-to"/> - <button name="case_open" string="Open" states="draft,pending" type="object" icon="gtk-go-forward" help="To Do"/> - <button name="case_pending" string="Pending" states="draft,open" type="object" icon="gtk-media-pause"/> - <button name="case_escalate" string="Escalate" states="open,draft,pending" type="object" icon="gtk-go-up"/> - <button name="case_reset" string="Reset to New" states="done,cancel" type="object" icon="gtk-convert"/> + <field name="stage_id" widget="selection" readonly="1"/> + <button name="stage_previous" string="Previous" type="object" + icon="gtk-go-back" help="Change to Previous Stage" + attrs="{'invisible': [('stage_id','=', False)]}"/> + <button name="stage_next" string="Next" type="object" + icon="gtk-go-forward" help="Change to Next Stage" + attrs="{'invisible': [('stage_id','=', False)]}"/> + <field name="state" groups="base.group_no_one"/> + <button name="case_open" string="Open" type="object" + icon="gtk-go-forward" states="draft,pending"/> + <button name="case_close" string="Done" type="object" + icon="gtk-close" states="draft,open,pending"/> + <button name="case_cancel" string="Cancel" type="object" + icon="gtk-cancel" states="draft,open,pending"/> <field name="categ_id" invisible="1"/> <field name="task_id" invisible="1"/> </tree> @@ -192,7 +204,7 @@ <filter string="Priority" icon="terp-rating-rated" domain="[]" context="{'group_by':'priority'}" /> <filter string="Stage" icon="terp-stage" domain="[]" - context="{'group_by':'type_id'}" /> + context="{'group_by':'stage_id'}" /> <filter string="Status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}" /> <separator orientation="vertical" /> @@ -224,9 +236,9 @@ <field name="model">project.issue</field> <field name="type">kanban</field> <field name="arch" type="xml"> - <kanban default_group_by="type_id"> + <kanban default_group_by="stage_id"> <field name="color"/> - <field name="state"/> + <field name="state" groups="base.group_no_one"/> <field name="priority"/> <field name="user_email"/> <field name="user_id"/> @@ -270,8 +282,7 @@ <a string="Convert To Task" name="convert_issue_task" icon="gtk-index" type="object"/> </div> <div class="oe_kanban_right"> - <a name="case_open" string="Open" states="draft,pending" type="object" icon="kanban-apply" /> - <a name="case_pending" string="Pending" states="draft,open" type="object" icon="kanban-pause"/> + <a name="case_open" string="Open" states="draft,pending" type="object" icon="kanban-apply"/> <a name="case_close" string="Close" states="open,draft,pending" type="object" icon="kanban-stop"/> </div> <div class="oe_kanban_clear"/> @@ -304,18 +315,22 @@ <field name="name" string="Feature description"/> <field name="partner_id"/> <field name="priority" string="Priority"/> - <field name="type_id" widget="selection" readonly="1"/> - <button name="prev_type" string="Previous" type="object" icon="gtk-go-back" help="Change to Previous Stage"/> - <button name="next_type" string="Next" type="object" icon="gtk-go-forward" help="Change to Next Stage"/> <field name="version_id"/> <field name="user_id"/> - <field name="state"/> - <button name="case_cancel" string="Cancel" states="draft,open,pending" type="object" icon="gtk-cancel"/> - <button name="case_close" string="Done" states="open,draft,pending" type="object" icon="gtk-jump-to"/> - <button name="case_open" string="Open" states="draft,pending" type="object" icon="gtk-go-forward"/> - <button name="case_pending" string="Pending" states="draft,open" type="object" icon="gtk-media-pause"/> - <button name="case_escalate" string="Escalate" states="open,draft,pending" type="object" icon="gtk-go-up"/> - <button name="case_reset" string="Reset to New" states="done,cancel" type="object" icon="gtk-convert"/> + <field name="stage_id" widget="selection" readonly="1"/> + <button name="stage_previous" string="Previous" type="object" + icon="gtk-go-back" help="Change to Previous Stage" + attrs="{'invisible': [('stage_id','=', False)]}"/> + <button name="stage_next" string="Next" type="object" + icon="gtk-go-forward" help="Change to Next Stage" + attrs="{'invisible': [('stage_id','=', False)]}"/> + <field name="state" groups="base.group_no_one"/> + <button name="case_open" string="Open" type="object" + states="draft,pending" icon="gtk-go-forward"/> + <button name="case_close" string="Done" type="object" + states="draft,open,pending" icon="gtk-close"/> + <button name="case_cancel" string="Cancel" type="object" + states="draft,open,pending" icon="gtk-cancel"/> </tree> </field> </record> @@ -326,13 +341,13 @@ <field name="type">search</field> <field name="arch" type="xml"> <search string="Feature Tracker Search"> - <filter icon="terp-go-today" string="Today" + <filter icon="terp-go-today" string="Today" domain="[('date','=',time.strftime('%%Y-%%m-%%d'))]" help="Today's features"/> <separator orientation="vertical"/> <group> <field name="name" string="Feature description"/> <field name="user_id"/> - <field name="state"> + <field name="state" groups="base.group_no_one"> <filter icon="terp-check" domain="[('state','in',('open','draft'))]" help="Current Features" name="current_feature"/> <filter icon="terp-camera_test" domain="[('state','=','open')]" help="Open Features"/> </field> diff --git a/addons/project_issue/report/project_issue_report.py b/addons/project_issue/report/project_issue_report.py index 7cc520308e8..be3309d7175 100644 --- a/addons/project_issue/report/project_issue_report.py +++ b/addons/project_issue/report/project_issue_report.py @@ -51,7 +51,7 @@ class project_issue_report(osv.osv): 'creation_date': fields.date('Creation Date', readonly=True), 'date_closed': fields.date('Date of Closing', readonly=True), 'categ_id': fields.many2one('crm.case.categ', 'Category', domain="[('section_id','=',section_id),('object_id.model', '=', 'project.issue')]"), - 'type_id': fields.many2one('project.task.type', 'Stage'), + '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), 'working_hours_close': fields.float('Avg. Working Hours to Close', readonly=True), @@ -87,7 +87,7 @@ class project_issue_report(osv.osv): c.working_hours_close, c.section_id, c.categ_id, - c.type_id, + c.stage_id, to_char(c.date_closed, 'YYYY-mm-dd') as date_closed, c.company_id as company_id, c.priority as priority, diff --git a/addons/project_issue/report/project_issue_report_view.xml b/addons/project_issue/report/project_issue_report_view.xml index ee0a4fbd1ed..43a49abf2b8 100644 --- a/addons/project_issue/report/project_issue_report_view.xml +++ b/addons/project_issue/report/project_issue_report_view.xml @@ -11,7 +11,7 @@ <field name="name" invisible="1"/> <field name="month" invisible="1"/> <field name="project_id" invisible="1"/> - <field name="type_id" invisible="1"/> + <field name="stage_id" invisible="1"/> <field name="version_id" string="Version" invisible="1"/> <field name="priority" invisible="1"/> <field name="company_id" invisible="1" groups="base.group_multi_company"/> @@ -103,7 +103,7 @@ <filter string="Version" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'version_id'}"/> <separator orientation="vertical" /> <filter string="Priority" icon="terp-rating-rated" domain="[]" context="{'group_by':'priority'}" /> - <filter string="Stage" icon="terp-stage" domain="[]" context="{'group_by':'type_id'}"/> + <filter string="Stage" icon="terp-stage" domain="[]" context="{'group_by':'stage_id'}"/> <filter string="Status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}" /> <separator orientation="vertical"/> diff --git a/addons/project_issue/test/cancel_issue.yml b/addons/project_issue/test/cancel_issue.yml index ff05d923ed0..76ffa212638 100644 --- a/addons/project_issue/test/cancel_issue.yml +++ b/addons/project_issue/test/cancel_issue.yml @@ -7,7 +7,7 @@ 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 == 'cancel' + - state == 'cancelled' - I re-open the Issue. - @@ -37,7 +37,7 @@ 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 == 'cancel' + - state == 'cancelled' - I close Issue. - @@ -57,4 +57,4 @@ 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 == 'cancel'
\ No newline at end of file + - state == 'cancelled' |
