Skip to content

Commit

Permalink
[FIX] l10n_br_cte: fix envia_documento
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelsavegnago committed Jul 4, 2024
1 parent 3926ec5 commit eccfefa
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions l10n_br_cte/models/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
import re
from datetime import datetime

from erpbrasil.transmissao import TransmissaoSOAP
# from erpbrasil.transmissao import TransmissaoSOAP
from erpbrasil.edoc.cte import TransmissaoCTE
from nfelib.cte.bindings.v4_0.cte_v4_00 import Cte
from nfelib.nfe.ws.edoc_legacy import CTeAdapter as edoc_cte
from requests import Session
Expand Down Expand Up @@ -808,6 +809,16 @@ def _export_modal_dutoviario(self):

return self.modal_dutoviario_id.export_ds()[0]

################################
# Framework Spec model's methods
################################

def _export_field(self, xsd_field, class_obj, member_spec, export_value=None):
if xsd_field == "cte40_tpAmb":
self.env.context = dict(self.env.context)
self.env.context.update({"tpAmb": self[xsd_field]})
return super()._export_field(xsd_field, class_obj, member_spec, export_value)

################################
# Business Model Methods
################################
Expand All @@ -829,7 +840,7 @@ def _processador(self):
certificado = self.env.company._get_br_ecertificate()
session = Session()
session.verify = False
transmissao = TransmissaoSOAP(certificado, session)
transmissao = TransmissaoCTE(certificado, session)
return edoc_cte(
transmissao,
self.company_id.state_id.ibge_code,
Expand Down

0 comments on commit eccfefa

Please sign in to comment.