[IMP] crm: add assignment optout test

Add a test ensuring ``assignment_optout`` works as intended. Salespersons
being opt-out from assign process should not receive any leads. This replaces
setting ``assignment_max`` to 0 (which is still a working trick). This commit
is a followup of odoo/odoo#68476 (done in a rush), and done in a specific
commit to avoid messing with forward-port.

Task ID-2497077
COM PR odoo/odoo#70664

X-original-commit: 813016e77b6abf9032059725a8725f693b132b58
This commit is contained in:
Thibault Delavallée
2021-05-12 14:23:55 +00:00
parent eca1b7aeaf
commit c6cba59de8
@@ -151,6 +151,8 @@ class TestLeadAssign(TestLeadAssignCommon):
self.members.invalidate_cache(fnames=['lead_month_count'])
self.assertEqual(self.sales_team_1_m3.lead_month_count, 12)
# sales_team_1_m2 is opt-out (new field in 14.3) -> even with max, no lead assigned
self.sales_team_1_m2.update({'assignment_max': 45, 'assignment_optout': True})
with self.with_user('user_sales_manager'):
self.env['crm.team'].browse(self.sales_team_1.ids)._action_assign_leads(work_days=4)