Skip to content

Commit 24752da

Browse files
[MIG] server_action_sort: Migration to 18.0
1 parent adc8eb0 commit 24752da

File tree

9 files changed

+77
-72
lines changed

9 files changed

+77
-72
lines changed

server_action_sort/README.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,21 +68,21 @@ Usage
6868
- Select some items you want to reorder.
6969
- click on 'Action' Button
7070

71-
|image1|
71+
|Sale Order Tree|
7272

7373
- then click on the name of the configured Action and see the results
7474

7575
**Before**
7676

77-
|image2|
77+
|Sale Order Form Before|
7878

7979
**After**
8080

81-
|image3|
81+
|Sale Order Form After|
8282

83-
.. |image1| image:: https://raw.githubusercontent.com/OCA/server-backend/18.0/server_action_sort/static/description/sale_order_tree.png
84-
.. |image2| image:: https://raw.githubusercontent.com/OCA/server-backend/18.0/server_action_sort/static/description/sale_order_form_before.png
85-
.. |image3| image:: https://raw.githubusercontent.com/OCA/server-backend/18.0/server_action_sort/static/description/sale_order_form_after.png
83+
.. |Sale Order Tree| image:: https://raw.githubusercontent.com/OCA/server-backend/18.0/server_action_sort/static/description/sale_order_tree.png
84+
.. |Sale Order Form Before| image:: https://raw.githubusercontent.com/OCA/server-backend/18.0/server_action_sort/static/description/sale_order_form_before.png
85+
.. |Sale Order Form After| image:: https://raw.githubusercontent.com/OCA/server-backend/18.0/server_action_sort/static/description/sale_order_form_after.png
8686

8787
Known issues / Roadmap
8888
======================
@@ -113,6 +113,9 @@ Contributors
113113
------------
114114

