[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
This commit is contained in:
Goffin Simon 2017-04-19 14:23:55 +02:00
parent 5d5bd2c404
commit 0ae30c5997
1 changed files with 6 additions and 3 deletions

View File

@ -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',