Skip to content

Commit e96d9ce

Browse files
[MIG] base_ir_actions_sequence: Migration to 18.0
1 parent de83726 commit e96d9ce

File tree

8 files changed

+125
-99
lines changed

8 files changed

+125
-99
lines changed
Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,41 @@
1-
====================
2-
Base Action Sequence
3-
====================
1+
=====================
2+
Base Actions Sequence
3+
=====================
44

5-
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
67
!! This file is generated by oca-gen-addon-readme !!
78
!! changes will be overwritten. !!
89
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:1be150d924e786874a620261feb0c42bdb392b6cce451367e39de04e1e84c6a5
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
912
10-
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
1114
:target: https://odoo-community.org/page/development-status
12-
:alt: Production/Stable
13-
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
14-
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
15-
:alt: License: AGPL-3
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
18+
:alt: License: LGPL-3
1619
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--ux-lightgray.png?logo=github
17-
:target: https://github.com/OCA/server-ux/tree/13.0/base_ir_actions_actions_sequence
20+
:target: https://github.com/OCA/server-ux/tree/18.0/base_ir_actions_sequence
1821
:alt: OCA/server-ux
1922
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
20-
:target: https://translation.odoo-community.org/projects/server-ux-13-0/server-ux-13-0-base_ir_actions_actions_sequence
23+
:target: https://translation.odoo-community.org/projects/server-ux-18-0/server-ux-18-0-base_ir_actions_sequence
2124
:alt: Translate me on Weblate
22-
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
23-
:target: https://runbot.odoo-community.org/runbot/250/13.0
24-
:alt: Try me on Runbot
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-ux&target_branch=18.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
2530

26-
|badge1| |badge2| |badge3| |badge4| |badge5|
31+
This module allows to assign sequence to every action
32+
(``ir.actions.actions``), and therefore any model that inherits from it
33+
(like ``ir.actions.report``, ``ir.actions.server``,
34+
``ir.actions.act_window``...) can be ordered by sequence.
2735

28-
This module allows to assign sequence to Reports, to modify the order in which
29-
they are shown.
36+
This is useful when you want to control the order of actions displayed
37+
in various parts of the Odoo interface, such as the order of reports in
38+
the print menu, or the order of server actions in the action menu.
3039

3140
**Table of contents**
3241

@@ -36,42 +45,42 @@ they are shown.
3645
Usage
3746
=====
3847

39-
This module introduces the base to add the ability to edit the order in which
40-
records of models that inherit from ir.actions.actions.
48+
This module introduces the base to add the ability to edit the order in
49+
which records of models that inherit from ir.actions.actions.
4150

4251
To use this module, you need to (example for Reports):
4352

44-
#. Activate the developer mode
45-
#. Go to *Settings > Technical > Reports*.
46-
#. Search for any Report and edit it's sequence.
53+
#. Activate the developer mode #. Go to *Settings > Technical >
54+
Reports*. #. Search for any Report and edit its sequence. #. The reports
55+
will be ordered by sequence in the print menu.
4756

4857
Bug Tracker
4958
===========
5059

5160
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-ux/issues>`_.
5261
In case of trouble, please check there if your issue has already been reported.
53-
If you spotted it first, help us smashing it by providing a detailed and welcomed
54-
`feedback <https://github.com/OCA/server-ux/issues/new?body=module:%20base_menu_visibility_restriction%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
62+
If you spotted it first, help us to smash it by providing a detailed and welcomed
63+
`feedback <https://github.com/OCA/server-ux/issues/new?body=module:%20base_ir_actions_sequence%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
5564

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

5867
Credits
5968
=======
6069

6170
Authors
62-
~~~~~~~
71+
-------
6372

6473
* ForgeFlow
6574

6675
Contributors
67-
~~~~~~~~~~~~
76+
------------
6877

69-
* `ForgeFlow <https://www.forgeflow.com>`_:
78+
- `ForgeFlow <https://www.forgeflow.com>`__:
7079

