Skip to content

Commit

Permalink
[FIX] l10n_br_nfe: name template
Browse files Browse the repository at this point in the history
  • Loading branch information
CristianoMafraJunior committed Oct 15, 2024
1 parent 2e4fef8 commit b9715b5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion l10n_br_nfe/models/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -1337,7 +1337,7 @@ def make_pdf(self):
}
report = self.env.ref("l10n_br_nfe.report_danfe")
pdf_data = report._render_qweb_pdf(
"l10n_br_nfe.main_template_danfe", self.fiscal_line_ids.document_id.ids
"main_template_danfe", self.fiscal_line_ids.document_id.ids
)
attachment_data["datas"] = base64.b64encode(pdf_data[0])
file_pdf = self.file_report_id
Expand Down
4 changes: 2 additions & 2 deletions l10n_br_nfe/report/ir_actions_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ def temp_xml_autorizacao(self, xml_string):
return etree.tostring(new_root)

def _render_qweb_html(self, report_ref, res_ids, data=None):
if report_ref == "l10n_br_nfe.main_template_danfe":
if report_ref == "main_template_danfe":
return

return super()._render_qweb_html(report_ref, res_ids, data=data)

def _render_qweb_pdf(self, report_ref, res_ids, data=None):
if report_ref not in ["l10n_br_nfe.main_template_danfe"]:
if report_ref not in ["main_template_danfe"]:
return super()._render_qweb_pdf(report_ref, res_ids, data=data)

nfe = self.env["l10n_br_fiscal.document"].search([("id", "in", res_ids)])
Expand Down
2 changes: 1 addition & 1 deletion l10n_br_nfe/tests/test_nfe_danfe.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_generate_danfe_document_type_error(self):
nfe.document_type_id = self.env.ref("l10n_br_fiscal.document_01")
nfe.action_document_confirm()
with self.assertRaises(UserError) as captured_exception:
danfe_report._render_qweb_pdf("l10n_br_nfe.main_template_danfe", [nfe.id])
danfe_report._render_qweb_pdf("main_template_danfe", [nfe.id])
self.assertEqual(
captured_exception.exception.args[0],
"You can only print a DANFE of a NFe(55).",
Expand Down

0 comments on commit b9715b5

Please sign in to comment.