Skip to content

Commit 6944613

Browse files
committed
[MIG] web_m2x_options_manager: Migration to 18.0
1 parent c799fa1 commit 6944613

File tree

7 files changed

+89
-83
lines changed

7 files changed

+89
-83
lines changed

web_m2x_options_manager/README.rst

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
.. image:: https://odoo-community.org/readme-banner-image
2-
:target: https://odoo-community.org/get-involved?utm_source=readme
3-
:alt: Odoo Community Association
4-
51
=======================
62
Web M2X Options Manager
73
=======================
@@ -17,17 +13,17 @@ Web M2X Options Manager
1713
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
1814
:target: https://odoo-community.org/page/development-status
1915
:alt: Beta
20-
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
2117
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
2218
:alt: License: AGPL-3
2319
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
24-
:target: https://github.com/OCA/web/tree/17.0/web_m2x_options_manager
20+
:target: https://github.com/OCA/web/tree/18.0/web_m2x_options_manager
2521
:alt: OCA/web
2622
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
27-
:target: https://translation.odoo-community.org/projects/web-17-0/web-17-0-web_m2x_options_manager
23+
:target: https://translation.odoo-community.org/projects/web-18-0/web-18-0-web_m2x_options_manager
2824
:alt: Translate me on Weblate
2925
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
30-
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=17.0
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=18.0
3127
:alt: Try me on Runboat
3228

3329
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -50,22 +46,23 @@ Choose the model you wish to edit, and open its form view. Go to the
5046
"Create/Edit Options" tab, and add the fields you want to manage in 2
5147
different sections:
5248

53-
- the first list view allows you to handle fields for the selected model
54-
- the second list view allows you to handle fields where the selected
55-
model is the comodel
49+
- the first list view allows you to handle fields for the selected
50+
model
51+
- the second list view allows you to handle fields where the selected
52+
model is the comodel
5653

5754
For both sections:
5855

59-
- button "Fill" will add every missing field to the options
60-
- button "Empty" will remove every option
56+
- button "Fill" will add every missing field to the options
57+
- button "Empty" will remove every option
6158

6259
Bug Tracker
6360
===========
6461

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

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

@@ -80,9 +77,9 @@ Authors
8077
Contributors
8178
------------
8279

83-
- `Camptocamp <https://www.camptocamp.com>`__:
80+
- `Camptocamp <https://www.camptocamp.com>`__:
8481

85-
- Silvio Gregorini
82+
- Silvio Gregorini
8683

8784
Maintainers
8885
-----------
@@ -97,6 +94,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
9794
mission is to support the collaborative development of Odoo features and
9895
promote its widespread use.
9996

100-
This module is part of the `OCA/web <https://github.com/OCA/web/tree/17.0/web_m2x_options_manager>`_ project on GitHub.
97+
This module is part of the `OCA/web <https://github.com/OCA/web/tree/18.0/web_m2x_options_manager>`_ project on GitHub.
10198

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

web_m2x_options_manager/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"summary": 'Adds an interface to manage the "Create" and'
77
' "Create and Edit" options for specific models and'
88
" fields.",
9-
"version": "17.0.1.0.0",
9+
"version": "18.0.1.0.0",
1010
"author": "Camptocamp, Odoo Community Association (OCA)",
1111
"license": "AGPL-3",
1212
"category": "Web",

web_m2x_options_manager/models/m2x_create_edit_option.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright 2021 Camptocamp SA
22
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
33

