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 5, 2024
1 parent 3926ec5 commit 2d8ca60
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions l10n_br_cte/models/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import re
from datetime import datetime

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 +808,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 +839,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 2d8ca60

Please sign in to comment.