From e7653c86aad8a1e05dd330249886afe1a016963d Mon Sep 17 00:00:00 2001 From: Paul Stroobant Date: Wed, 7 Feb 2024 14:14:02 +0100 Subject: [PATCH] [FIX] crm: restrict opportunity merge salesperson choice Steps to reproduce issue: 1. Open CRM and select a list/tree view (opportunities or leads) 2. Select multiple records and try merging them (gear menu) 3. Click on salesperson field 4. Field dropdown contains portal users, should not be the case Explanation: `user_id` (salesperson field) in `crm.merge.opportunity` is a many2one related to res.users. Since it is not restricted, every existing user is listed in the selection. Suggested fix: In `crm.lead`, its homologous field possesses the domain formula `('share', '=', False)`. https://github.com/odoo/odoo/blob/f987dd26e928bd0394cd0b835cc1d0fdd72e9234/addons/crm/models/crm_lead.py#L105-L108 Copying it into `crm.merge.opportunity` correctly restricts the users selection. opw-3696148 closes odoo/odoo#153230 X-original-commit: e43d13d8aae2b46107237102e9f45a4c8e8e39df Signed-off-by: Stroobant Paul (stpa) --- addons/crm/wizard/crm_merge_opportunities.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/wizard/crm_merge_opportunities.py b/addons/crm/wizard/crm_merge_opportunities.py index bea072b69da..9ec723b0b99 100644 --- a/addons/crm/wizard/crm_merge_opportunities.py +++ b/addons/crm/wizard/crm_merge_opportunities.py @@ -33,7 +33,7 @@ class MergeOpportunity(models.TransientModel): return result opportunity_ids = fields.Many2many('crm.lead', 'merge_opportunity_rel', 'merge_id', 'opportunity_id', string='Leads/Opportunities') - user_id = fields.Many2one('res.users', 'Salesperson') + user_id = fields.Many2one('res.users', 'Salesperson', domain="[('share', '=', False)]") team_id = fields.Many2one( 'crm.team', 'Sales Team', compute='_compute_team_id', readonly=False, store=True)