From f720844f1a237f993e251446e65f9b2f6943115a Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Tue, 10 May 2022 21:40:54 +0200 Subject: [PATCH] [14.0]black, isort, prettier --- account_ebics_payment_order/__manifest__.py | 20 ++--- .../models/account_payment_order.py | 88 +++++++++++-------- .../views/account_payment_order.xml | 13 ++- 3 files changed, 68 insertions(+), 53 deletions(-) diff --git a/account_ebics_payment_order/__manifest__.py b/account_ebics_payment_order/__manifest__.py index 5836ab7..35ad8a2 100644 --- a/account_ebics_payment_order/__manifest__.py +++ b/account_ebics_payment_order/__manifest__.py @@ -2,16 +2,14 @@ # License LGPL-3 or later (http://www.gnu.org/licenses/lpgl). { - 'name': 'Upload Payment Order via EBICS', - 'version': '14.0.1.0.0', - 'license': 'LGPL-3', - 'author': 'Noviat', - 'category': 'Accounting & Finance', - 'depends': [ - 'account_ebics', - 'account_payment_order'], - 'data': [ - 'views/account_payment_order.xml', + "name": "Upload Payment Order via EBICS", + "version": "14.0.1.0.0", + "license": "LGPL-3", + "author": "Noviat", + "category": "Accounting & Finance", + "depends": ["account_ebics", "account_payment_order"], + "data": [ + "views/account_payment_order.xml", ], - 'installable': True, + "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 64e9442..081e927 100644 --- a/account_ebics_payment_order/models/account_payment_order.py +++ b/account_ebics_payment_order/models/account_payment_order.py @@ -6,57 +6,69 @@ from odoo.exceptions import UserError class AccountPaymentOrder(models.Model): - _inherit = 'account.payment.order' + _inherit = "account.payment.order" 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)]) + attach = self.env["ir.attachment"].search( + [("res_model", "=", self._name), ("res_id", "=", self.id)] + ) if not attach: - raise UserError(_( - "This payment order doesn't contains attachements." - "\nPlease generate first the Payment Order file first.")) + raise UserError( + _( + "This payment order doesn't contains attachements." + "\nPlease generate first the Payment Order file first." + ) + ) elif len(attach) > 1: - raise UserError(_( - "This payment order contains multiple attachments." - "\nPlease remove the obsolete attachments or upload " - "the payment order file via the " - "EBICS Processing > EBICS Upload menu")) + raise UserError( + _( + "This payment order contains multiple attachments." + "\nPlease remove the obsolete attachments or upload " + "the payment order file via the " + "EBICS Processing > EBICS Upload menu" + ) + ) else: - origin = _("Payment Order") + ': ' + self.name - ebics_config = self.env['ebics.config'].search([ - ('journal_ids', '=', self.journal_id.id), - ('state', '=', 'confirm'), - ]) + origin = _("Payment Order") + ": " + self.name + ebics_config = self.env["ebics.config"].search( + [ + ("journal_ids", "=", self.journal_id.id), + ("state", "=", "confirm"), + ] + ) if not ebics_config: - raise UserError(_( - "No active EBICS configuration available " - "for the selected bank." - )) + 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': attach.datas, - 'default_upload_fname': attach.name, - 'origin': origin, - 'force_comany': self.company_id.id, - }) - ebics_xfer = self.env['ebics.xfer'].with_context(ctx).create({}) + ctx.update( + { + "default_upload_data": attach.datas, + "default_upload_fname": attach.name, + "origin": origin, + "force_comany": self.company_id.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') + view = self.env.ref("account_ebics.ebics_xfer_view_form_upload") act = { - 'name': _('EBICS Upload'), - 'view_type': 'form', - 'view_mode': 'form', - 'res_model': 'ebics.xfer', - 'view_id': view.id, - 'res_id': ebics_xfer.id, - 'type': 'ir.actions.act_window', - 'target': 'new', - 'context': ctx, + "name": _("EBICS Upload"), + "view_type": "form", + "view_mode": "form", + "res_model": "ebics.xfer", + "view_id": view.id, + "res_id": ebics_xfer.id, + "type": "ir.actions.act_window", + "target": "new", + "context": ctx, } return act diff --git a/account_ebics_payment_order/views/account_payment_order.xml b/account_ebics_payment_order/views/account_payment_order.xml index 9bd43c8..8f81e20 100644 --- a/account_ebics_payment_order/views/account_payment_order.xml +++ b/account_ebics_payment_order/views/account_payment_order.xml @@ -1,15 +1,20 @@ - + account.payment.order.form account.payment.order - +