Skip to content

Commit

Permalink
[MIG] report_context: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPForgeFlow committed Aug 16, 2023
1 parent 9ad28ee commit 88772cc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion report_context/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Report Context",
"summary": """
Adding context to reports""",
"version": "14.0.1.0.2",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "Creu Blanca,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/reporting-engine",
Expand Down
4 changes: 2 additions & 2 deletions report_context/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from odoo.http import request, route

from odoo.addons.web.controllers import main as report
from odoo.addons.web.controllers import report as report


class ReportController(report.ReportController):
Expand All @@ -13,7 +13,7 @@ def report_routes(self, reportname, docids=None, converter=None, **data):
report = request.env["ir.actions.report"]._get_report_from_name(reportname)
original_context = json.loads(data.get("context", "{}") or "{}")
data["context"] = json.dumps(
report.with_context(original_context)._get_context()
report.with_context(**original_context)._get_context()
)
return super().report_routes(
reportname, docids=docids, converter=converter, **data
Expand Down
12 changes: 5 additions & 7 deletions report_context/data/config_parameter.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data noupdate="1">
<odoo noupdate="1">
<record
id="report_default_context"
model="ir.config_parameter"
forcecreate="True"
>
id="report_default_context"
model="ir.config_parameter"
forcecreate="True"
>
<field name="key">report.default.context</field>
<field name="value">{}</field>
</record>
</data>
</odoo>
8 changes: 4 additions & 4 deletions report_context/models/ir_actions_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ def _get_context(self):
context.update(self.env.context)
return context

def _render(self, res_ids, data=None):
return super(IrActionsReport, self.with_context(self._get_context()))._render(
res_ids, data=data
def _render(self, report_ref, res_ids, data=None):
return super(IrActionsReport, self.with_context(**self._get_context()))._render(
report_ref, res_ids, data=data
)

def report_action(self, docids, data=None, config=True):
return super(
IrActionsReport, self.with_context(self._get_context())
IrActionsReport, self.with_context(**self._get_context())
).report_action(docids, data=data, config=config)

0 comments on commit 88772cc

Please sign in to comment.