'Returns two lines whose amount are opposite'

@api.model
def get_reconciliation_proposition(self, account_id, partner_id=False):

    partner_id_condition = ((partner_id and 'AND    a.partner_id    =    %(partner_id)s    AND    b.partner_id    =    %(partner_id)s') or '')
    query = '\n                                                                SELECT    a.id,    b.id\n                                                                FROM    account_move_line    a,    account_move_line    b\n                                                                WHERE    a.amount_residual    =    -b.amount_residual\n                                                                AND    NOT    a.reconciled    AND    NOT    b.reconciled\n                                                                AND    a.account_id    =    %(account_id)s    AND    b.account_id    =    %(account_id)s\n                                                                {partner_id_condition}\n                                                                ORDER    BY    a.date    asc\n                                                                LIMIT    10\n                                                '.format(**locals())
    self.env.cr.execute(query, locals())
    pairs = self.env.cr.fetchall()
    all_pair_ids = [element for tupl in pairs for element in tupl]
    allowed_ids = set(self.env['account.move.line'].browse(all_pair_ids).ids)
    pairs = [pair for pair in pairs if ((pair[0] in allowed_ids) and (pair[1] in allowed_ids))]
    if (len(pairs) > 0):
        target_currency = (((self.currency_id and self.amount_currency) and self.currency_id) or self.company_id.currency_id)
        lines = self.browse(list(pairs[0]))
        return lines.prepare_move_lines_for_reconciliation_widget(target_currency=target_currency)
    return []
