From fb0a93e944bab0171cfb6063c7fbf23056394c02 Mon Sep 17 00:00:00 2001 From: Marcel Savegnago Date: Wed, 23 Oct 2024 10:05:16 -0300 Subject: [PATCH] [RFC] l10n_br_nfe: rename method _processador --- l10n_br_nfe/models/document.py | 22 +++++++++++----------- l10n_br_nfe/models/invalidate_number.py | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/l10n_br_nfe/models/document.py b/l10n_br_nfe/models/document.py index 93a3a39710ac..dda45af340f6 100644 --- a/l10n_br_nfe/models/document.py +++ b/l10n_br_nfe/models/document.py @@ -906,9 +906,9 @@ def _serialize(self, edocs): edocs.append(nfe) return edocs - def _processador(self): + def _edoc_processor(self): if not self.filtered(filter_processador_edoc_nfe): - return super()._processador() + return super()._edoc_processor() self._check_nfe_environment() certificado = self.company_id._get_br_ecertificate() @@ -952,7 +952,7 @@ def _document_export(self, pretty_print=True): result = super()._document_export() for record in self.filtered(filter_processador_edoc_nfe): edoc = record.serialize()[0] - processador = record._processador() + processador = record._edoc_processor() xml_file = processador.render_edoc_xsdata(edoc, pretty_print=pretty_print)[ 0 ] @@ -1117,7 +1117,7 @@ def _generate_key(self): def _nfe_consult_receipt(self): self.ensure_one() - processor = self._processador() + processor = self._edoc_processor() # Consult receipt and process the response rec_num = self.authorization_event_id.lot_receipt_number receipt_process = processor.consulta_recibo(numero=rec_num) @@ -1170,7 +1170,7 @@ def _nfe_create_proc(self, prot_nfe_element): ) return None - processor = self._processador() + processor = self._edoc_processor() # Extract the tag from the `enviNFe` message, which represents the NF-e nfe_send_xml = base64.b64decode(self.send_file_id.datas) @@ -1209,7 +1209,7 @@ def _is_nfe_found(c_stat): """ return c_stat in ["100", "101", "110"] - nfe_manager = self._processador() + nfe_manager = self._edoc_processor() check_response = nfe_manager.consulta_documento(chave=self.document_key) status = check_response.resposta.xMotivo @@ -1251,7 +1251,7 @@ def _nfe_send_for_authorization(self): Serialize and send a NFe for authorizaion """ serialized_nfe = self.serialize()[0] - nfe_manager = self._processador() + nfe_manager = self._edoc_processor() authorization_response = None for service_response in nfe_manager.processar_documento(serialized_nfe): if service_response.webservice not in [ @@ -1396,7 +1396,7 @@ def _need_compute_nfe_tags(self): def _nfe_cancel(self): self.ensure_one() - processador = self._processador() + processador = self._edoc_processor() if not self.authorization_protocol: raise UserError(_("Authorization Protocol Not Found!")) @@ -1452,7 +1452,7 @@ def _document_correction(self, justificative): def _nfe_correction(self, justificative): self.ensure_one() - processador = self._processador() + processador = self._edoc_processor() numeros = self.event_ids.filtered( lambda e: e.type == "14" and e.state == "done" @@ -1512,7 +1512,7 @@ def _update_nfce_for_offline_contingency(self): def get_nfce_qrcode(self): if self.document_type != MODELO_FISCAL_NFCE: return - processador = self._processador() + processador = self._edoc_processor() if self.nfe_transmission == "1": return processador.monta_qrcode(self.document_key) @@ -1524,7 +1524,7 @@ def get_nfce_qrcode_url(self): if self.document_type != MODELO_FISCAL_NFCE: return - return self._processador().consulta_qrcode_url + return self._edoc_processor().consulta_qrcode_url def _prepare_payments_for_nfce(self): for rec in self.filtered(lambda d: d.document_type == MODELO_FISCAL_NFCE): diff --git a/l10n_br_nfe/models/invalidate_number.py b/l10n_br_nfe/models/invalidate_number.py index e4f55023a759..fe45271ae024 100644 --- a/l10n_br_nfe/models/invalidate_number.py +++ b/l10n_br_nfe/models/invalidate_number.py @@ -17,7 +17,7 @@ class InvalidateNumber(models.Model): _inherit = "l10n_br_fiscal.invalidate.number" - def _processador(self): + def _edoc_processor(self): certificado = self.env.company._get_br_ecertificate() session = Session() session.verify = False @@ -38,7 +38,7 @@ def _processador(self): return edoc_nfe(**params) def _invalidate(self, document_id=False): - processador = self._processador() + processador = self._edoc_processor() evento = processador.inutilizacao( cnpj=punctuation_rm(self.company_id.cnpj_cpf), mod=self.document_type_id.code,