diff options
| author | Thibault Delavallée <tde@openerp.com> | 2013-06-26 17:52:17 +0200 |
|---|---|---|
| committer | Thibault Delavallée <tde@openerp.com> | 2013-06-26 17:52:17 +0200 |
| commit | a497545cfdd5a4d74ca7b6797a6c697e75ee14d3 (patch) | |
| tree | d797911970e71c0aa51074c2c8bafda3713092a9 | |
| parent | 362aabce1a03b3dabdbbb1c168b7b11672462668 (diff) | |
[REF] project_issue: removed state concept, updated views + reports + tracking.
bzr revid: tde@openerp.com-20130626155217-333zsa7hj8wjckcn
| -rw-r--r-- | addons/portal_project_issue/portal_project_issue_view.xml | 2 | ||||
| -rw-r--r-- | addons/project/report/project_report.py | 5 | ||||
| -rw-r--r-- | addons/project_issue/board_project_issue_view.xml | 5 | ||||
| -rw-r--r-- | addons/project_issue/project_issue.py | 49 | ||||
| -rw-r--r-- | addons/project_issue/project_issue_data.xml | 27 | ||||
| -rw-r--r-- | addons/project_issue/project_issue_view.xml | 27 | ||||
| -rw-r--r-- | addons/project_issue/report/project_issue_report.py | 11 | ||||
| -rw-r--r-- | addons/project_issue/report/project_issue_report_view.xml | 14 |
8 files changed, 44 insertions, 96 deletions
diff --git a/addons/portal_project_issue/portal_project_issue_view.xml b/addons/portal_project_issue/portal_project_issue_view.xml index 2750edf300f..c4f1e0aca57 100644 --- a/addons/portal_project_issue/portal_project_issue_view.xml +++ b/addons/portal_project_issue/portal_project_issue_view.xml @@ -26,7 +26,7 @@ </div> <div><field name="categ_ids" widget="many2many_tags" class="oe_left"/></div> <div class="oe_text_right"> - <h1><field name="state" readonly="1"/></h1> + <h1><field name="stage_id" readonly="1"/></h1> </div> </div> <div> diff --git a/addons/project/report/project_report.py b/addons/project/report/project_report.py index e7d431662b3..def0e0edd97 100644 --- a/addons/project/report/project_report.py +++ b/addons/project/report/project_report.py @@ -19,7 +19,6 @@ # ############################################################################## -from openerp.tools.misc import MONTHS from openerp.osv import fields, osv from openerp import tools @@ -38,7 +37,7 @@ class report_project_task_user(osv.osv): 'date_end': fields.date('Ending Date', readonly=True), 'date_deadline': fields.date('Deadline', readonly=True), 'date_last_stage_update': fields.date('Last Stage Update', readonly=True), - 'month_last_stage_update': fields.selection(MONTHS, 'Month of Last Stage Update', readonly=True), + 'month_last_stage_update': fields.selection(fields.date.MONTHS, 'Month of Last Stage Update', readonly=True), 'project_id': fields.many2one('project.project', 'Project', readonly=True), 'hours_planned': fields.float('Planned Hours', readonly=True), 'hours_effective': fields.float('Effective Hours', readonly=True), @@ -54,7 +53,7 @@ class report_project_task_user(osv.osv): 'nbr': fields.integer('# of tasks', readonly=True), 'priority': fields.selection([('4', 'Very Low'), ('3', 'Low'), ('2', 'Medium'), ('1', 'Urgent'), ('0', 'Very urgent')], string='Priority', readonly=True), - 'month':fields.selection(MONTHS, 'Month', readonly=True), + 'month':fields.selection(fields.date.MONTHS, '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), 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/project_issue.py b/addons/project_issue/project_issue.py index 4c89c4def60..30f8845fa40 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -25,7 +25,6 @@ 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 @@ -48,16 +47,15 @@ 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_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, }, 'kanban_state': { - 'project_issue.mt_issue_blocked': lambda self, cr, uid, obj, ctx=None: obj['kanban_state'] == 'blocked', + 'project_issue.mt_issue_blocked': lambda self, cr, uid, obj, ctx=None: obj.kanban_state == 'blocked', }, } @@ -80,7 +78,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' @@ -353,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) @@ -382,18 +380,12 @@ class project_issue(base_stage, osv.osv): context=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_action_last'] = 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) @@ -403,13 +395,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') @@ -458,11 +443,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: @@ -585,7 +565,8 @@ 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'): + # TDE CHECK: 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..f8c006beaff 100644 --- a/addons/project_issue/project_issue_data.xml +++ b/addons/project_issue/project_issue_data.xml @@ -1,6 +1,7 @@ <?xml version="1.0"?> <openerp> - <data noupdate="1"> + <!-- <data noupdate="1"> --> + <data> <!-- Case type_id --> <!-- For Bugs --> @@ -35,11 +36,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 +48,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 +62,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 +75,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..8a535e3bc96 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,15 @@ <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"/> - <separator/> - <filter string="Unassigned Issues" domain="[('user_id','=',False)]" help="Unassigned Issues" icon="terp-personal-"/> - <separator/> <field name="user_id"/> <field name="project_id"/> <field name="categ_ids"/> <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="Unread Messages" name="message_unread" domain="[('message_unread','=',True)]"/> + <separator/> <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 +259,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 +268,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..48c3628832a 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,7 +31,6 @@ 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'), \ @@ -80,7 +72,6 @@ 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, 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..a2956bd0999 100644 --- a/addons/project_issue/report/project_issue_report_view.xml +++ b/addons/project_issue/report/project_issue_report_view.xml @@ -20,7 +20,6 @@ <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="day" invisible="1"/> <field name="nbr" string="#Project Issues" sum="#Number of Project Issues"/> <field name="delay_open" avg="Avg Opening Delay"/> @@ -36,9 +35,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 +48,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'}" /> |
