-
-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ed00f71
commit 2a2d366
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.damdfe import Damdfe, DamdfeConfig, 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/mdfe"} | ||
new_root = etree.Element("mdfeProc", nsmap=ns) | ||
|
||
protMDFe_node = etree.Element("protMDFe") | ||
infProt = etree.SubElement(protMDFe_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(protMDFe_node) | ||
return etree.tostring(new_root) | ||
|
||
def _render_qweb_html(self, res_ids, data=None): | ||
if self.report_name == "main_template_damdfe": | ||
return | ||
|
@@ -103,9 +79,3 @@ def _get_damdfe_config(self, tmpLogo, company): | |
"margins": margins, | ||
} | ||
return DamdfeConfig(**damdfe_config) | ||
|
||
def render_damdfe_erpbrasil(self, mdfe_xml): | ||
pdf = base.ImprimirXml.imprimir( | ||
string_xml=mdfe_xml, | ||
) | ||
return pdf, "pdf" |
This file was deleted.
Oops, something went wrong.