Skip to content

Commit

Permalink
[IMP] l10n_br_cte: dacte - clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelsavegnago committed Nov 26, 2024
1 parent 3ea4040 commit fc7ba62
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 227 deletions.
2 changes: 0 additions & 2 deletions l10n_br_cte/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
"views/modal/modal_ferroviario.xml",
"views/modal/modal_aereo.xml",
# Report
"report/reports.xml",
"report/dacte_cte.xml",
"report/dacte_report.xml",
# Wizards
"wizards/document_correction_wizard.xml",
Expand Down
165 changes: 0 additions & 165 deletions l10n_br_cte/report/dacte_cte.xml

This file was deleted.

32 changes: 1 addition & 31 deletions l10n_br_cte/report/ir_actions_report.py
Original file line number Diff line number Diff line change
@@ -1,42 +1,18 @@
# Copyright 2024 Engenere.one
# Copyright 2024 - TODAY, Marcel Savegnago <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import base64
import logging
from io import BytesIO

from brazilfiscalreport.dacte import Dacte, DacteConfig, Margins
from erpbrasil.edoc.pdf import base
from lxml import etree

from odoo import _, api, models
from odoo.exceptions import UserError

_logger = logging.getLogger(__name__)


class IrActionsReport(models.Model):
_inherit = "ir.actions.report"

def temp_xml_autorizacao(self, xml_string):
"""TODO: Migrate-me to erpbrasil.edoc.pdf ASAP"""
root = etree.fromstring(xml_string)
ns = {None: "http://www.portalfiscal.inf.br/cte"}
new_root = etree.Element("cteProc", nsmap=ns)

protCTe_node = etree.Element("protCTe")
infProt = etree.SubElement(protCTe_node, "infProt")
etree.SubElement(infProt, "tpAmb").text = "2"
etree.SubElement(infProt, "verAplic").text = ""
etree.SubElement(infProt, "dhRecbto").text = None
etree.SubElement(infProt, "nProt").text = ""
etree.SubElement(infProt, "digVal").text = ""
etree.SubElement(infProt, "cStat").text = ""
etree.SubElement(infProt, "xMotivo").text = ""

new_root.append(root)
new_root.append(protCTe_node)
return etree.tostring(new_root)

def _render_qweb_html(self, res_ids, data=None):
if self.report_name == "main_template_dacte":
return
Expand Down Expand Up @@ -103,9 +79,3 @@ def _get_dacte_config(self, tmpLogo, company):
"margins": margins,
}
return DacteConfig(**dacte_config)

def render_dacte_erpbrasil(self, cte_xml):
pdf = base.ImprimirXml.imprimir(
string_xml=cte_xml,
)
return pdf, "pdf"
29 changes: 0 additions & 29 deletions l10n_br_cte/report/reports.xml

This file was deleted.

0 comments on commit fc7ba62

Please sign in to comment.