diff --git a/addons/project_issue/__openerp__.py b/addons/project_issue/__openerp__.py index e77499df3d0..f57b8233878 100644 --- a/addons/project_issue/__openerp__.py +++ b/addons/project_issue/__openerp__.py @@ -54,8 +54,12 @@ and decide on their status as they evolve. ], 'demo_xml': ['project_issue_demo.xml'], 'test': [ - 'test/convert_issue_to_task.yml', - 'test/test_project_issue_states.yml' + #'test/convert_issue_to_task.yml', + #'test/test_project_issue_states.yml' + 'test/subscribe_issue.yml', + 'test/draft2open2close.yml', + 'test/cancel_issue.yml', + 'test/issue_demo.yml' ], 'installable': True, 'active': False, diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index b83efbc4996..88319e486ef 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -294,7 +294,7 @@ class project_issue(crm.crm_case, osv.osv): data_obj = self.pool.get('ir.model.data') task_obj = self.pool.get('project.task') - + if context is None: context = {} @@ -306,7 +306,7 @@ class project_issue(crm.crm_case, osv.osv): id2 = data_obj.browse(cr, uid, id2, context=context).res_id if id3: id3 = data_obj.browse(cr, uid, id3, context=context).res_id - + for bug in case_obj.browse(cr, uid, ids, context=context): new_task_id = task_obj.create(cr, uid, { 'name': bug.name, @@ -314,7 +314,7 @@ class project_issue(crm.crm_case, osv.osv): 'description':bug.description, 'date': bug.date, 'project_id': bug.project_id.id, - 'priority': bug.priority, + 'priority': tools.ustr(int(bug.priority) - 1), 'user_id': bug.user_id.id, 'planned_hours': 0.0, }) @@ -324,7 +324,6 @@ class project_issue(crm.crm_case, osv.osv): 'state':'pending' } case_obj.write(cr, uid, [bug.id], vals) - return { 'name': _('Tasks'), 'view_type': 'form', diff --git a/addons/project_issue/test/cancel_issue.yml b/addons/project_issue/test/cancel_issue.yml new file mode 100644 index 00000000000..ff05d923ed0 --- /dev/null +++ b/addons/project_issue/test/cancel_issue.yml @@ -0,0 +1,60 @@ +- + 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 == 'cancel' +- + 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 == 'cancel' +- + 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 == 'cancel' \ No newline at end of file diff --git a/addons/project_issue/test/draft2open2close.yml b/addons/project_issue/test/draft2open2close.yml new file mode 100644 index 00000000000..4614bed3997 --- /dev/null +++ b/addons/project_issue/test/draft2open2close.yml @@ -0,0 +1,57 @@ +- + 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. +- + !python {model: mail.compose.message }: | + ctx = context.copy() + ctx.update({'active_model': 'project.issue', 'active_id': ref("crm_case_buginaccountsmodule0"), 'active_ids': [ref("crm_case_buginaccountsmodule0")]}) + vals = self.default_get(cr, uid , [], context=ctx) + try: + new_id = self.create(cr, uid, {'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' +- + 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' \ No newline at end of file diff --git a/addons/project_issue/test/issue.eml b/addons/project_issue/test/issue.eml new file mode 100644 index 00000000000..32659bbd7da --- /dev/null +++ b/addons/project_issue/test/issue.eml @@ -0,0 +1,45 @@ +Return-Path: +X-Original-To: abc@mycompany.com +Delivered-To: abc@mycompany.com +Received: by mail1.mycompany.com (Postfix, from userid 10002) + id 3955EBFACA; Tue, 29 Nov 2011 08:14:47 +0100 (CET) +X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail1.mycompany.com +X-Spam-Level: +X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, + RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 +Received: from nm39-vm6.bullet.mail.ne1.yahoo.com (nm39-vm6.bullet.mail.ne1.yahoo.com [98.138.229.166]) + by mail1.mycompany.com (Postfix) with SMTP id 0D074BF53A + for ; Tue, 29 Nov 2011 08:14:44 +0100 (CET) +Received: from [98.138.90.54] by nm39.bullet.mail.ne1.yahoo.com with NNFMP; 29 Nov 2011 07:13:26 -0000 +Received: from [98.138.84.39] by tm7.bullet.mail.ne1.yahoo.com with NNFMP; 29 Nov 2011 07:13:26 -0000 +Received: from [127.0.0.1] by smtp107.mail.ne1.yahoo.com with NNFMP; 29 Nov 2011 07:13:26 -0000 +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.in; s=s1024; t=1322550806; bh=LFefFqrky41IufKZHP8a86obZoBPxyX1aafgWNcrw7U=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Content-Transfer-Encoding; b=NB8bd6b4Uk3/3fKhdzbcqFEZGPpKyotLeE0xh8H08rcFEahMFfY5uXgsYZsUFvTLCKfTyQWh/oPTVxHeUTGY/Y5MzAnndghX6S0mzlFtmW2dwLMqdWxQLZwU7EhbyYF9PCHicsmtlUVyo7Ou5ePSviqC0SOyCJJVWwzWlv5W9Zg= +X-Yahoo-Newman-Id: 152218.10448.bm@smtp107.mail.ne1.yahoo.com +X-Yahoo-Newman-Property: ymail-3 +X-YMail-OSG: i4zQqJUVM1mab8kxoCTmgMwxw9th.MdiJzmc4Ffbno7QGkl + acotmc0pGoiw_GrhwReSA6uNIveeAUi9WA6NniWAElxbUzGIQplTBHjRhdqF + d_rLG1Yn71DYxllLCZC8xoRzumVHw.kue0ymrl4D0VO.lEeyXbbYoz.TpAvu + ZASBwSV_mESEUu96bb1esfOjI_2MhibMNmt.2egkOG6LS3AcDkVWXJb.VpQe + yZieJ5djjUx9uu4HModjROSUWHKm3Qd5ZwvG.3s1JvHNNvPC3Mo6x.DXi_rj + d70J2pruXhJ9ZnbNooZiSHkrhaugWV.kquq6475ZxKP6Tu7G8iUgZUkHWCf. + aEdBFl2.4RanSkMohEfbNtwpXUQ0eDDOOPatHFB27JSP0jw-- +X-Yahoo-SMTP: oNtzSBqswBAqJIGYOgyGesyleENrhUEtEgBkQ053 +Received: from [192.168.1.30] (Robert_Adersen@180.211.100.2 with plain) + by smtp107.mail.ne1.yahoo.com with SMTP; 28 Nov 2011 23:13:25 -0800 PST +Message-ID: <4ED48611.6070605@yahoo.in> +Date: Tue, 29 Nov 2011 12:43:21 +0530 +From: Robert Adersen +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 +MIME-Version: 1.0 +To: abc@mycompany.com +Subject: Error in the account module +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Hello Sir, + +I am using the openerp v6.1 and i have problem in hr module, so try to +check it and solve my problem. + +thanks +Robert Adersen diff --git a/addons/project_issue/test/issue_demo.yml b/addons/project_issue/test/issue_demo.yml new file mode 100644 index 00000000000..1ad26e6db73 --- /dev/null +++ b/addons/project_issue/test/issue_demo.yml @@ -0,0 +1,8 @@ +- + !record {model: project.issue, id: project_task_1, view: False}: + task_id: 'project.project_task_17' + name: 'Error in account module' +- + !record {model: project.issue, id: project01, view: False}: + project_id: 'project.project_project_9' + name: 'OpenERP Integration' diff --git a/addons/project_issue/test/subscribe_issue.yml b/addons/project_issue/test/subscribe_issue.yml new file mode 100644 index 00000000000..4ba472b41ed --- /dev/null +++ b/addons/project_issue/test/subscribe_issue.yml @@ -0,0 +1,17 @@ +- + In Order to test process of Issue in OpenERP, Custmer send the issue by email. +- + !python {model: mail.thread}: | + import addons + request_file = open(addons.get_module_resource('project_issue','test', 'issue.eml'),'rb') + request_message = request_file.read() + self.message_process(cr, uid, 'project.issue', request_message) +- + After getting the mail, I check details of new issue of that customer. +- + !python {model: project.issue}: | + issue_ids = self.search(cr, uid, [('email_from', '=', 'Robert Adersen ')]) + assert issue_ids and len(issue_ids), "issue is not created after getting request" + issue = self.browse(cr, uid, issue_ids[0], context=context) + assert not issue.partner_id, "Customer should be a new" + assert issue.name == "Error in the account module", "Subject does not match" \ No newline at end of file