Skip to content

Commit 1e3a7be

Browse files
committed
[MIG] web_m2x_options_manager: Migration to 18.0
Field ``option_create_edit_wizard`` has been dropped in the migration: the pop-up wizard does not exist anymore, so the field has no use
1 parent fa5ec6c commit 1e3a7be

24 files changed

+822
-324
lines changed

test-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
odoo_test_helper

web_m2x_options_manager/README.rst

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ Web M2X Options Manager
2929
|badge1| |badge2| |badge3| |badge4| |badge5|
3030

3131
Allows managing the "Create..." and "Create and Edit..." options for
32-
Many2one and Many2many fields directly from the ir.model form view.
32+
``Many2one`` and ``Many2many`` fields directly from the ``ir.model``
33+
form view.
3334

3435
**Table of contents**
3536

@@ -42,10 +43,18 @@ Usage
4243
Go to Settings > Technical > Models.
4344

4445
Choose the model you wish to edit, and open its form view. Go to the
45-
"Create/Edit Options" tab, and add the fields you want to manage.
46+
"Create/Edit Options" tab, and add the fields you want to manage in 2
47+
different sections:
4648

47-
Button "Fill" will add every missing field to the options. Button
48-
"Empty" will remove every option.
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
53+
54+
For both sections:
55+
56+
- button "Fill" will add every missing field to the options
57+
- button "Empty" will remove every option
4958

5059
Bug Tracker
5160
===========
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
# Copyright 2021 Camptocamp SA
2-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3-
41
from . import models
2+
from .hooks import pre_init_hook

web_m2x_options_manager/__manifest__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,25 @@
66
"summary": 'Adds an interface to manage the "Create" and'
77
' "Create and Edit" options for specific models and'
88
" fields.",
9-
"version": "14.0.1.4.0",
9+
"version": "18.0.1.0.0",
1010
"author": "Camptocamp, Odoo Community Association (OCA)",
1111
"license": "AGPL-3",
1212
"category": "Web",
1313
"data": [
1414
"security/ir.model.access.csv",
1515
"views/ir_model.xml",
16+
"views/m2x_create_edit_option.xml",
1617
],
1718
"demo": [
1819
"demo/res_partner_demo_view.xml",
1920
],
20-
"depends": ["base", "web_m2x_options"],
21+
"depends": [
22+
# OCA/server-tools
23+
"base_view_inheritance_extension",
24+
# OCA/web
25+
"web_m2x_options",
26+
],
2127
"website": "https://github.com/OCA/web",
2228
"installable": True,
29+
"pre_init_hook": "pre_init_hook",
2330
}

web_m2x_options_manager/demo/res_partner_demo_view.xml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,18 @@
88
<form>
99
<sheet>
1010
<group>
11-
<!-- Many2one -->
11+
<!-- Many2one w/o options -->
1212
<field name="title" />
13-
<!-- Many2many -->
14-
<field name="category_id" options="{'create': False}" />
15-
<!-- One2many -->
16-
<field name="user_ids">
17-
<tree>
18-
<!-- Many2one within tree -->
19-
<field name="company_id" options="{'create': False}" />
20-
</tree>
21-
</field>
13+
<!-- Many2one w/ options -->
14+
<field
15+
name="parent_id"
16+
options="{'create': False, 'create_edit': False}"
17+
/>
18+
<!-- Many2many w/ options -->
19+
<field
20+
name="category_id"
21+
options="{'create': False, 'create_edit': False}"
22+
/>
2223
</group>
2324
</sheet>
2425
</form>

web_m2x_options_manager/hooks.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright 2025 Camptocamp SA
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
from .tools import prepare_column_can_have_options, prepare_column_comodel_id
5+
6+
7+
def pre_init_hook(env):
8+
# Pre-create and pre-fill these columns for perf reasons (might take a while to
9+
# let Odoo do it via the ORM for huge DBs)
10+
prepare_column_can_have_options(env.cr)
11+
prepare_column_comodel_id(env.cr)

web_m2x_options_manager/i18n/it.po

Lines changed: 11 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
#
55
msgid ""
66
msgstr ""
7-
"Project-Id-Version: Odoo Server 14.0\n"
7+
"Project-Id-Version: Odoo Server 16.0\n"
88
"Report-Msgid-Bugs-To: \n"
9-
"PO-Revision-Date: 2025-01-16 15:06+0000\n"
9+
"PO-Revision-Date: 2024-11-14 18:06+0000\n"
1010
"Last-Translator: mymage <[email protected]>\n"
1111
"Language-Team: none\n"
1212
"Language: it\n"
@@ -17,10 +17,11 @@ msgstr ""
1717
"X-Generator: Weblate 5.6.2\n"
1818

