-
-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] l10n_br_cte: dacte - clean code
- Loading branch information
1 parent
3ea4040
commit fc7ba62
Showing
4 changed files
with
1 addition
and
227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
@@ -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" |
This file was deleted.
Oops, something went wrong.