summaryrefslogtreecommitdiff
path: root/addons/crm/tests
diff options
context:
space:
mode:
authorThibault Delavallée <tde@odoo.com>2020-04-06 12:57:16 +0000
committerThibault Delavallée <tde@odoo.com>2020-04-14 11:53:16 +0000
commit2d0db1a0bf57bc70a5a5a18771154be322d436b9 (patch)
treef1142ad5394ee73e5c282f954a3d242a499aa4bc /addons/crm/tests
parent150095ebc7ef112a03f3e6a4704e06cde6e7c5f0 (diff)
[IMP] sales_team, crm: clean sales team tests and extract common test data from crm
PURPOSE Prepare enhancements of sales team membership. SPECIFICATIONS Purpose of this commit is to prepare modifications in sales team management notably by cleaning sales team tests. We also move some data preparation in sales team. It allows to rely on some common data while doing sales team then crm tests. LINKS Task ID 2086889 (sales team enhancements) Task ID 2234698 (preparation lint) Community PR odoo/odoo#49520
Diffstat (limited to 'addons/crm/tests')
-rw-r--r--addons/crm/tests/common.py36
1 files changed, 7 insertions, 29 deletions
diff --git a/addons/crm/tests/common.py b/addons/crm/tests/common.py
index c1171e4c44d..ce936bb2e3b 100644
--- a/addons/crm/tests/common.py
+++ b/addons/crm/tests/common.py
@@ -4,8 +4,8 @@
from unittest.mock import patch
from odoo.addons.mail.tests.common import MailCase, mail_new_test_user
+from odoo.addons.sales_team.tests.common import TestSalesCommon
from odoo.fields import Datetime
-from odoo.tests.common import SavepointCase
INCOMING_EMAIL = """Return-Path: {return_path}
X-Original-To: {to}
@@ -39,43 +39,21 @@ Cheers,
Somebody."""
-class TestCrmCommon(SavepointCase, MailCase):
+class TestCrmCommon(TestSalesCommon, MailCase):
@classmethod
def setUpClass(cls):
super(TestCrmCommon, cls).setUpClass()
cls._init_mail_gateway()
- cls.user_sales_manager = mail_new_test_user(
- cls.env, login='user_sales_manager',
- name='Martin Sales Manager', email='crm_manager@test.example.com',
- company_id=cls.env.ref("base.main_company").id,
- notification_type='inbox',
- groups='sales_team.group_sale_manager,base.group_partner_manager,crm.group_use_lead',
- )
- cls.user_sales_leads = mail_new_test_user(
- cls.env, login='user_sales_leads',
- name='Laetitia Sales Leads', email='crm_leads@test.example.com',
- company_id=cls.env.ref("base.main_company").id,
- notification_type='inbox',
- groups='sales_team.group_sale_salesman_all_leads,base.group_partner_manager,crm.group_use_lead',
- )
- cls.user_sales_salesman = mail_new_test_user(
- cls.env, login='user_sales_salesman',
- name='Orteil Sales Own', email='crm_salesman@test.example.com',
- company_id=cls.env.ref("base.main_company").id,
- notification_type='inbox',
- groups='sales_team.group_sale_salesman,crm.group_use_lead',
- )
-
- cls.sales_team_1 = cls.env['crm.team'].create({
- 'name': 'Test Sales Team',
+ cls.sales_team_1.write({
'alias_name': 'sales.test',
'use_leads': True,
'use_opportunities': True,
- 'company_id': False,
- 'user_id': cls.user_sales_manager.id,
- 'member_ids': [(4, cls.user_sales_leads.id), (4, cls.env.ref('base.user_admin').id)],
+ })
+
+ (cls.user_sales_manager | cls.user_sales_leads | cls.user_sales_salesman).write({
+ 'groups_id': [(4, cls.env.ref('crm.group_use_lead').id)]
})
cls.env['crm.stage'].search([]).write({'sequence': 9999}) # ensure search will find test data first