1919
#. module: web_m2x_options_manager
20+
#. odoo-python
2021
#: code:addons/web_m2x_options_manager/models/m2x_create_edit_option.py:0
2122
#, python-format
22-
msgid "'%s' is not a valid field for model '%s'!"
23-
msgstr "'%s' non è un campo valido per il modello '%s'!"
23+
msgid "'%(field_name)s' is not a valid field for model '%(model_name)s'!"
24+
msgstr "'%(field_name)s' non è un campo valido per il modello '%(model_name)s'!"
2425

2526
#. module: web_m2x_options_manager
2627
#: model:ir.model.fields.selection,name:web_m2x_options_manager.selection__m2x_create_edit_option__option_create__set_true
@@ -33,11 +34,6 @@ msgstr "Aggiungi"
3334
msgid "Create & Edit Option"
3435
msgstr "Opzione crea & modifica"
3536

36-
#. module: web_m2x_options_manager
37-
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_m2x_create_edit_option__option_create_edit_wizard
38-
msgid "Create & Edit Wizard"
39-
msgstr "Procedura guidata crea & modifica"
40-
4137
#. module: web_m2x_options_manager
4238
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_m2x_create_edit_option__option_create
4339
msgid "Create Option"
@@ -58,25 +54,13 @@ msgstr "Creato da"
5854
msgid "Created on"
5955
msgstr "Creato il"
6056

61-
#. module: web_m2x_options_manager
62-
#: model:ir.model.fields,help:web_m2x_options_manager.field_m2x_create_edit_option__option_create_edit_wizard
63-
msgid ""
64-
"Defines behaviour for 'Create & Edit' Wizard\n"
65-
"Set to False to prevent 'Create & Edit' Wizard to pop up"
66-
msgstr ""
67-
"Definisce il comportamento per la procedura guidata 'crea & modifica'\n"
68-
"Imposta a Falso per impedire il pop up della procedura guidata 'crea & "
69-
"modifica'"
70-
7157
#. module: web_m2x_options_manager
7258
#: model:ir.model.fields,help:web_m2x_options_manager.field_m2x_create_edit_option__option_create_edit
7359
msgid ""
7460
"Defines behaviour for 'Create & Edit' option:\n"
7561
"* Do nothing: nothing is done\n"
76-
"* Add/Remove: option 'Create & Edit' is set to True/False only if not "
77-
"already present in view definition\n"
78-
"* Force Add/Remove: option 'Create & Edit' is always set to True/False, "
79-
"overriding any pre-existing option"
62+
"* Add/Remove: option 'Create & Edit' is set to True/False only if not already present in view definition\n"
63+
"* Force Add/Remove: option 'Create & Edit' is always set to True/False, overriding any pre-existing option"
8064
msgstr ""
8165
"Definisce il comportamento per l'opzione 'Crea e modifica':\n"
8266
"* Non fare nulla: non viene fatto nulla\n"
@@ -90,10 +74,8 @@ msgstr ""
9074
msgid ""
9175
"Defines behaviour for 'Create' option:\n"
9276
"* Do nothing: nothing is done\n"
93-
"* Add/Remove: option 'Create' is set to True/False only if not already "
94-
"present in view definition\n"
95-
"* Force Add/Remove: option 'Create' is always set to True/False, overriding "
96-
"any pre-existing option"
77+
"* Add/Remove: option 'Create' is set to True/False only if not already present in view definition\n"
78+
"* Force Add/Remove: option 'Create' is always set to True/False, overriding any pre-existing option"
9779
msgstr ""
9880
"Definisce il comportamento per l'opzione 'Crea':\n"
9981
"* Non fare nulla: non viene fatto nulla\n"
@@ -103,9 +85,6 @@ msgstr ""
10385
"sovrascrivendo qualsiasi opzione preesistente"
10486

10587
#. module: web_m2x_options_manager
106-
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_ir_model__display_name
107-
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_ir_model_fields__display_name
108-
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_ir_ui_view__display_name
10988
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_m2x_create_edit_option__display_name
11089
msgid "Display Name"
11190
msgstr "Nome visualizzato"
@@ -154,17 +133,11 @@ msgid "Force Remove"
154133
msgstr "Forza rimuovi"
155134

156135
#. module: web_m2x_options_manager
157-
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_ir_model__id
158-
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_ir_model_fields__id
159-
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_ir_ui_view__id
160136
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_m2x_create_edit_option__id
161137
msgid "ID"
162138
msgstr "ID"
163139

164140
#. module: web_m2x_options_manager
165-
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_ir_model____last_update
166-
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_ir_model_fields____last_update
167-
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_ir_ui_view____last_update
168141
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_m2x_create_edit_option____last_update
169142
msgid "Last Modified on"
170143
msgstr "Ultima modifica il"
@@ -180,7 +153,7 @@ msgid "Last Updated on"
180153
msgstr "Ultimo aggiornamento il"
181154

