62 lines
2.5 KiB
Python
62 lines
2.5 KiB
Python
|
# -*- coding: utf-8 -*-
|
||
|
|
||
|
from odoo.addons.mail.tests.common import TestMail
|
||
|
|
||
|
|
||
|
class TestProjectBase(TestMail):
|
||
|
|
||
|
@classmethod
|
||
|
def setUpClass(cls):
|
||
|
super(TestProjectBase, cls).setUpClass()
|
||
|
|
||
|
user_group_employee = cls.env.ref('base.group_user')
|
||
|
user_group_project_user = cls.env.ref('project.group_project_user')
|
||
|
user_group_project_manager = cls.env.ref('project.group_project_manager')
|
||
|
|
||
|
# Test users to use through the various tests
|
||
|
Users = cls.env['res.users'].with_context({'no_reset_password': True})
|
||
|
cls.user_projectuser = Users.create({
|
||
|
'name': 'Armande ProjectUser',
|
||
|
'login': 'Armande',
|
||
|
'email': 'armande.projectuser@example.com',
|
||
|
'groups_id': [(6, 0, [user_group_employee.id, user_group_project_user.id])]
|
||
|
})
|
||
|
cls.user_projectmanager = Users.create({
|
||
|
'name': 'Bastien ProjectManager',
|
||
|
'login': 'bastien',
|
||
|
'email': 'bastien.projectmanager@example.com',
|
||
|
'groups_id': [(6, 0, [user_group_employee.id, user_group_project_manager.id])]})
|
||
|
|
||
|
# Test 'Pigs' project
|
||
|
cls.project_pigs = cls.env['project.project'].with_context({'mail_create_nolog': True}).create({
|
||
|
'name': 'Pigs',
|
||
|
'privacy_visibility': 'employees',
|
||
|
'alias_name': 'project+pigs',
|
||
|
'partner_id': cls.partner_1.id})
|
||
|
# Already-existing tasks in Pigs
|
||
|
cls.task_1 = cls.env['project.task'].with_context({'mail_create_nolog': True}).create({
|
||
|
'name': 'Pigs UserTask',
|
||
|
'user_id': cls.user_projectuser.id,
|
||
|
'project_id': cls.project_pigs.id})
|
||
|
cls.task_2 = cls.env['project.task'].with_context({'mail_create_nolog': True}).create({
|
||
|
'name': 'Pigs ManagerTask',
|
||
|
'user_id': cls.user_projectmanager.id,
|
||
|
'project_id': cls.project_pigs.id})
|
||
|
|
||
|
# Test 'Goats' project, same as 'Pigs', but with 2 stages
|
||
|
cls.project_goats = cls.env['project.project'].with_context({'mail_create_nolog': True}).create({
|
||
|
'name': 'Goats',
|
||
|
'privacy_visibility': 'followers',
|
||
|
'alias_name': 'project+goats',
|
||
|
'partner_id': cls.partner_1.id,
|
||
|
'type_ids': [
|
||
|
(0, 0, {
|
||
|
'name': 'New',
|
||
|
'sequence': 1,
|
||
|
}),
|
||
|
(0, 0, {
|
||
|
'name': 'Won',
|
||
|
'sequence': 10,
|
||
|
})]
|
||
|
})
|