4-
from odoo import _, api, fields, models
4+
from odoo import api, fields, models
55
from odoo.exceptions import ValidationError
66
from odoo.tools.cache import ormcache
77
from odoo.tools.safe_eval import safe_eval
@@ -143,7 +143,7 @@ def _check_field_can_have_options(self):
143143
for opt in self:
144144
if opt.field_id and not opt.field_id.can_have_options:
145145
raise ValidationError(
146-
_(
146+
self.env._(
147147
"Field %(field)s cannot have M2X options",
148148
field=opt.field_id.display_name,
149149
)

web_m2x_options_manager/static/description/index.html

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
55
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
6-
<title>README.rst</title>
6+
<title>Web M2X Options Manager</title>
77
<style type="text/css">
88

99
/*
@@ -360,21 +360,16 @@
360360
</style>
361361
</head>
362362
<body>
363-
<div class="document">
363+
<div class="document" id="web-m2x-options-manager">
364+
<h1 class="title">Web M2X Options Manager</h1>
364365

365-
366-
<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
367-
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
368-
</a>
369-
<div class="section" id="web-m2x-options-manager">
370-
<h1>Web M2X Options Manager</h1>
371366
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
372367
!! This file is generated by oca-gen-addon-readme !!
373368
!! changes will be overwritten. !!
374369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
375370
!! source digest: sha256:496ff9c028368302f839913a2c4c825d59aa913df9048705ab11ce524d388144
376371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
377-
<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/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/web/tree/17.0/web_m2x_options_manager"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/web-17-0/web-17-0-web_m2x_options_manager"><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/web&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></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/web/tree/18.0/web_m2x_options_manager"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/web-18-0/web-18-0-web_m2x_options_manager"><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/web&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
378373
<p>Allows managing the “Create…” and “Create and Edit…” options for
379374
<tt class="docutils literal">Many2one</tt> and <tt class="docutils literal">Many2many</tt> fields directly from the <tt class="docutils literal">ir.model</tt>
380375
form view.</p>
@@ -392,13 +387,14 @@ <h1>Web M2X Options Manager</h1>
392387
</ul>
393388
</div>
394389
<div class="section" id="usage">
395-
<h2><a class="toc-backref" href="#toc-entry-1">Usage</a></h2>
390+
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
396391
<p>Go to Settings &gt; Technical &gt; Models.</p>
397392
<p>Choose the model you wish to edit, and open its form view. Go to the
398393
“Create/Edit Options” tab, and add the fields you want to manage in 2
399394
different sections:</p>
400395
<ul class="simple">
401-
<li>the first list view allows you to handle fields for the selected model</li>
396+
<li>the first list view allows you to handle fields for the selected
397+
model</li>
402398
<li>the second list view allows you to handle fields where the selected
403399
model is the comodel</li>
404400
</ul>
@@ -409,23 +405,23 @@ <h2><a class="toc-backref" href="#toc-entry-1">Usage</a></h2>
409405
</ul>
410406
</div>
411407
<div class="section" id="bug-tracker">
412-
<h2><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h2>
408+
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
413409
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web/issues">GitHub Issues</a>.
414410
In case of trouble, please check there if your issue has already been reported.
415411
If you spotted it first, help us to smash it by providing a detailed and welcomed
416-
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_m2x_options_manager%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
412+
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_m2x_options_manager%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
417413
<p>Do not contact contributors directly about support or help with technical issues.</p>
418414
</div>
419415
<div class="section" id="credits">
420-
<h2><a class="toc-backref" href="#toc-entry-3">Credits</a></h2>
416+
<h1><a class="toc-backref" href="#toc-entry-3">Credits</a></h1>
421417
<div class="section" id="authors">
422-
<h3><a class="toc-backref" href="#toc-entry-4">Authors</a></h3>
418+
<h2><a class="toc-backref" href="#toc-entry-4">Authors</a></h2>
423419
<ul class="simple">
424420
<li>Camptocamp</li>
425421
</ul>
426422
</div>
427423
<div class="section" id="contributors">
428-
<h3><a class="toc-backref" href="#toc-entry-5">Contributors</a></h3>
424+
<h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
429425
<ul class="simple">
430426
<li><a class="reference external" href="https://www.camptocamp.com">Camptocamp</a>:<ul>
431427
<li>Silvio Gregorini</li>
@@ -434,19 +430,18 @@ <h3><a class="toc-backref" href="#toc-entry-5">Contributors</a></h3>
434430
</ul>
435431
</div>
436432
<div class="section" id="maintainers">
437-
<h3><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h3>
433+
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
438434
<p>This module is maintained by the OCA.</p>
439435
<a class="reference external image-reference" href="https://odoo-community.org">
440436
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
441437
</a>
442438
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
443439
mission is to support the collaborative development of Odoo features and
444440
promote its widespread use.</p>
445-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/17.0/web_m2x_options_manager">OCA/web</a> project on GitHub.</p>
441+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/18.0/web_m2x_options_manager">OCA/web</a> project on GitHub.</p>
446442
<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>
447443
</div>
448444
</div>
449445
</div>
450-
</div>
451446
</body>
452447
</html>

web_m2x_options_manager/tests/common.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,15 @@
66
from odoo.tests.common import TransactionCase
77
from odoo.tools.safe_eval import safe_eval
88

9+
from odoo.addons.base.tests.common import BaseCommon
10+
911

1012
class Common(TransactionCase):
13+
@classmethod
14+
def setUpClass(cls):
15+
super().setUpClass()
16+
cls.env = cls.env["base"].with_context(**BaseCommon.default_env_context()).env
17+
1118
@classmethod
1219
def _create_opt(cls, model_name, field_name, vals=None):
1320
field = cls._get_field(model_name, field_name)

web_m2x_options_manager/views/ir_model.xml

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,46 +7,52 @@
77
<field name="arch" type="xml">
88
<xpath expr="//notebook/page[@name='fields']" position="after">
99
<page string="Create/Edit Options" name="create_edit_options">
10-
<field name="id" invisible="1" />
10+
<!-- prettier-ignore-start -->
11+
<!-- ``prettier`` will mess up the formatting of the buttons and divs... -->
1112
<div class="alert alert-info" role="alert">
12-
Here are displayed options for this model's fields<hr />
13+
Here are displayed options for this model's fields
14+
<hr />
1315
<div>
14-
<button
15-
name="button_fill_m2x_options"
16-
type="object"
17-
string="Fill"
18-
/>
19-
<button
20-
name="button_empty_m2x_options"
21-
type="object"
22-
string="Empty"
23-
/>
24-
</div>
16+
<button
17+
name="button_fill_m2x_options"
18+
type="object"
19+
string="Fill"
20+
/>
21+
<button
22+
name="button_empty_m2x_options"
23+
type="object"
24+
string="Empty"
25+
/>
26+
</div>
2527
</div>
28+
<!-- prettier-ignore-end -->
2629
<field
2730
name="m2x_option_ids"
28-
context="{'tree_view_ref': 'web_m2x_options_manager.m2x_create_edit_option_tree_o2m_filter_by_model'}"
31+
context="{'list_view_ref': 'web_m2x_options_manager.m2x_create_edit_option_list_o2m_filter_by_model'}"
2932
nolabel="1"
3033
/>
34+
<!-- prettier-ignore-start -->
35+
<!-- ``prettier`` will mess up the formatting of the buttons and divs... -->
3136
<div class="alert alert-info" role="alert">
32-
Here are displayed options for other models' fields related to this model<hr
33-
/>
37+
Here are displayed options for other models' fields related to this model
38+
<hr />
3439
<div>
35-
<button
36-
name="button_fill_m2x_comodels_options"
37-
type="object"
38-
string="Fill"
39-
/>
40-
<button
41-
name="button_empty_m2x_comodels_options"
42-
type="object"
43-
string="Empty"
44-
/>
45-
</div>
40+
<button
41+
name="button_fill_m2x_comodels_options"
42+
type="object"
43+
string="Fill"
44+
/>
45+
<button
46+
name="button_empty_m2x_comodels_options"
47+
type="object"
48+
string="Empty"
49+
/>
50+
</div>
4651
</div>
52+
<!-- prettier-ignore-end -->
4753
<field
4854
name="m2x_comodels_option_ids"
49-
context="{'tree_view_ref': 'web_m2x_options_manager.m2x_create_edit_option_tree_o2m_filter_by_comodel'}"
55+
context="{'list_view_ref': 'web_m2x_options_manager.m2x_create_edit_option_list_o2m_filter_by_comodel'}"
5056
nolabel="1"
5157
/>
5258
</page>

0 commit comments

Comments
 (0)