115115
- Sylvain LE GAL (https://www.twitter.com/legalsylvain)
116+
- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`__
117+
118+
- Bhavesh Heliconia
116119

117120
Maintainers
118121
-----------

server_action_sort/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
{
66
"name": "Server Actions - Mass Sort Lines",
7-
"version": "16.0.1.0.0",
7+
"version": "18.0.1.0.0",
88
"author": "GRAP, " "Odoo Community Association (OCA)",
99
"summary": "Sort any lines of any models by any criterias",
1010
"category": "Tools",

server_action_sort/models/ir_actions_server.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
33
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
44

5-
from odoo import _, fields, models
5+
from odoo import fields, models
66
from odoo.exceptions import UserError
77

88

@@ -33,13 +33,15 @@ def _run_action_sort_multi(self, eval_context=None):
3333
self.ensure_one()
3434
if len(self.sort_line_ids) == 0:
3535
raise UserError(
36-
_("The Action Server %s is not correctly set :\n" "No lines defined")
36+
self.env._(
37+
"The Action Server %s is not correctly set :\n" "No lines defined"
38+
)
3739
% (self.name)
3840
)
3941

4042
if eval_context is None:
4143
raise UserError(
42-
_(
44+
self.env._(
4345
"You can not run this Action Server that way.\n"
4446
" Please use contextual 'Action' menu."
4547
)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
- Sylvain LE GAL (<https://www.twitter.com/legalsylvain>)
2+
- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io)
3+
- Bhavesh Heliconia

server_action_sort/readme/USAGE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
- Select some items you want to reorder.
44
- click on 'Action' Button
55

6-
![](../static/description/sale_order_tree.png)
6+
![Sale Order Tree](../static/description/sale_order_tree.png)
77

88
- then click on the name of the configured Action and see the results
99

1010
**Before**
1111

12-
![](../static/description/sale_order_form_before.png)
12+
![Sale Order Form Before](../static/description/sale_order_form_before.png)
1313

1414
**After**
1515

16-
![](../static/description/sale_order_form_after.png)
16+
![Sale Order Form After](../static/description/sale_order_form_after.png)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
2-
ir_actions_server_sort_line_all,ir_actions_server_sort_line_all,model_ir_actions_server_sort_line,,1,0,0,0
2+
ir_actions_server_sort_line_all,ir_actions_server_sort_line_all,model_ir_actions_server_sort_line,base.group_user,1,0,0,0
33
ir_actions_server_sort_line_group_system,ir_actions_server_sort_line_group_system,model_ir_actions_server_sort_line,base.group_system,1,1,1,1

server_action_sort/static/description/index.html

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
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>
@@ -9,10 +8,11 @@
98

109
/*
1110
:Author: David Goodger (goodger@python.org)
12-
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z 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
1717
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
1818
customize this style sheet.
@@ -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 {
@@ -369,11 +369,11 @@ <h1 class="title">Server Actions - Mass Sort Lines</h1>
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370370
!! source digest: sha256:e221269a77f3ad06e190cd3f0c72ecdfc6d1cd0022b81e3ec57722b3c6dad475
371371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
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/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 image-reference" href="https://github.com/OCA/server-backend/tree/16.0/server_action_sort"><img alt="OCA/server-backend" src="https://img.shields.io/badge/github-OCA%2Fserver--backend-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-backend-16-0/server-backend-16-0-server_action_sort"><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-backend&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373-
<p>This module provides a generic tools to have the possibility to sort the lines
374-
of a list of items.</p>
375-
<p>For exemple, if you use the sale module, you can want to reorder the sale
376-
order lines, by any criterias.</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/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 image-reference" href="https://github.com/OCA/server-backend/tree/18.0/server_action_sort"><img alt="OCA/server-backend" src="https://img.shields.io/badge/github-OCA%2Fserver--backend-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-backend-18-0/server-backend-18-0-server_action_sort"><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-backend&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 provides a generic tools to have the possibility to sort the
374+
lines of a list of items.</p>
375+
<p>For exemple, if you use the sale module, you can want to reorder the
376+
sale order lines, by any criterias.</p>
377377
<p><strong>Table of contents</strong></p>
378378
<div class="contents local topic" id="contents">
379379
<ul class="simple">
@@ -395,14 +395,13 @@ <h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
395395
<li>Go to ‘Setting / Technical / Actions / Server Actions’</li>
396396
<li>Create a new item</li>
397397
</ul>
398-
<div class="figure">
399-
<img alt="https://raw.githubusercontent.com/OCA/server-backend/16.0/server_action_sort/static/description/ir_actions_server_form.png" src="https://raw.githubusercontent.com/OCA/server-backend/16.0/server_action_sort/static/description/ir_actions_server_form.png" />
400-
</div>
398+
<p><img alt="image1" src="https://raw.githubusercontent.com/OCA/server-backend/18.0/server_action_sort/static/description/ir_actions_server_form.png" /></p>
401399
<ul class="simple">
402400
<li>Set a name that will be used for the Contextual Action</li>
403401
<li>choose a model</li>
404402
<li>Select ‘Sort’ option in the field ‘Action To Do’</li>
405-
<li>Then, select a field to sort of this model. It should be a <tt class="docutils literal">one2many</tt> field.</li>
403+
<li>Then, select a field to sort of this model. It should be a
404+
<tt class="docutils literal">one2many</tt> field.</li>
406405
<li>Select then the criterias used to sort the selected field.</li>
407406
</ul>
408407
<p><strong>Extra options</strong></p>
@@ -413,37 +412,32 @@ <h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
413412
<div class="section" id="usage">
414413
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
415414
<ul class="simple">
416-
<li>Go to a tree view, for a model for which you have defined a ‘Sort’ action.</li>
415+
<li>Go to a tree view, for a model for which you have defined a ‘Sort’
416+
action.</li>
417417
<li>Select some items you want to reorder.</li>
418418
<li>click on ‘Action’ Button</li>
419419
</ul>
420-
<div class="figure">
421-
<img alt="https://raw.githubusercontent.com/OCA/server-backend/16.0/server_action_sort/static/description/sale_order_tree.png" src="https://raw.githubusercontent.com/OCA/server-backend/16.0/server_action_sort/static/description/sale_order_tree.png" />
422-
</div>
420+
<p><img alt="Sale Order Tree" src="https://raw.githubusercontent.com/OCA/server-backend/18.0/server_action_sort/static/description/sale_order_tree.png" /></p>
423421
<ul class="simple">
424422
<li>then click on the name of the configured Action and see the results</li>
425423
</ul>
426424
<p><strong>Before</strong></p>
427-
<div class="figure">
428-
<img alt="https://raw.githubusercontent.com/OCA/server-backend/16.0/server_action_sort/static/description/sale_order_form_before.png" src="https://raw.githubusercontent.com/OCA/server-backend/16.0/server_action_sort/static/description/sale_order_form_before.png" />
429-
</div>
425+
<p><img alt="Sale Order Form Before" src="https://raw.githubusercontent.com/OCA/server-backend/18.0/server_action_sort/static/description/sale_order_form_before.png" /></p>
430426
<p><strong>After</strong></p>
431-
<div class="figure">
432-
<img alt="https://raw.githubusercontent.com/OCA/server-backend/16.0/server_action_sort/static/description/sale_order_form_after.png" src="https://raw.githubusercontent.com/OCA/server-backend/16.0/server_action_sort/static/description/sale_order_form_after.png" />
433-
</div>
427+
<p><img alt="Sale Order Form After" src="https://raw.githubusercontent.com/OCA/server-backend/18.0/server_action_sort/static/description/sale_order_form_after.png" /></p>
434428
</div>
435429
<div class="section" id="known-issues-roadmap">
436430
<h1><a class="toc-backref" href="#toc-entry-3">Known issues / Roadmap</a></h1>
437-
<p>For instance, the module allow to order with many criterias, but
438-
without “dot” notation : it is not possible to order sale order lines
439-
by <tt class="docutils literal">product_id.seller_ids.code</tt> for exemple.</p>
431+
<p>For instance, the module allow to order with many criterias, but without
432+
“dot” notation : it is not possible to order sale order lines by
433+
<tt class="docutils literal">product_id.seller_ids.code</tt> for exemple.</p>
440434
</div>
441435
<div class="section" id="bug-tracker">
442436
<h1><a class="toc-backref" href="#toc-entry-4">Bug Tracker</a></h1>
443437
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-backend/issues">GitHub Issues</a>.
444438
In case of trouble, please check there if your issue has already been reported.
445439
If you spotted it first, help us to smash it by providing a detailed and welcomed
446-
<a class="reference external" href="https://github.com/OCA/server-backend/issues/new?body=module:%20server_action_sort%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
440+
<a class="reference external" href="https://github.com/OCA/server-backend/issues/new?body=module:%20server_action_sort%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
447441
<p>Do not contact contributors directly about support or help with technical issues.</p>
448442
</div>
449443
<div class="section" id="credits">
@@ -458,18 +452,24 @@ <h2><a class="toc-backref" href="#toc-entry-6">Authors</a></h2>
458452
<h2><a class="toc-backref" href="#toc-entry-7">Contributors</a></h2>
459453
<ul class="simple">
460454
<li>Sylvain LE GAL (<a class="reference external" href="https://www.twitter.com/legalsylvain">https://www.twitter.com/legalsylvain</a>)</li>
455+
<li><a class="reference external" href="https://www.heliconia.io">Heliconia Solutions Pvt. Ltd.</a><ul>
456+
<li>Bhavesh Heliconia</li>
457+
</ul>
458+
</li>
461459
</ul>
462460
</div>
463461
<div class="section" id="maintainers">
464462
<h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
465463
<p>This module is maintained by the OCA.</p>
466-
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
464+
<a class="reference external image-reference" href="https://odoo-community.org">
465+
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
466+
</a>
467467
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
468468
mission is to support the collaborative development of Odoo features and
469469
promote its widespread use.</p>
470470
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
471471
<p><a class="reference external image-reference" href="https://github.com/legalsylvain"><img alt="legalsylvain" src="https://github.com/legalsylvain.png?size=40px" /></a></p>
472-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-backend/tree/16.0/server_action_sort">OCA/server-backend</a> project on GitHub.</p>
472+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-backend/tree/18.0/server_action_sort">OCA/server-backend</a> project on GitHub.</p>
473473
<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>
474474
</div>
475475
</div>

server_action_sort/tests/test_module.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66

77

88
class TestModule(TransactionCase):
9-
def setUp(self):
10-
super().setUp()
11-
self.action_server = self.env.ref("server_action_sort.sort_action_server_lines")
12-
self.line_1 = self.env.ref("server_action_sort.sort_action_server_lines_line_1")
13-
self.line_2 = self.env.ref("server_action_sort.sort_action_server_lines_line_2")
9+
@classmethod
10+
def setUpClass(cls):
11+
super().setUpClass()
12+
cls.action_server = cls.env.ref("server_action_sort.sort_action_server_lines")
13+
cls.line_1 = cls.env.ref("server_action_sort.sort_action_server_lines_line_1")
14+
cls.line_2 = cls.env.ref("server_action_sort.sort_action_server_lines_line_2")
1415

1516
def test_action_result(self):
1617
self.assertEqual(self.line_1.sequence, 1)

server_action_sort/views/view_ir_actions_server.xml

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,28 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
99
<field name="model">ir.actions.server</field>
1010
<field name="inherit_id" ref="base.view_server_action_form" />
1111
<field name="arch" type="xml">
12-
<xpath expr="//page[@name='code']" position="after">
13-
<page
14-
string="Sort Options"
15-
name='page_sort'
16-
autofocus="autofocus"
17-
attrs="{'invisible': [('state', '!=', 'sort')]}"
12+
<xpath expr="//field[@name='child_ids']" position="after">
13+
<field
14+
name="sort_line_ids"
15+
nolabel="1"
16+
colspan="2"
17+
invisible="state != 'sort'"
1818
>
19-
<group>
20-
<field
21-
name="sort_field_id"
22-
attrs="{'required': [('state', '=', 'sort')]}"
23-
/>
24-
<field name="sort_field_id_model" />
25-
</group>
26-
<group>
27-
<field name="sort_line_ids" nolabel="1" colspan="2">
28-
<tree editable="bottom">
29-
<field name="sequence" widget="handle" />
30-
<field name="field_id" />
31-
<field name="field_name" />
32-
<field name="desc" />
33-
</tree>
34-
</field>
35-
</group>
36-
</page>
19+
<list editable="bottom">
20+
<field name="sequence" widget="handle" />
21+
<field name="field_id" />
22+
<field name="field_name" />
23+
<field name="desc" />
24+
</list>
25+
</field>
26+
</xpath>
27+
<xpath expr="//group[@name='action_content']" position="inside">
28+
<field
29+
name="sort_field_id"
30+
required="state == 'sort'"
31+
invisible="state != 'sort'"
32+
/>
33+
<field name="sort_field_id_model" invisible="state != 'sort'" />
3734
</xpath>
3835
</field>
3936
</record>

0 commit comments

Comments
 (0)