diff --git a/report_substitute/__init__.py b/report_substitute/__init__.py
index 1c15bc7ee..aee8895e7 100644
--- a/report_substitute/__init__.py
+++ b/report_substitute/__init__.py
@@ -1,3 +1,2 @@
from . import models
from . import wizards
-from . import tests
diff --git a/report_substitute/__manifest__.py b/report_substitute/__manifest__.py
index 9338dcefc..c74d68790 100644
--- a/report_substitute/__manifest__.py
+++ b/report_substitute/__manifest__.py
@@ -6,7 +6,7 @@
"summary": """
This module allows to create substitution rules for report actions.
""",
- "version": "15.0.1.0.0",
+ "version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV," "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/reporting-engine",
diff --git a/report_substitute/demo/action_report.xml b/report_substitute/demo/action_report.xml
index 72d576585..562f511fd 100644
--- a/report_substitute/demo/action_report.xml
+++ b/report_substitute/demo/action_report.xml
@@ -3,14 +3,14 @@
Substitution Report
-
+
+ Substitution For Technical guide
+ ir.module.module
+ qweb-pdf
+ report_substitute.substitution_report
+ report_substitute.substitution_report
+ report
+
Substitution Report 2
-
+
+ Substitution 2 For Technical guide
+ ir.module.module
+ qweb-pdf
+ report_substitute.substitution_report_2
+ report_substitute.substitution_report_2
+ report
+
diff --git a/report_substitute/models/ir_actions_report.py b/report_substitute/models/ir_actions_report.py
index 375f37886..61d432eba 100644
--- a/report_substitute/models/ir_actions_report.py
+++ b/report_substitute/models/ir_actions_report.py
@@ -50,9 +50,12 @@ class IrActionReport(models.Model):
return action
- def _render(self, res_ids, data=None):
- substitution_report = self.get_substitution_report(res_ids)
- return super(IrActionReport, substitution_report)._render(res_ids, data)
+ def _render(self, report_ref, res_ids, data=None):
+ report = self._get_report(report_ref)
+ substitution_report = report.get_substitution_report(res_ids)
+ return super(IrActionReport, self)._render(
+ substitution_report.report_name, res_ids, data=data
+ )
def report_action(self, docids, data=None, config=True):
if docids:
diff --git a/report_substitute/tests/test_report_substitute.py b/report_substitute/tests/test_report_substitute.py
index 778853916..88796624d 100644
--- a/report_substitute/tests/test_report_substitute.py
+++ b/report_substitute/tests/test_report_substitute.py
@@ -20,15 +20,27 @@ class TestReportSubstitute(TransactionCase):
).id
def test_substitution(self):
- res = str(self.action_report.render(res_ids=self.res_ids)[0])
+ res = str(
+ self.action_report._render(
+ self.action_report.report_name, res_ids=self.res_ids
+ )[0]
+ )
self.assertIn('Substitution Report
', res)
# remove the substation rule
self.substitution_rule.unlink()
- res = str(self.action_report.render(res_ids=self.res_ids)[0])
+ res = str(
+ self.action_report._render(
+ self.action_report.report_name, res_ids=self.res_ids
+ )[0]
+ )
self.assertNotIn('Substitution Report
', res)
def test_recursive_substitution(self):
- res = str(self.action_report.render(res_ids=self.res_ids)[0])
+ res = str(
+ self.action_report._render(
+ self.action_report.report_name, res_ids=self.res_ids
+ )[0]
+ )
self.assertNotIn('Substitution Report 2
', res)
self.env["ir.actions.report.substitution.rule"].create(
{
@@ -40,15 +52,27 @@ class TestReportSubstitute(TransactionCase):
).id,
}
)
- res = str(self.action_report.render(res_ids=self.res_ids)[0])
+ res = str(
+ self.action_report._render(
+ self.action_report.report_name, res_ids=self.res_ids
+ )[0]
+ )
self.assertIn('Substitution Report 2
', res)
def test_substitution_with_domain(self):
self.substitution_rule.write({"domain": "[('name', '=', 'base')]"})
- res = str(self.action_report.render(res_ids=self.res_ids)[0])
+ res = str(
+ self.action_report._render(
+ self.action_report.report_name, res_ids=self.res_ids
+ )[0]
+ )
self.assertIn('Substitution Report
', res)
self.substitution_rule.write({"domain": "[('name', '!=', 'base')]"})
- res = str(self.action_report.render(res_ids=self.res_ids)[0])
+ res = str(
+ self.action_report._render(
+ self.action_report.report_name, res_ids=self.res_ids
+ )[0]
+ )
self.assertNotIn('Substitution Report
', res)
def test_substitution_with_action_dict(self):