Files
odoo_source/addons/crm/tests/test_sales_team_ui.py
T
Aurélien Warnon f43b9e01c2 [FIX] sales_team: allow creating team in mono-company mode
Currently, adding members in a sales.team without the multi-company group is
not possible, the selection does not show any users.

This is because the domain field for the users search ("member_company_ids") is
not computed as none of its triggers are present in the view.

To fix this, we add the 'name' field as a fake trigger to force the
computation.

Side-note: the tour was added into the CRM module as we require this module to
have entry menus into crm.team form views.

Task-3088861

closes odoo/odoo#107352

X-original-commit: 11d24d8757a74cdf4af433bdc735460e68ba6cd2
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-12-06 19:09:39 +01:00

27 lines
1.0 KiB
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import tests
from odoo.tests import HttpCase
from odoo.tests.common import users
from odoo.addons.sales_team.tests.common import SalesTeamCommon
@tests.tagged('post_install', '-at_install')
class TestUi(HttpCase, SalesTeamCommon):
@users('salesmanager')
def test_crm_team_members_mono_company(self):
""" Make sure you can create crm.team records with members in a mono-company scenario """
self.sale_manager.sudo().groups_id -= self.env.ref("base.group_multi_company")
self.env['ir.config_parameter'].sudo().set_param('sales_team.membership_multi', True)
self.start_tour("/", "create_crm_team_tour", login="salesmanager")
created_team = self.env["crm.team"].search([("name", "=", "My CRM Team")])
self.assertTrue(bool(created_team))
self.assertEqual(
created_team.member_ids,
self.sale_user | self.sale_manager
)