Skip to content

Commit

Permalink
[RFC] l10n_br_mdfe: rename method _processador
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelsavegnago committed Oct 23, 2024
1 parent 911d0cd commit 110ebb6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions l10n_br_mdfe/models/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -834,9 +834,9 @@ def _serialize(self, edocs):
edocs.append(mdfe)
return edocs

def _processador(self):
def _edoc_processor(self):
if self.document_type != MODELO_FISCAL_MDFE:
return super()._processador()
return super()._edoc_processor()

certificado = self.company_id._get_br_ecertificate()

Expand Down Expand Up @@ -877,7 +877,7 @@ def _document_export(self, pretty_print=True):
result = super()._document_export()
for record in self.filtered(filtered_processador_edoc_mdfe):
edoc = record.serialize()[0]
processador = record._processador()
processador = record._edoc_processor()
xml_file = processador.render_edoc_xsdata(edoc, pretty_print=pretty_print)[
0
]
Expand Down
8 changes: 4 additions & 4 deletions l10n_br_mdfe/tests/test_mdfe_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,22 @@ def test_mdfe_inverse_fields(self):
)

def test_mdfe_processor(self):
processor = self.mdfe_id._processador()
processor = self.mdfe_id._edoc_processor()
self.assertTrue(isinstance(processor, MDFeAdapter))

self.mdfe_id.document_type_id = False
processor = self.mdfe_id._processador()
processor = self.mdfe_id._edoc_processor()
self.assertFalse(isinstance(processor, MDFeAdapter))

self.mdfe_id.document_type_id = self.mdfe_document_type_id

self.mdfe_id.company_id.certificate_nfe_id = False
processor = self.mdfe_id._processador()
processor = self.mdfe_id._edoc_processor()
self.assertTrue(isinstance(processor, MDFeAdapter))

self.mdfe_id.company_id.certificate_ecnpj_id = False
with self.assertRaises(UserError):
processor = self.mdfe_id._processador()
processor = self.mdfe_id._edoc_processor()

def test_generate_key(self):
self.mdfe_id._generate_key()
Expand Down

0 comments on commit 110ebb6

Please sign in to comment.