'Move attachments of given opportunities to the current one `self`, and rename
the attachments having same name than native ones.
:param opportunities : recordset of merged crm.lead'

@api.multi
def _merge_opportunity_attachments(self, opportunities):

    self.ensure_one()
    def _get_attachments(opportunity_id):
        return self.env['ir.attachment'].search([('res_model', '=', self._name), ('res_id', '=', opportunity_id)])
    first_attachments = _get_attachments(self.id)
    count = 1
    for opportunity in opportunities:
        attachments = _get_attachments(opportunity.id)
        for attachment in attachments:
            values = {'res_id': self.id}
            for attachment_in_first in first_attachments:
                if (attachment.name == attachment_in_first.name):
                    values['name'] = ('%s    (%s)' % (attachment.name, count))
            count += 1
            attachment.write(values)
    return True
