Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
4d4b67a
[ADD] report_partner_address
AungKoKoLin1997 Dec 19, 2025
474a71b
[UPD] Update report_partner_address.pot
Dec 22, 2025
b59883e
[BOT] post-merge updates
OCA-git-bot Dec 22, 2025
e57d4c2
[IMP] report_partner_address: pre-commit auto fixes
AungKoKoLin1997 Dec 23, 2025
f8d9ed8
[MIG] report_partner_address: Migration to 18.0
AungKoKoLin1997 Dec 23, 2025
1ab73d6
[MIG] report_partner_address: Migration to 19.0
AungKoKoLin1997 Dec 23, 2025
bba4bac
[IMP] report_partner_address: remove sync address_details from parent
AungKoKoLin1997 Dec 23, 2025
3bdb003
[ADD] reporting-context
Feb 18, 2019
7bc627e
[12.0][MIG] report_context
Jul 2, 2019
c631b72
[IMP] report_context: black, isort, prettier
Sep 30, 2020
17a073d
[13.0][MIG] report_context
Sep 30, 2020
3417270
[MIG] report_context: Migration to 14.0
Feb 24, 2021
5d7612b
Fix json.loads when context is None
PierrickBrun Jun 25, 2021
e568734
[FIX] pre-commit
May 4, 2022
66c8fd7
report_context 14.0.1.0.1
OCA-git-bot Aug 29, 2022
3322e71
[FIX] report_context: render was changed by _render
etobella Feb 2, 2023
db73d05
report_context 14.0.1.0.2
OCA-git-bot Feb 24, 2023
a19333a
[MIG] report_context: Migration to 16.0
AlexPForgeFlow Aug 16, 2023
62cb6a8
[BOT] post-merge updates
OCA-git-bot Dec 8, 2023
bf1c1e7
Added translation using Weblate (Italian)
mymage Jan 10, 2024
974818e
Translated using Weblate (Italian)
mymage Jan 15, 2024
37f95d4
Added translation using Weblate (Spanish)
Ivorra78 Apr 22, 2024
c3a5f45
Translated using Weblate (Spanish)
Ivorra78 Apr 22, 2024
029948b
[IMP] report_context: pre-commit auto fixes
xaviedoanhduy Jul 29, 2025
9d3c091
[MIG] report_context: Migration to 18.0
xaviedoanhduy Jul 29, 2025
d7a5168
[UPD] Update report_context.pot
Oct 31, 2025
57d2271
[BOT] post-merge updates
OCA-git-bot Oct 31, 2025
b3733a4
[IMP] report_context: pre-commit auto fixes
AlexanderMurre Mar 10, 2026
b61ae93
[MIG] report_context: Migration to 19.0
AlexanderMurre Mar 17, 2026
96da92d
Merge PR #1114 into 19.0
OCA-git-bot Mar 20, 2026
bbf7510
[UPD] Update report_partner_address.pot
Mar 20, 2026
4a9407a
[BOT] post-merge updates
OCA-git-bot Mar 20, 2026
6b6bb90
Merge PR #1145 into 19.0
OCA-git-bot Mar 20, 2026
f18d134
[UPD] Update report_context.pot
Mar 20, 2026
5536a6d
[BOT] post-merge updates
OCA-git-bot Mar 20, 2026
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ Available addons
addon | version | maintainers | summary
--- | --- | --- | ---
[bi_sql_editor](bi_sql_editor/) | 19.0.1.0.1 | <a href='https://github.com/legalsylvain'><img src='https://github.com/legalsylvain.png' width='32' height='32' style='border-radius:50%;' alt='legalsylvain'/></a> | BI Views builder, based on Materialized or Normal SQL Views
[report_context](report_context/) | 19.0.1.0.0 | | Adding context to reports
[report_csv](report_csv/) | 19.0.1.0.0 | | Base module to create csv report
[report_partner_address](report_partner_address/) | 19.0.1.0.0 | <a href='https://github.com/yostashiro'><img src='https://github.com/yostashiro.png' width='32' height='32' style='border-radius:50%;' alt='yostashiro'/></a> <a href='https://github.com/aungkokolin1997'><img src='https://github.com/aungkokolin1997.png' width='32' height='32' style='border-radius:50%;' alt='aungkokolin1997'/></a> | Translatable partner address details for reports and portal
[report_qweb_element_page_visibility](report_qweb_element_page_visibility/) | 19.0.1.0.0 | | Report Qweb Element Page Visibility
[report_qweb_parameter](report_qweb_parameter/) | 19.0.1.0.0 | | Add new parameters for qweb templates in order to reduce field length and check minimal length
[report_xlsx](report_xlsx/) | 19.0.1.0.2 | | Base module to create xlsx report
Expand Down
106 changes: 106 additions & 0 deletions report_context/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

==============
Report Context
==============

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:07930ffae8934b9a6ddc4b2e70ab7978eb1bea9fafad7d385e265c2725f8f41a
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github
:target: https://github.com/OCA/reporting-engine/tree/19.0/report_context
:alt: OCA/reporting-engine
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/reporting-engine-19-0/reporting-engine-19-0-report_context
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&target_branch=19.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module adds a context variable to reports. A possible use for this
context could be hiding some fields or many other configuration options.

**Table of contents**

.. contents::
:local:

Usage
=====

To configure this module, you need to:

- Enter Odoo in debug mode.
- To add a specific context to a report, you should go to Settings ->
Reports -> Reporting and look for the report you want to edit on the
list. You will see that now they contain a new field called Context
Value , where you will be able to add all the desired context
parameters.
- Go to Settings -> Parameters -> System Parameters. On the system
parameters list, look for report.default.context, which is a Python
dictionary variable where you can add a context that will be common
for all reports.