71-
* Jaume Bernaus
80+
- Jaume Bernaus
7281

7382
Maintainers
74-
~~~~~~~~~~~
83+
-----------
7584

7685
This module is maintained by the OCA.
7786

@@ -83,14 +92,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
8392
mission is to support the collaborative development of Odoo features and
8493
promote its widespread use.
8594

86-
.. |maintainer-JaumeBforgeFlow| image:: https://github.com/JaumeBforgeFlow.png?size=40px
87-
:target: https://github.com/JaumeBforgeFlow
88-
:alt: JaumeBforgeFlow
89-
90-
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
91-
92-
|maintainer-JaumeBforgeFlow|
93-
94-
This module is part of the `OCA/server-ux <https://github.com/OCA/server-ux/tree/13.0/base_ir_actions_actions_sequence>`_ project on GitHub.
95+
This module is part of the `OCA/server-ux <https://github.com/OCA/server-ux/tree/18.0/base_ir_actions_sequence>`_ project on GitHub.
9596

96-
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
97+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

base_ir_actions_sequence/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
33
{
44
"name": "Base Actions Sequence",
5-
"version": "13.0.1.0.1",
5+
"version": "18.0.1.0.0",
66
"category": "Extra Tools",
77
"author": "ForgeFlow, Odoo Community Association (OCA)",
88
"website": "https://github.com/OCA/server-ux",
Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
1-
from collections import defaultdict
2-
3-
from odoo import api, fields, models, tools
1+
from odoo import fields, models, tools
2+
from odoo.tools import frozendict
43

54

65
class IrActions(models.Model):
76
_inherit = "ir.actions.actions"
87

9-
priority = fields.Integer(string="Sequence", default=16, required=True)
8+
sequence = fields.Integer(default=16, required=True)
109

11-
@api.model
12-
@tools.ormcache("frozenset(self.env.user.groups_id.ids)", "model_name")
13-
def get_bindings(self, model_name):
14-
"""
15-
Order Report Actions by priority
16-
"""
17-
res = super().get_bindings(model_name)
18-
ordered_res = defaultdict(list)
19-
for key, values in res.items():
20-
ordered_res[key] = sorted(values, key=lambda x: (x["priority"], x["id"]))
21-
return ordered_res
10+
@tools.ormcache("model_name", "self.env.lang")
11+
def _get_bindings(self, model_name):
12+
result = dict(super()._get_bindings(model_name))
13+
# Only for 'report' type, since for 'action' type the bindings are
14+
# managed in the original _get_bindings method
15+
if result.get("report"):
16+
result["report"] = tuple(
17+
sorted(result["report"], key=lambda vals: vals.get("sequence", 0))
18+
)
19+
return frozendict(result)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- [ForgeFlow](https://www.forgeflow.com):
2+
- Jaume Bernaus
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
This module allows to assign sequence to every action (``ir.actions.actions``),
2+
and therefore any model that inherits from it (like ``ir.actions.report``,
3+
``ir.actions.server``, ``ir.actions.act_window``...) can be ordered by sequence.
4+
5+
This is useful when you want to control the order of actions displayed in
6+
various parts of the Odoo interface, such as the order of reports in the print
7+
menu, or the order of server actions in the action menu.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
This module introduces the base to add the ability to edit the order in which
2+
records of models that inherit from ir.actions.actions.
3+
4+
To use this module, you need to (example for Reports):
5+
6+
#. Activate the developer mode
7+
#. Go to *Settings > Technical > Reports*.
8+
#. Search for any Report and edit its sequence.
9+
#. The reports will be ordered by sequence in the print menu.

base_ir_actions_sequence/static/description/index.html

Lines changed: 47 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
<?xml version="1.0" encoding="utf-8" ?>
21
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
32
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
43
<head>
54
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6-
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
7-
<title>Base Rule Visibility Restriction</title>
5+
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
6+
<title>Base Actions Sequence</title>
87
<style type="text/css">
98

109
/*
1110
:Author: David Goodger (goodger@python.org)
12-
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
11+
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
1312
:Copyright: This stylesheet has been placed in the public domain.
1413
1514
Default cascading style sheet for the HTML output of Docutils.
15+
Despite the name, some widely supported CSS2 features are used.
1616
17-
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
17+
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
1818
customize this style sheet.
1919
*/
2020

@@ -275,7 +275,7 @@
275275
margin-left: 2em ;
276276
margin-right: 2em }
277277

278-
pre.code .ln { color: grey; } /* line numbers */
278+
pre.code .ln { color: gray; } /* line numbers */
279279
pre.code, code { background-color: #eeeeee }
280280
pre.code .comment, code .comment { color: #5C6576 }
281281
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
@@ -301,7 +301,7 @@
301301
span.pre {
302302
white-space: pre }
303303

304-
span.problematic {
304+
span.problematic, pre.problematic {
305305
color: red }
306306

307307
span.section-subtitle {
@@ -360,71 +360,80 @@
360360
</style>
361361
</head>
362362
<body>
363-
<div class="document" id="base-rule-visibility-restriction">
364-
<h1 class="title">Base Rule Visibility Restriction</h1>
363+
<div class="document" id="base-actions-sequence">
364+
<h1 class="title">Base Actions Sequence</h1>
365365

366366
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
367367
!! This file is generated by oca-gen-addon-readme !!
368368
!! changes will be overwritten. !!
369+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370+
!! source digest: sha256:1be150d924e786874a620261feb0c42bdb392b6cce451367e39de04e1e84c6a5
369371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
370-
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/server-ux/tree/13.0/base_rule_visibility_restriction"><img alt="OCA/server-ux" src="https://img.shields.io/badge/github-OCA%2Fserver--ux-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/server-ux-13-0/server-ux-13-0-base_rule_visibility_restriction"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/250/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
371-
<p>This module lets you add “Excluded Groups” for Record Rules (ir.rule), when getting the record rules for Groups (res.groups) anywhere, if the user has the group for which a certain rule that should be applying has this group as one of it’s Excluded Groups, this record rule won’t appply.</p>
372+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-ux/tree/18.0/base_ir_actions_sequence"><img alt="OCA/server-ux" src="https://img.shields.io/badge/github-OCA%2Fserver--ux-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-ux-18-0/server-ux-18-0-base_ir_actions_sequence"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-ux&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373+
<p>This module allows to assign sequence to every action
374+
(<tt class="docutils literal">ir.actions.actions</tt>), and therefore any model that inherits from it
375+
(like <tt class="docutils literal">ir.actions.report</tt>, <tt class="docutils literal">ir.actions.server</tt>,
376+
<tt class="docutils literal">ir.actions.act_window</tt>…) can be ordered by sequence.</p>
377+
<p>This is useful when you want to control the order of actions displayed
378+
in various parts of the Odoo interface, such as the order of reports in
379+
the print menu, or the order of server actions in the action menu.</p>
372380
<p><strong>Table of contents</strong></p>
373381
<div class="contents local topic" id="contents">
374382
<ul class="simple">
375-
<li><a class="reference internal" href="#usage" id="id1">Usage</a></li>
376-
<li><a class="reference internal" href="#bug-tracker" id="id2">Bug Tracker</a></li>
377-
<li><a class="reference internal" href="#credits" id="id3">Credits</a><ul>
378-
<li><a class="reference internal" href="#authors" id="id4">Authors</a></li>
379-
<li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li>
380-
<li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li>
383+
<li><a class="reference internal" href="#usage" id="toc-entry-1">Usage</a></li>
384+
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-2">Bug Tracker</a></li>
385+
<li><a class="reference internal" href="#credits" id="toc-entry-3">Credits</a><ul>
386+
<li><a class="reference internal" href="#authors" id="toc-entry-4">Authors</a></li>
387+
<li><a class="reference internal" href="#contributors" id="toc-entry-5">Contributors</a></li>
388+
<li><a class="reference internal" href="#maintainers" id="toc-entry-6">Maintainers</a></li>
381389
</ul>
382390
</li>
383391
</ul>
384392
</div>
385393
<div class="section" id="usage">
386-
<h1><a class="toc-backref" href="#id1">Usage</a></h1>
387-
<p>To use this module, you need to:</p>
388-
<ol class="arabic simple">
389-
<li>Activate the developer mode</li>
390-
<li>Go to <em>Settings &gt; Technical &gt; Security &gt; Record Rules</em>.</li>
391-
<li>Search for the Record Rule and edit it.</li>
392-
<li>Update “Excluded groups” with the desired groups.</li>
393-
<li>Login with a user of that group, and the certaing Record Rule won’t apply.</li>
394-
</ol>
394+
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
395+
<p>This module introduces the base to add the ability to edit the order in
396+
which records of models that inherit from ir.actions.actions.</p>
397+
<p>To use this module, you need to (example for Reports):</p>
398+
<p>#. Activate the developer mode #. Go to <em>Settings &gt; Technical &gt;
399+
Reports</em>. #. Search for any Report and edit its sequence. #. The reports
400+
will be ordered by sequence in the print menu.</p>
395401
</div>
396402
<div class="section" id="bug-tracker">
397-
<h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
403+
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
398404
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-ux/issues">GitHub Issues</a>.
399405
In case of trouble, please check there if your issue has already been reported.
400-
If you spotted it first, help us smashing it by providing a detailed and welcomed
401-
<a class="reference external" href="https://github.com/OCA/server-ux/issues/new?body=module:%20base_rule_visibility_restriction%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
406+
If you spotted it first, help us to smash it by providing a detailed and welcomed
407+
<a class="reference external" href="https://github.com/OCA/server-ux/issues/new?body=module:%20base_ir_actions_sequence%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
402408
<p>Do not contact contributors directly about support or help with technical issues.</p>
403409
</div>
404410
<div class="section" id="credits">
405-
<h1><a class="toc-backref" href="#id3">Credits</a></h1>
411+
<h1><a class="toc-backref" href="#toc-entry-3">Credits</a></h1>
406412
<div class="section" id="authors">
407-
<h2><a class="toc-backref" href="#id4">Authors</a></h2>
413+
<h2><a class="toc-backref" href="#toc-entry-4">Authors</a></h2>
408414
<ul class="simple">
409415
<li>ForgeFlow</li>
410416
</ul>
411417
</div>
412418
<div class="section" id="contributors">
413-
<h2><a class="toc-backref" href="#id5">Contributors</a></h2>
419+
<h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
414420
<ul class="simple">
415-
<li>Guillem Casassas &lt;<a class="reference external" href="mailto:guillem.casassas&#64;forgeflow.com">guillem.casassas&#64;forgeflow.com</a>&gt;</li>
421+
<li><a class="reference external" href="https://www.forgeflow.com">ForgeFlow</a>:<ul>
422+
<li>Jaume Bernaus</li>
423+
</ul>
424+
</li>
416425
</ul>
417426
</div>
418427
<div class="section" id="maintainers">
419-
<h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
428+
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
420429
<p>This module is maintained by the OCA.</p>
421-
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
430+
<a class="reference external image-reference" href="https://odoo-community.org">
431+
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
432+
</a>
422433
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
423434
mission is to support the collaborative development of Odoo features and
424435
promote its widespread use.</p>
425-
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
426-
<p><a class="reference external" href="https://github.com/GuillemCForgeFlow"><img alt="GuillemCForgeFlow" src="https://github.com/GuillemCForgeFlow.png?size=40px" /></a></p>
427-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-ux/tree/13.0/base_rule_visibility_restriction">OCA/server-ux</a> project on GitHub.</p>
436+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-ux/tree/18.0/base_ir_actions_sequence">OCA/server-ux</a> project on GitHub.</p>
428437
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
429438
</div>
430439
</div>

0 commit comments

Comments
 (0)