mirror of
				https://github.com/brain-tec/account_ebics.git
				synced 2025-11-04 07:00:35 +00:00 
			
		
		
		
	[14.0]black, isort, prettier
This commit is contained in:
		@@ -2,16 +2,16 @@
 | 
			
		||||
# License LGPL-3 or later (http://www.gnu.org/licenses/lpgl).
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
    'name': 'account_ebics with Odoo Enterprise Bank Statement Import',
 | 
			
		||||
    'summary': "Use Odoo Enterprise Bank Statement Import with account_ebics",
 | 
			
		||||
    'version': '14.0.1.0.0',
 | 
			
		||||
    'author': 'Noviat',
 | 
			
		||||
    'category': 'Hidden',
 | 
			
		||||
    'license': 'LGPL-3',
 | 
			
		||||
    'depends': [
 | 
			
		||||
        'account_ebics_oe',
 | 
			
		||||
        'account_bank_statement_import',
 | 
			
		||||
    "name": "account_ebics with Odoo Enterprise Bank Statement Import",
 | 
			
		||||
    "summary": "Use Odoo Enterprise Bank Statement Import with account_ebics",
 | 
			
		||||
    "version": "14.0.1.0.0",
 | 
			
		||||
    "author": "Noviat",
 | 
			
		||||
    "category": "Hidden",
 | 
			
		||||
    "license": "LGPL-3",
 | 
			
		||||
    "depends": [
 | 
			
		||||
        "account_ebics_oe",
 | 
			
		||||
        "account_bank_statement_import",
 | 
			
		||||
    ],
 | 
			
		||||
    'installable': True,
 | 
			
		||||
    'auto_install': True,
 | 
			
		||||
    "installable": True,
 | 
			
		||||
    "auto_install": True,
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -3,32 +3,34 @@
 | 
			
		||||
 | 
			
		||||
import logging
 | 
			
		||||
 | 
			
		||||
from odoo import models, _
 | 
			
		||||
from odoo import _, models
 | 
			
		||||
 | 
			
		||||
_logger = logging.getLogger(__name__)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class AccountBankStatementImport(models.TransientModel):
 | 
			
		||||
    _inherit = 'account.bank.statement.import'
 | 
			
		||||
    _inherit = "account.bank.statement.import"
 | 
			
		||||
 | 
			
		||||
    def _check_parsed_data(self, stmts_vals, account_number):
 | 
			
		||||
        """ Basic and structural verifications """
 | 
			
		||||
        if self.env.context.get('active_model') == 'ebics.file':
 | 
			
		||||
        if self.env.context.get("active_model") == "ebics.file":
 | 
			
		||||
            message = False
 | 
			
		||||
            if len(stmts_vals) == 0:
 | 
			
		||||
                message = _("This file doesn't contain any statement.")
 | 
			
		||||
            if not message:
 | 
			
		||||
                no_st_line = True
 | 
			
		||||
                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
 | 
			
		||||
                        break
 | 
			
		||||
                if no_st_line:
 | 
			
		||||
                    message = _('This file doesn\'t contain any transaction.')
 | 
			
		||||
                    message = _("This file doesn't contain any transaction.")
 | 
			
		||||
                if message:
 | 
			
		||||
                    log_msg = _(
 | 
			
		||||
                        "Error detected while processing and EBICS File"
 | 
			
		||||
                    ) + ':\n' + message
 | 
			
		||||
                    log_msg = (
 | 
			
		||||
                        _("Error detected while processing and EBICS File")
 | 
			
		||||
                        + ":\n"
 | 
			
		||||
                        + message
 | 
			
		||||
                    )
 | 
			
		||||
                    _logger.warn(log_msg)
 | 
			
		||||
                    return
 | 
			
		||||
        super()._check_parsed_data(stmts_vals, account_number)
 | 
			
		||||
@@ -43,20 +45,16 @@ class AccountBankStatementImport(models.TransientModel):
 | 
			
		||||
        We could also create empty bank statement (in state done) to clearly
 | 
			
		||||
        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
 | 
			
		||||
            for st_vals in stmts_vals:
 | 
			
		||||
                if st_vals.get('transactions'):
 | 
			
		||||
                if st_vals.get("transactions"):
 | 
			
		||||
                    transactions = True
 | 
			
		||||
                    break
 | 
			
		||||
            if not transactions:
 | 
			
		||||
                message = _('This file doesn\'t contain any transaction.')
 | 
			
		||||
                message = _("This file doesn't contain any transaction.")
 | 
			
		||||
                st_line_ids = []
 | 
			
		||||
                notifications = {
 | 
			
		||||
                    'type': 'warning',
 | 
			
		||||
                    'message': message,
 | 
			
		||||
                    'details': ''
 | 
			
		||||
                }
 | 
			
		||||
                notifications = {"type": "warning", "message": message, "details": ""}
 | 
			
		||||
                return st_line_ids, [notifications]
 | 
			
		||||
 | 
			
		||||
        return super()._create_bank_statements(stmts_vals)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user