182155
#. module: web_m2x_options_manager
183-
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_ir_model__m2x_create_edit_option_ids
156+
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_ir_model__m2x_option_ids
184157
msgid "M2X Create Edit Option"
185158
msgstr "Crea opzione modifica M2X"
186159

@@ -205,6 +178,7 @@ msgid "Models"
205178
msgstr "Modelli"
206179

207180
#. module: web_m2x_options_manager
181+
#. odoo-python
208182
#: code:addons/web_m2x_options_manager/models/m2x_create_edit_option.py:0
209183
#, python-format
210184
msgid "Only Many2many and Many2one fields can be chosen!"
@@ -225,6 +199,3 @@ msgstr "Rimuovi"
225199
#: model:ir.model,name:web_m2x_options_manager.model_ir_ui_view
226200
msgid "View"
227201
msgstr "Vista"
228-
229-
#~ msgid "Fields Description"
230-
#~ msgstr "Descrizione campi"

web_m2x_options_manager/i18n/web_m2x_options_manager.pot

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
msgid ""
66
msgstr ""
7-
"Project-Id-Version: Odoo Server 14.0\n"
7+
"Project-Id-Version: Odoo Server 16.0\n"
88
"Report-Msgid-Bugs-To: \n"
99
"Last-Translator: \n"
1010
"Language-Team: \n"
@@ -14,9 +14,10 @@ msgstr ""
1414
"Plural-Forms: \n"
1515

1616
#. module: web_m2x_options_manager
17+
#. odoo-python
1718
#: code:addons/web_m2x_options_manager/models/m2x_create_edit_option.py:0
1819
#, python-format
19-
msgid "'%s' is not a valid field for model '%s'!"
20+
msgid "'%(field_name)s' is not a valid field for model '%(model_name)s'!"
2021
msgstr ""
2122

2223
#. module: web_m2x_options_manager
@@ -30,11 +31,6 @@ msgstr ""
3031
msgid "Create & Edit Option"
3132
msgstr ""
3233

33-
#. module: web_m2x_options_manager
34-
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_m2x_create_edit_option__option_create_edit_wizard
35-
msgid "Create & Edit Wizard"
36-
msgstr ""
37-
3834
#. module: web_m2x_options_manager
3935
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_m2x_create_edit_option__option_create
4036
msgid "Create Option"
@@ -55,13 +51,6 @@ msgstr ""
5551
msgid "Created on"
5652
msgstr ""
5753

58-
#. module: web_m2x_options_manager
59-
#: model:ir.model.fields,help:web_m2x_options_manager.field_m2x_create_edit_option__option_create_edit_wizard
60-
msgid ""
61-
"Defines behaviour for 'Create & Edit' Wizard\n"
62-
"Set to False to prevent 'Create & Edit' Wizard to pop up"
63-
msgstr ""
64-
6554
#. module: web_m2x_options_manager
6655
#: model:ir.model.fields,help:web_m2x_options_manager.field_m2x_create_edit_option__option_create_edit
6756
msgid ""
@@ -81,9 +70,6 @@ msgid ""
8170
msgstr ""
8271

8372
#. module: web_m2x_options_manager
84-
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_ir_model__display_name
85-
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_ir_model_fields__display_name
86-
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_ir_ui_view__display_name
8773
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_m2x_create_edit_option__display_name
8874
msgid "Display Name"
8975
msgstr ""
@@ -132,17 +118,11 @@ msgid "Force Remove"
132118
msgstr ""
133119

134120
#. module: web_m2x_options_manager
135-
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_ir_model__id
136-
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_ir_model_fields__id
137-
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_ir_ui_view__id
138121
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_m2x_create_edit_option__id
139122
msgid "ID"
140123
msgstr ""
141124

142125
#. module: web_m2x_options_manager
143-
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_ir_model____last_update
144-
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_ir_model_fields____last_update
145-
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_ir_ui_view____last_update
146126
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_m2x_create_edit_option____last_update
147127
msgid "Last Modified on"
148128
msgstr ""
@@ -158,7 +138,7 @@ msgid "Last Updated on"
158138
msgstr ""
159139

160140
#. module: web_m2x_options_manager
161-
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_ir_model__m2x_create_edit_option_ids
141+
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_ir_model__m2x_option_ids
162142
msgid "M2X Create Edit Option"
163143
msgstr ""
164144

@@ -183,6 +163,7 @@ msgid "Models"
183163
msgstr ""
184164

185165
#. module: web_m2x_options_manager
166+
#. odoo-python
186167
#: code:addons/web_m2x_options_manager/models/m2x_create_edit_option.py:0
187168
#, python-format
188169
msgid "Only Many2many and Many2one fields can be chosen!"
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# Copyright 2021 Camptocamp SA
2-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3-
41
from . import ir_model
2+
from . import ir_model_fields
53
from . import ir_ui_view
64
from . import m2x_create_edit_option

0 commit comments

Comments
 (0)