Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18.0][MIG] report_substitute: Migration to 18.0 #948

Open
wants to merge 33 commits into
base: 18.0
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
34ac694
[ADD] - report substitute
sbejaoui Jul 11, 2019
97fecb5
[ADD] - Add readme
sbejaoui Jul 22, 2019
72dcb8f
[ADD] - Add unit tests
sbejaoui Jul 22, 2019
578eb6a
[FIX] - missing method param
sbejaoui Jul 23, 2019
d9d7843
[FIX] - prevent substitution loop
sbejaoui Jul 23, 2019
f9c54d6
[IMP] - manage subtitute report for multi-action
sbejaoui Jul 25, 2019
41512b7
[IMP] - manage substitution for mail.thread message_post_with_template
sbejaoui Jul 25, 2019
f650c0d
[IMP] - add unit tests
sbejaoui Jul 26, 2019
09ef435
[FIX] - manage the case where mail.compose.message is triggered from …
sbejaoui Aug 2, 2019
3861862
[FIX] - Fix typo
sbejaoui Oct 1, 2019
9362c1f
[12.0][IMP] - Add check for substitution infinite loop
sbejaoui Oct 1, 2019
4a2bdde
[UPD] Update report_substitute.pot
oca-travis Oct 21, 2019
c74b6e5
[UPD] README.rst
OCA-git-bot Oct 21, 2019
5edf251
[ADD] icon.png
OCA-git-bot Oct 21, 2019
3c7f1aa
[13.0][MIG] - report_substitute migration
sbejaoui Nov 6, 2020
2d3b232
[ADD] - add sbejaoui as maintainer for report_substitute
sbejaoui Nov 6, 2020
6f866cc
[MIG] report_substitute: Migration to 15.0
matiasperalta1 Sep 12, 2022
8be4b98
[MIG] report_substitute: Migration to 16.0
matiasperalta1 Dec 14, 2022
9769eb3
[UPD] Update report_substitute.pot
May 11, 2023
8ce2800
[UPD] README.rst
OCA-git-bot May 11, 2023
6ba97bc
[UPD] README.rst
OCA-git-bot Sep 3, 2023
d6b3770
Added translation using Weblate (Spanish)
Ivorra78 Sep 7, 2023
d55ba6a
Translated using Weblate (Spanish)
Ivorra78 Sep 7, 2023
e93921a
[FIX] report_substitute: support for email
SodexisTeam Oct 12, 2023
6253cc4
[BOT] post-merge updates
OCA-git-bot Dec 8, 2023
3cf2bab
[IMP] report_substitute: pre-commit auto fixes
lef-adhoc Dec 15, 2023
df5a5fa
[MIG] report_substitute: Migration to 17.0
lef-adhoc Dec 15, 2023
1a5c454
[UPD] Update report_substitute.pot
May 23, 2024
1815df8
[BOT] post-merge updates
OCA-git-bot May 23, 2024
dad9717
Update translation files
weblate May 23, 2024
3d57c3f
Added translation using Weblate (Italian)
mymage May 24, 2024
227bade
Translated using Weblate (Italian)
mymage May 24, 2024
a186035
[MIG] report_substitute: Migration to 18.0
matiasperalta1 Oct 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[MIG] report_substitute: Migration to 16.0
matiasperalta1 committed Oct 28, 2024
commit 8be4b98caa8ed767c83e51a034d2e18a121be4bc
1 change: 0 additions & 1 deletion report_substitute/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
from . import models
from . import wizards
from . import tests
2 changes: 1 addition & 1 deletion report_substitute/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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",
32 changes: 16 additions & 16 deletions report_substitute/demo/action_report.xml
Original file line number Diff line number Diff line change
@@ -3,14 +3,14 @@
<template id="substitution_report">
<div class="page">Substitution Report</div>
</template>
<report
id="substitution_report_print"
string="Substitution For Technical guide"
model="ir.module.module"
report_type="qweb-pdf"
file="report_substitute.substitution_report"
name="report_substitute.substitution_report"
/>
<record id="substitution_report_print" model="ir.actions.report">
<field name="name">Substitution For Technical guide</field>
<field name="model">ir.module.module</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">report_substitute.substitution_report</field>
<field name="report_file">report_substitute.substitution_report</field>
<field name="binding_type">report</field>
</record>
<record id="substitution_rule_demo_1" model="ir.actions.report.substitution.rule">
<field name="action_report_id" ref="base.ir_module_reference_print" />
<field
@@ -21,12 +21,12 @@
<template id="substitution_report_2">
<div class="page">Substitution Report 2</div>
</template>
<report
id="substitution_report_print_2"
string="Substitution 2 For Technical guide"
model="ir.module.module"
report_type="qweb-pdf"
file="report_substitute.substitution_report_2"
name="report_substitute.substitution_report_2"
/>
<record id="substitution_report_print_2" model="ir.actions.report">
<field name="name">Substitution 2 For Technical guide</field>
<field name="model">ir.module.module</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">report_substitute.substitution_report_2</field>
<field name="report_file">report_substitute.substitution_report_2</field>
<field name="binding_type">report</field>
</record>
</odoo>
9 changes: 6 additions & 3 deletions report_substitute/models/ir_actions_report.py
Original file line number Diff line number Diff line change
@@ -50,9 +50,12 @@ def get_substitution_report_action(self, action, active_ids):

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:
36 changes: 30 additions & 6 deletions report_substitute/tests/test_report_substitute.py
Original file line number Diff line number Diff line change
@@ -20,15 +20,27 @@ def setUp(self):
).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('<div class="page">Substitution Report</div>', 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('<div class="page">Substitution Report</div>', 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('<div class="page">Substitution Report 2</div>', res)
self.env["ir.actions.report.substitution.rule"].create(
{
@@ -40,15 +52,27 @@ def test_recursive_substitution(self):
).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('<div class="page">Substitution Report 2</div>', 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('<div class="page">Substitution Report</div>', 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('<div class="page">Substitution Report</div>', res)

def test_substitution_with_action_dict(self):