From 0ae30c5997cd1c020364e9b0362b587f7d1e60f0 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Wed, 19 Apr 2017 14:23:55 +0200 Subject: [PATCH] [FIX] base_partner_merge: deduplicate contacts in multi company When deduplicating contacts, the function _process_query doesn't use the orm to fetch the partners to merge according to the criteria. So there were some access error in multi company when trying to merge contacts from a not allowed company. Now a check is made with the orm before merging the contacts. opw:708457 --- addons/crm/base_partner_merge.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/crm/base_partner_merge.py b/addons/crm/base_partner_merge.py index 560de0ecc51..5170bb9a88b 100644 --- a/addons/crm/base_partner_merge.py +++ b/addons/crm/base_partner_merge.py @@ -553,9 +553,12 @@ class MergePartnerAutomatic(osv.TransientModel): 'min_id': min_id, 'aggr_ids': aggr_ids, } - - proxy.create(cr, uid, values, context=context) - counter += 1 + # To ensure that the used partners are accessible by the user + partner_ids = self.pool['res.partner'].search(cr, uid, [('id', 'in', aggr_ids)], context=context) + if len(partner_ids) >= 2: + values['aggr_ids'] = partner_ids + proxy.create(cr, uid, values, context=context) + counter += 1 values = { 'state': 'selection',