'Try to automatically reconcile the statement.line ; return the counterpart journal entry/ies if the automatic reconciliation succeeded, False otherwise.
TODO : this method could be greatly improved and made extensible'

@api.multi
def auto_reconcile(self):

    self.ensure_one()
    match_recs = self.env['account.move.line']
    amount = (self.amount_currency or self.amount)
    company_currency = self.journal_id.company_id.currency_id
    st_line_currency = (self.currency_id or self.journal_id.currency_id)
    currency = (((st_line_currency and (st_line_currency != company_currency)) and st_line_currency.id) or False)
    precision = ((st_line_currency and st_line_currency.decimal_places) or company_currency.decimal_places)
    params = {'company_id': self.env.user.company_id.id, 'account_payable_receivable': (self.journal_id.default_credit_account_id.id, self.journal_id.default_debit_account_id.id), 'amount': float_round(amount, precision_digits=precision), 'partner_id': self.partner_id.id, 'ref': self.name}
    field = ((currency and 'amount_residual_currency') or 'amount_residual')
    liquidity_field = ((currency and 'amount_currency') or ((amount > 0) and 'debit') or 'credit')
    if self.name:
        sql_query = (((((self._get_common_sql_query() + '    AND    aml.ref    =    %(ref)s    AND    (') + field) + "    =    %(amount)s    OR    (acc.internal_type    =    'liquidity'    AND    ") + liquidity_field) + '    =    %(amount)s))                                                                    ORDER    BY    date_maturity    asc,    aml.id    asc')
        self.env.cr.execute(sql_query, params)
        match_recs = self.env.cr.dictfetchall()
        if (len(match_recs) > 1):
            return False
    if (not match_recs):
        if self.partner_id:
            sql_query = (((((self._get_common_sql_query() + '    AND    (') + field) + "    =    %(amount)s    OR    (acc.internal_type    =    'liquidity'    AND    ") + liquidity_field) + '    =    %(amount)s))                                                                    ORDER    BY    date_maturity    asc,    aml.id    asc')
            self.env.cr.execute(sql_query, params)
            match_recs = self.env.cr.dictfetchall()
            if (len(match_recs) > 1):
                return False
    if (not match_recs):
        return False
    match_recs = self.env['account.move.line'].browse([aml.get('id') for aml in match_recs])
    counterpart_aml_dicts = []
    payment_aml_rec = self.env['account.move.line']
    for aml in match_recs:
        if (aml.account_id.internal_type == 'liquidity'):
            payment_aml_rec = (payment_aml_rec | aml)
        else:
            amount = ((aml.currency_id and aml.amount_residual_currency) or aml.amount_residual)
            counterpart_aml_dicts.append({'name': (aml.name if (aml.name != '/') else aml.move_id.name), 'debit': (((amount < 0) and (- amount)) or 0), 'credit': (((amount > 0) and amount) or 0), 'move_line': aml})
    try:
        with self._cr.savepoint():
            counterpart = self.process_reconciliation(counterpart_aml_dicts=counterpart_aml_dicts, payment_aml_rec=payment_aml_rec)
        return counterpart
    except UserError:
        self.invalidate_cache()
        self.env['account.move'].invalidate_cache()
        self.env['account.move.line'].invalidate_cache()
        return False
