Skip to content

Commit

Permalink
[MIG] l10n_br_account_nfe: _render_qweb_* migration
Browse files Browse the repository at this point in the history
  • Loading branch information
CristianoMafraJunior committed Oct 15, 2024
1 parent f1297a9 commit a3ee84a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
12 changes: 6 additions & 6 deletions l10n_br_account_nfe/report/ir_actions_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ class IrActionsReport(models.Model):
def temp_xml_autorizacao(self, xml_string):
return super().temp_xml_autorizacao(xml_string=xml_string)

def _render_qweb_html(self, res_ids, data=None):
if self.report_name == "main_template_danfe_account":
def _render_qweb_html(self, report_ref, res_ids, data=None):
if report_ref == "main_template_danfe_account":
return
return super()._render_qweb_html(res_ids, data=data)
return super()._render_qweb_html(report_ref, res_ids, data=data)

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

nfe = self.env["account.move"].search([("id", "in", res_ids)])

Expand Down
8 changes: 6 additions & 2 deletions l10n_br_account_nfe/tests/test_nfe_danfe_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ def test_generate_danfe_brazil_fiscal_report(self):
danfe_report = self.env["ir.actions.report"].search(
[("report_name", "=", "main_template_danfe_account")]
)
danfe_pdf = danfe_report._render_qweb_pdf([nfe.id])
danfe_pdf = danfe_report._render_qweb_pdf(
"l10n_br_account_nfe.main_template_danfe_account", [nfe.id]
)
self.assertTrue(danfe_pdf)

def test_generate_danfe_erpbrasil_edoc(self):
Expand All @@ -33,5 +35,7 @@ def test_generate_danfe_erpbrasil_edoc(self):
danfe_report = self.env["ir.actions.report"].search(
[("report_name", "=", "main_template_danfe_account")]
)
danfe_pdf = danfe_report._render_qweb_pdf([nfe.id])
danfe_pdf = danfe_report._render_qweb_pdf(
"l10n_br_account_nfe.main_template_danfe_account", [nfe.id]
)
self.assertTrue(danfe_pdf)

0 comments on commit a3ee84a

Please sign in to comment.