[8.0]support multiple EBICS connections

This commit is contained in:
Luc De Meyer 2020-07-27 15:16:17 +02:00
parent 8deb1b4bd4
commit e8a538bf22
2 changed files with 17 additions and 4 deletions

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright 2009-2018 Noviat.
# Copyright 2009-2020 Noviat.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Upload Payment Order via EBICS',
'version': '8.0.1.1.0',
'version': '8.0.1.2.0',
'license': 'AGPL-3',
'author': 'Noviat',
'category': 'Accounting & Finance',

View File

@ -1,8 +1,9 @@
# -*- coding: utf-8 -*-
# Copyright 2009-2017 Noviat.
# Copyright 2009-2020 Noviat.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import api, models, _
from openerp import _, api, models
from openerp.exceptions import Warning as UserError
class BankingExportSepaWizard(models.TransientModel):
@ -14,6 +15,17 @@ class BankingExportSepaWizard(models.TransientModel):
ctx = self._context.copy()
payment_order = self.payment_order_ids[0]
origin = _("Payment Order") + ': ' + payment_order.reference
ebics_config = self.env['ebics.config'].search([
('bank_id', '=', payment_order.mode.bank_id.id),
('state', '=', 'active'),
])
if not ebics_config:
raise UserError(_(
"No active EBICS configuration available "
"for the selected bank."
))
if len(ebics_config) == 1:
ctx["default_ebics_config_id"] = ebics_config.id
ctx.update({
'default_upload_data': self.file,
'default_upload_fname': self.filename,
@ -21,6 +33,7 @@ class BankingExportSepaWizard(models.TransientModel):
'payment_order_id': payment_order.id,
})
ebics_xfer = self.env['ebics.xfer'].with_context(ctx).create({})
ebics_xfer._onchange_ebics_config_id()
ebics_xfer._onchange_upload_data()
ebics_xfer._onchange_format_id()
view = self.env.ref('account_ebics.ebics_xfer_view_form_upload')