[14.0]black, isort, prettier

This commit is contained in:
Luc De Meyer 2022-05-10 21:40:54 +02:00
parent 84a660b31d
commit 6b8df2b89f
2 changed files with 25 additions and 27 deletions

View File

@ -2,16 +2,16 @@
# License LGPL-3 or later (http://www.gnu.org/licenses/lpgl). # License LGPL-3 or later (http://www.gnu.org/licenses/lpgl).
{ {
'name': 'account_ebics with OCA Bank Statement Imoort', "name": "account_ebics with OCA Bank Statement Imoort",
'summary': "Use OCA Bank Statement Import with account_ebics", "summary": "Use OCA Bank Statement Import with account_ebics",
'version': '14.0.1.0.0', "version": "14.0.1.0.0",
'author': 'Noviat', "author": "Noviat",
'category': 'Hidden', "category": "Hidden",
'license': 'LGPL-3', "license": "LGPL-3",
'depends': [ "depends": [
'account_ebics', "account_ebics",
'account_statement_import', "account_statement_import",
], ],
'installable': True, "installable": True,
'auto_install': True, "auto_install": True,
} }

View File

@ -3,32 +3,34 @@
import logging import logging
from odoo import models, _ from odoo import _, models
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
class AccountStatementImport(models.TransientModel): class AccountStatementImport(models.TransientModel):
_inherit = 'account.statement.import' _inherit = "account.statement.import"
def _check_parsed_data(self, stmts_vals): def _check_parsed_data(self, stmts_vals):
""" Basic and structural verifications """ """ Basic and structural verifications """
if self.env.context.get('active_model') == 'ebics.file': if self.env.context.get("active_model") == "ebics.file":
message = False message = False
if len(stmts_vals) == 0: if len(stmts_vals) == 0:
message = _("This file doesn't contain any statement.") message = _("This file doesn't contain any statement.")
if not message: if not message:
no_st_line = True no_st_line = True
for vals in stmts_vals: for vals in stmts_vals:
if vals['transactions'] and len(vals['transactions']) > 0: if vals["transactions"] and len(vals["transactions"]) > 0:
no_st_line = False no_st_line = False
break break
if no_st_line: if no_st_line:
message = _('This file doesn\'t contain any transaction.') message = _("This file doesn't contain any transaction.")
if message: if message:
log_msg = _( log_msg = (
"Error detected while processing and EBICS File" _("Error detected while processing and EBICS File")
) + ':\n' + message + ":\n"
+ message
)
_logger.warn(log_msg) _logger.warn(log_msg)
return return
return super()._check_parsed_data(stmts_vals) return super()._check_parsed_data(stmts_vals)
@ -43,20 +45,16 @@ class AccountStatementImport(models.TransientModel):
We could also create empty bank statement (in state done) to clearly We could also create empty bank statement (in state done) to clearly
show days without transactions via the bank statement list view. show days without transactions via the bank statement list view.
""" """
if self.env.context.get('active_model') == 'ebics.file': if self.env.context.get("active_model") == "ebics.file":
transactions = False transactions = False
for st_vals in stmts_vals: for st_vals in stmts_vals:
if st_vals.get('transactions'): if st_vals.get("transactions"):
transactions = True transactions = True
break break
if not transactions: if not transactions:
message = _('This file doesn\'t contain any transaction.') message = _("This file doesn't contain any transaction.")
st_line_ids = [] st_line_ids = []
notifications = { notifications = {"type": "warning", "message": message, "details": ""}
'type': 'warning',
'message': message,
'details': ''
}
return st_line_ids, [notifications] return st_line_ids, [notifications]
return super()._create_bank_statements(stmts_vals, result) return super()._create_bank_statements(stmts_vals, result)