'Create a new payment for the order'

def _prepare_bank_statement_line_payment_values(self, data):

    args = {'amount': data['amount'], 'date': data.get('payment_date', fields.Date.today()), 'name': ((self.name + ':    ') + (data.get('payment_name', '') or '')), 'partner_id': (self.env['res.partner']._find_accounting_partner(self.partner_id).id or False)}
    journal_id = data.get('journal', False)
    statement_id = data.get('statement_id', False)
    assert (journal_id or statement_id), 'No    statement_id    or    journal_id    passed    to    the    method!'
    journal = self.env['account.journal'].browse(journal_id)
    company_cxt = dict(self.env.context, force_company=journal.company_id.id)
    account_def = self.env['ir.property'].with_context(company_cxt).get('property_account_receivable_id', 'res.partner')
    args['account_id'] = (self.partner_id.property_account_receivable_id.id or (account_def and account_def.id) or False)
    if (not args['account_id']):
        if (not args['partner_id']):
            msg = _('There    is    no    receivable    account    defined    to    make    payment.')
        else:
            msg = (_('There    is    no    receivable    account    defined    to    make    payment    for    the    partner:    "%s"    (id:%d).') % (self.partner_id.name, self.partner_id.id))
        raise UserError(msg)
    context = dict(self.env.context)
    context.pop('pos_session_id', False)
    for statement in self.session_id.statement_ids:
        if (statement.id == statement_id):
            journal_id = statement.journal_id.id
            break
        elif (statement.journal_id.id == journal_id):
            statement_id = statement.id
            break
    if (not statement_id):
        raise UserError(_('You    have    to    open    at    least    one    cashbox.'))
    args.update({'statement_id': statement_id, 'pos_statement_id': self.id, 'journal_id': journal_id, 'ref': self.session_id.name})
    return args
