-
-
Notifications
You must be signed in to change notification settings - Fork 282
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] change the cache of a method that needs to be company dependant
Also updated the translation files
- Loading branch information
1 parent
8936261
commit 461faac
Showing
8 changed files
with
61 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ Ir Actions Report Multi Company | |
:target: https://runbot.odoo-community.org/runbot/133/12.0 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
Make Report Actions multi-company Aware. | ||
|
||
|
@@ -60,6 +60,10 @@ Contributors | |
|
||
* Jonathan Nemry <[email protected]> | ||
* Andrea Stirpe <[email protected]> | ||
* `XCG Consulting <https://xcg-consulting.fr/>`_: | ||
|
||
* Étienne Ferrière | ||
* Vincent Hatakeyama | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
from . import models | ||
from . import models # noqa: F401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,16 +6,21 @@ msgid "" | |
msgstr "" | ||
"Project-Id-Version: Odoo Server 11.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2021-12-02 10:05+0000\n" | ||
"POT-Creation-Date: 2022-06-14 08:32+0000\n" | ||
"PO-Revision-Date: \n" | ||
"Last-Translator: \n" | ||
"Last-Translator: Vincent Hatakeyama <[email protected]>\n" | ||
"Language-Team: \n" | ||
"Language: fr_FR\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=2; plural=(n > 1);\n" | ||
"X-Generator: Poedit 2.3\n" | ||
"X-Generator: Poedit 2.4.2\n" | ||
|
||
#. module: ir_actions_report_multi_company | ||
#: model:ir.model,name:ir_actions_report_multi_company.model_ir_actions_actions | ||
msgid "Actions" | ||
msgstr "Actions" | ||
|
||
#. module: ir_actions_report_multi_company | ||
#: model:ir.model.fields,field_description:ir_actions_report_multi_company.field_ir_actions_report__company_id | ||
|
18 changes: 12 additions & 6 deletions
18
ir_actions_report_multi_company/i18n/ir_actions_report_multi_company.pot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,31 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * ir_actions_report_multi_company | ||
# * ir_actions_report_multi_company | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 11.0\n" | ||
"Project-Id-Version: Odoo Server 13.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"Last-Translator: <>\n" | ||
"POT-Creation-Date: 2022-06-14 08:32+0000\n" | ||
"PO-Revision-Date: 2022-06-14 08:32+0000\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: ir_actions_report_multi_company | ||
#: model:ir.model.fields,field_description:ir_actions_report_multi_company.field_ir_act_report_xml_company_id | ||
#: model:ir.model,name:ir_actions_report_multi_company.model_ir_actions_actions | ||
msgid "Actions" | ||
msgstr "" | ||
|
||
#. module: ir_actions_report_multi_company | ||
#: model:ir.model.fields,field_description:ir_actions_report_multi_company.field_ir_actions_report__company_id | ||
msgid "Company" | ||
msgstr "" | ||
|
||
#. module: ir_actions_report_multi_company | ||
#: model:ir.model,name:ir_actions_report_multi_company.model_ir_actions_report | ||
msgid "ir.actions.report" | ||
msgid "Report Action" | ||
msgstr "" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from . import ir_actions_report | ||
from . import ir_actions_actions # noqa: F401 | ||
from . import ir_actions_report # noqa: F401 |
28 changes: 28 additions & 0 deletions
28
ir_actions_report_multi_company/models/ir_actions_actions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright 2022 XCG Consulting | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
from odoo import api, models, tools | ||
|
||
|
||
class IrActions(models.Model): | ||
_inherit = "ir.actions.actions" | ||
|
||
# Add companies to the cache of this method that is used in | ||
# models.BaseModels.fields_view_get to get the toolbar actions that are now | ||
# company dependant. | ||
@api.model | ||
@tools.ormcache( | ||
"frozenset(self.env.user.groups_id.ids)", | ||
"frozenset(self.env.companies.ids)", | ||
"model_name", | ||
) | ||
def get_bindings(self, model_name): | ||
"""Retrieve the list of actions bound to the given model. | ||
:return: a dict mapping binding types to a list of dict describing | ||
actions, where the latter is given by calling the method | ||
``read`` on the action record. | ||
""" | ||
# Using __wrapped__ is necessary to bypass the cache put by Odoo on the | ||
# super method. | ||
result = super().get_bindings.__wrapped__(self, model_name) | ||
return result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
* Jonathan Nemry <[email protected]> | ||
* Andrea Stirpe <[email protected]> | ||
* `XCG Consulting <https://xcg-consulting.fr/>`_: | ||
|
||
* Étienne Ferrière | ||
* Vincent Hatakeyama |