From f435e79550a47225261a0f413c6a03b982a1b108 Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Thu, 24 Nov 2022 22:04:58 +0100 Subject: [PATCH] [MIG] account_ebics_payment_order: Migration to 15.0 --- account_ebics/wizards/ebics_xfer.py | 17 ++++++++++++++++- account_ebics/wizards/ebics_xfer.xml | 2 +- account_ebics_payment_order/__manifest__.py | 7 ++++--- .../models/account_payment_order.py | 6 +++--- ...rder.xml => account_payment_order_views.xml} | 14 ++++++-------- 5 files changed, 30 insertions(+), 16 deletions(-) rename account_ebics_payment_order/views/{account_payment_order.xml => account_payment_order_views.xml} (65%) diff --git a/account_ebics/wizards/ebics_xfer.py b/account_ebics/wizards/ebics_xfer.py index 6552b85..a32b2f6 100644 --- a/account_ebics/wizards/ebics_xfer.py +++ b/account_ebics/wizards/ebics_xfer.py @@ -338,7 +338,22 @@ class EbicsXfer(models.TransientModel): OrderID = False try: order_type = self.order_type - if order_type == "FUL": + if order_type == "BTU": + btf = BusinessTransactionFormat( + ef_format.btf_service, + ef_format.btf_message, + scope=ef_format.btf_scope or None, + option=ef_format.btf_option or None, + container=ef_format.btf_container or None, + version=ef_format.btf_version or None, + variant=ef_format.btf_variant or None, + format=ef_format.btf_format or None, + ) + kwargs = {} + if self.test_mode: + kwargs["TEST"] = "TRUE" + client.BTU(btf, upload_data, **kwargs) + elif order_type == "FUL": kwargs = {} bank = self.ebics_config_id.journal_ids[0].bank_id cc = bank.country.code diff --git a/account_ebics/wizards/ebics_xfer.xml b/account_ebics/wizards/ebics_xfer.xml index 3dfd4d9..0d28980 100644 --- a/account_ebics/wizards/ebics_xfer.xml +++ b/account_ebics/wizards/ebics_xfer.xml @@ -74,7 +74,7 @@ diff --git a/account_ebics_payment_order/__manifest__.py b/account_ebics_payment_order/__manifest__.py index 35ad8a2..d79491a 100644 --- a/account_ebics_payment_order/__manifest__.py +++ b/account_ebics_payment_order/__manifest__.py @@ -1,15 +1,16 @@ -# Copyright 2009-2021 Noviat. +# Copyright 2009-2022 Noviat. # License LGPL-3 or later (http://www.gnu.org/licenses/lpgl). { "name": "Upload Payment Order via EBICS", - "version": "14.0.1.0.0", + "version": "15.0.1.0.0", "license": "LGPL-3", "author": "Noviat", + "website": "https://www.noviat.com", "category": "Accounting & Finance", "depends": ["account_ebics", "account_payment_order"], "data": [ - "views/account_payment_order.xml", + "views/account_payment_order_views.xml", ], "installable": True, } diff --git a/account_ebics_payment_order/models/account_payment_order.py b/account_ebics_payment_order/models/account_payment_order.py index 081e927..42045c2 100644 --- a/account_ebics_payment_order/models/account_payment_order.py +++ b/account_ebics_payment_order/models/account_payment_order.py @@ -1,4 +1,4 @@ -# Copyright 2009-2021 Noviat. +# Copyright 2009-2022 Noviat. # License LGPL-3 or later (http://www.gnu.org/licenses/lpgl). from odoo import _, models @@ -10,7 +10,6 @@ class AccountPaymentOrder(models.Model): def ebics_upload(self): self.ensure_one() - ctx = self._context.copy() attach = self.env["ir.attachment"].search( [("res_model", "=", self._name), ("res_id", "=", self.id)] ) @@ -45,6 +44,7 @@ class AccountPaymentOrder(models.Model): "for the selected bank." ) ) + ctx = self.env.context.copy() if len(ebics_config) == 1: ctx["default_ebics_config_id"] = ebics_config.id ctx.update( @@ -55,7 +55,7 @@ class AccountPaymentOrder(models.Model): "force_comany": self.company_id.id, } ) - ebics_xfer = self.env["ebics.xfer"].with_context(ctx).create({}) + 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() diff --git a/account_ebics_payment_order/views/account_payment_order.xml b/account_ebics_payment_order/views/account_payment_order_views.xml similarity index 65% rename from account_ebics_payment_order/views/account_payment_order.xml rename to account_ebics_payment_order/views/account_payment_order_views.xml index 8f81e20..bdadee4 100644 --- a/account_ebics_payment_order/views/account_payment_order.xml +++ b/account_ebics_payment_order/views/account_payment_order_views.xml @@ -1,6 +1,5 @@ - account.payment.order.form @@ -9,15 +8,14 @@ -