From c8b6f2f370a1e084b2cf04b4a7b56931e3900def Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 27 Jun 2013 13:07:33 +0200 Subject: [PATCH] [REF] project_issue: removed reference to base_stage, removed some unnecessary defaults, removed now unnecessary tests. bzr revid: tde@openerp.com-20130627110733-8zh0xooq71zz2g0j --- addons/project_issue/__openerp__.py | 1 - addons/project_issue/project_issue.py | 16 +++--- addons/project_issue/test/cancel_issue.yml | 60 --------------------- addons/project_issue/test/issue_process.yml | 42 +-------------- 4 files changed, 7 insertions(+), 112 deletions(-) delete mode 100644 addons/project_issue/test/cancel_issue.yml 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/project_issue.py b/addons/project_issue/project_issue.py index ab7d9824fc6..7a7d0724161 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -20,7 +20,6 @@ ############################################################################## from openerp import SUPERUSER_ID -from openerp.addons.base_status.base_stage import base_stage from openerp.addons.crm import crm from datetime import datetime from openerp.osv import fields, osv, orm @@ -29,7 +28,7 @@ import time from openerp import tools from openerp.tools import html2plaintext -class project_issue_version(osv.osv): +class project_issue_version(osv.Model): _name = "project.issue.version" _order = "name desc" _columns = { @@ -40,7 +39,7 @@ 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" @@ -51,9 +50,9 @@ class project_issue(base_stage, osv.osv): '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, - }, + # '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', }, @@ -293,10 +292,7 @@ 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', @@ -552,7 +548,7 @@ class project_issue(base_stage, osv.osv): if context is None: 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: + if thread_id and subtype: self.write(cr, SUPERUSER_ID, thread_id, {'date_action_last': fields.datetime.now()}, context=context) return res 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,23 +1,3 @@ -- - 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). - @@ -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'