Skip to content

Commit

Permalink
[REF] l10n_br_account_payment_brcobranca: For solve the W8138(except-…
Browse files Browse the repository at this point in the history
…pass) PEP8 was included logger.Warning but is unnecessary use TRY for this because there no unexpect error, the code already know the Banks that need a specific method.
  • Loading branch information
mbcosta committed Aug 15, 2024
1 parent ef13570 commit 9baace4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,16 @@ def _prepare_bank_line_santander(self, payment_mode_id, linhas_pagamentos):
def prepare_bank_payment_line(self, bank_name_brcobranca):
payment_mode_id = self.order_id.payment_mode_id
linhas_pagamentos = self._prepare_boleto_line_vals()
try:

# Casos onde o Banco além dos principais campos possui campos
# específicos, dos casos por enquanto mapeados, se estiver vendo
# um caso que está faltando por favor considere fazer um
# PR para ajudar
if hasattr(self, f"_prepare_bank_line_{bank_name_brcobranca.name}"):
bank_method = getattr(
self, f"_prepare_bank_line_{bank_name_brcobranca.name}"
)
if bank_method:
bank_method(payment_mode_id, linhas_pagamentos)
except Exception:
_logger.warning(
f"Error executing method _prepare_bank_line_{bank_name_brcobranca.name}."
"Check the bank name and provided parameters.",
exc_info=True,
)
bank_method(payment_mode_id, linhas_pagamentos)

# Cada Banco pode possuir seus Codigos de Instrução
if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,13 @@ def generate_payment_file(self):
"sequencial_remessa": self.file_number,
}

try:
# Casos onde o Banco além dos principais campos possui campos
# específicos, dos casos por enquanto mapeados, se estiver vendo
# um caso que está faltando por favor considere fazer um
# PR para ajudar
if hasattr(self, f"_prepare_remessa_{bank_brcobranca.name}"):
bank_method = getattr(self, f"_prepare_remessa_{bank_brcobranca.name}")
if bank_method:
bank_method(remessa_values, cnab_type)
except Exception:
_logger.warning(
f"Error executing method _prepare_remessa_{bank_brcobranca.name}."
"Check the bank name and provided parameters.",
exc_info=True,
)
bank_method(remessa_values, cnab_type)

remessa = self._get_brcobranca_remessa(
bank_brcobranca, remessa_values, cnab_type
Expand Down

0 comments on commit 9baace4

Please sign in to comment.