Skip to content

Commit

Permalink
[WIP] l10n_br_cte: print DACTE via BrazilFiscalReport lib
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelsavegnago committed Jul 19, 2024
1 parent 7e5cfc2 commit 569f466
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions l10n_br_cte/models/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import logging
import re
import sys

# import base64
from datetime import datetime

from erpbrasil.edoc.cte import TransmissaoCTE
Expand Down Expand Up @@ -49,6 +51,10 @@

from ..constants.modal import CTE_MODAL_VERSION_DEFAULT

# TODO: https://github.com/Engenere/BrazilFiscalReport/pull/23
# from brazilfiscalreport.dacte import Dacte


_logger = logging.getLogger(__name__)
try:
pass
Expand Down Expand Up @@ -1444,3 +1450,38 @@ def _need_compute_cte_tags(self):
return False

# cte40_infAdFisco = fields.Text(related="additional_data")

# def make_pdf(self):
# if not self.filtered(filter_processador_edoc_cte):
# return super().make_pdf()

# file_pdf = self.file_report_id
# self.file_report_id = False
# file_pdf.unlink()

# # if self.authorization_file_id:
# # arquivo = self.authorization_file_id
# # xml_string = base64.b64decode(arquivo.datas).decode()
# # else:
# # arquivo = self.send_file_id
# # xml_string = base64.b64decode(arquivo.datas).decode()
# # xml_string = self.temp_xml_autorizacao(xml_string)

# # TODO: TEMPORÁRIO
# arquivo = self.send_file_id
# xml_string = base64.b64decode(arquivo.datas).decode()

# pdf = Dacte(xml=xml_string).output()
# # TODO: Alterar a opção output_dir para devolter também o arquivo do XML
# # no retorno, evitando a releitura do arquivo.

# self.file_report_id = self.env["ir.attachment"].create(
# {
# "name": self.document_key + ".pdf",
# "res_model": self._name,
# "res_id": self.id,
# "datas": base64.b64encode(pdf),
# "mimetype": "application/pdf",
# "type": "binary",
# }
# )

0 comments on commit 569f466

Please sign in to comment.