'Returns the data required by the bank statement reconciliation widget to display a statement line'

def get_statement_line_for_reconciliation_widget(self):

    statement_currency = (self.journal_id.currency_id or self.journal_id.company_id.currency_id)
    if (self.amount_currency and self.currency_id):
        amount = self.amount_currency
        amount_currency = self.amount
        amount_currency_str = (((amount_currency > 0) and amount_currency) or (- amount_currency))
        amount_currency_str = formatLang(self.env, amount_currency_str, currency_obj=statement_currency)
    else:
        amount = self.amount
        amount_currency_str = ''
    amount_str = formatLang(self.env, abs(amount), currency_obj=(self.currency_id or statement_currency))
    data = {'id': self.id, 'ref': self.ref, 'note': (self.note or ''), 'name': self.name, 'date': self.date, 'amount': amount, 'amount_str': amount_str, 'currency_id': (self.currency_id.id or statement_currency.id), 'partner_id': self.partner_id.id, 'journal_id': self.journal_id.id, 'statement_id': self.statement_id.id, 'account_code': self.journal_id.default_debit_account_id.code, 'account_name': self.journal_id.default_debit_account_id.name, 'partner_name': self.partner_id.name, 'communication_partner_name': self.partner_name, 'amount_currency_str': amount_currency_str, 'has_no_partner': (not self.partner_id.id)}
    if self.partner_id:
        if (amount > 0):
            data['open_balance_account_id'] = self.partner_id.property_account_receivable_id.id
        else:
            data['open_balance_account_id'] = self.partner_id.property_account_payable_id.id
    return data