It can also be added on the developer side using:

::

<record id="model_name.report_id" model="ir.actions.report">
<field name="context">YOUR CONTEXT HERE</field>
</record>

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/reporting-engine/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/reporting-engine/issues/new?body=module:%20report_context%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Creu Blanca

Contributors
------------

- Jaime Arroyo <[email protected]>
- Do Anh Duy <[email protected]>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/reporting-engine <https://github.com/OCA/reporting-engine/tree/19.0/report_context>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions report_context/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import controllers
from . import models
14 changes: 14 additions & 0 deletions report_context/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2019 Creu Blanca
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Report Context",
"summary": """
Adding context to reports""",
"version": "19.0.1.0.0",
"license": "AGPL-3",
"author": "Creu Blanca,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/reporting-engine",
"depends": ["web"],
"data": ["views/ir_actions_report.xml", "data/config_parameter.xml"],
}
1 change: 1 addition & 0 deletions report_context/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import main
20 changes: 20 additions & 0 deletions report_context/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2019 Creu Blanca
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
import json

from odoo.http import request, route

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


class ReportController(report.ReportController):
@route()
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()
)
return super().report_routes(
reportname=reportname, docids=docids, converter=converter, **data
)
7 changes: 7 additions & 0 deletions report_context/data/config_parameter.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record id="report_default_context" model="ir.config_parameter" forcecreate="True">
<field name="key">report.default.context</field>
<field name="value">{}</field>
</record>
</odoo>
35 changes: 35 additions & 0 deletions report_context/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * report_context
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-04-22 22:43+0000\n"
"Last-Translator: Ivorra78 <[email protected]>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: report_context
#: model:ir.model.fields,field_description:report_context.field_ir_actions_report__context
msgid "Context Value"
msgstr "Valor de Contexto"

#. module: report_context
#: model:ir.model.fields,help:report_context.field_ir_actions_report__context
msgid ""
"Context dictionary as Python expression, empty by default (Default: {})"
msgstr ""
"Diccionario de contexto como expresión Python, vacío por defecto (Por "
"defecto: {})"

#. module: report_context
#: model:ir.model,name:report_context.model_ir_actions_report
msgid "Report Action"
msgstr "Informar Acción"
35 changes: 35 additions & 0 deletions report_context/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * report_context
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-01-15 09:37+0000\n"
"Last-Translator: mymage <[email protected]>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: report_context
#: model:ir.model.fields,field_description:report_context.field_ir_actions_report__context
msgid "Context Value"
msgstr "Valore context"

#. module: report_context
#: model:ir.model.fields,help:report_context.field_ir_actions_report__context
msgid ""
"Context dictionary as Python expression, empty by default (Default: {})"
msgstr ""
"Dizionario context come espressione Python, predefinito come vuoto (Default: "
"{})"

#. module: report_context
#: model:ir.model,name:report_context.model_ir_actions_report
msgid "Report Action"
msgstr "Azione resoconto"
40 changes: 40 additions & 0 deletions report_context/i18n/report_context.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * report_context
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 19.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: report_context
#: model:ir.model.fields,field_description:report_context.field_ir_actions_report__context
msgid "Context Value"
msgstr ""

#. module: report_context
#: model:ir.model.fields,help:report_context.field_ir_actions_report__context
msgid ""
"Context dictionary as Python expression, empty by default (Default: {})"
msgstr ""

#. module: report_context
#: model:ir.model.fields,field_description:report_context.field_ir_actions_report__display_name
msgid "Display Name"
msgstr ""

#. module: report_context
#: model:ir.model.fields,field_description:report_context.field_ir_actions_report__id
msgid "ID"
msgstr ""

#. module: report_context
#: model:ir.model,name:report_context.model_ir_actions_report
msgid "Report Action"
msgstr ""
1 change: 1 addition & 0 deletions report_context/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import ir_actions_report
38 changes: 38 additions & 0 deletions report_context/models/ir_actions_report.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright 2019 Creu Blanca
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
from odoo.tools.safe_eval import safe_eval


class IrActionsReport(models.Model):
_inherit = "ir.actions.report"

context = fields.Char(
string="Context Value",
default={},
required=True,
help="Context dictionary as Python expression, empty by default (Default: {})",
)

def _get_context(self):
context = (
self.env["ir.config_parameter"]
.sudo()
.get_param("report.default.context", "{}")
)
# We must transform it to a dictionary
context = safe_eval(context or "{}")
report_context = safe_eval(self.context or "{}")
context.update(report_context)
context.update(self.env.context)
return context

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

def report_action(self, docids, data=None, config=True):
return super(
IrActionsReport, self.with_context(**self._get_context())
).report_action(docids=docids, data=data, config=config)
3 changes: 3 additions & 0 deletions report_context/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
2 changes: 2 additions & 0 deletions report_context/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Jaime Arroyo \<<[email protected]>\>
- Do Anh Duy \<<[email protected]>\>
2 changes: 2 additions & 0 deletions report_context/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module adds a context variable to reports. A possible use for this
context could be hiding some fields or many other configuration options.
18 changes: 18 additions & 0 deletions report_context/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
To configure this module, you need to:

- Enter Odoo in debug mode.
- To add a specific context to a report, you should go to Settings -\>
Reports -\> Reporting and look for the report you want to edit on the
list. You will see that now they contain a new field called Context
Value , where you will be able to add all the desired context
parameters.
- Go to Settings -\> Parameters -\> System Parameters. On the system
parameters list, look for report.default.context, which is a Python
dictionary variable where you can add a context that will be common
for all reports.

It can also be added on the developer side using:

<record id="model_name.report_id" model="ir.actions.report">
<field name="context">YOUR CONTEXT HERE</field>
</record>
Binary file added report_context/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading