Skip to content

Commit c749d88

Browse files
committed
Merge PR #3361 into 18.0
Signed-off-by tarteo
2 parents 3a6d26c + 936c959 commit c749d88

28 files changed

+2005
-0
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: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
=======================
2+
Web M2X Options Manager
3+
=======================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:496ff9c028368302f839913a2c4c825d59aa913df9048705ab11ce524d388144
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
20+
:target: https://github.com/OCA/web/tree/18.0/web_m2x_options_manager
21+
:alt: OCA/web
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/web-18-0/web-18-0-web_m2x_options_manager
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=18.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
Allows managing the "Create..." and "Create and Edit..." options for
32+
``Many2one`` and ``Many2many`` fields directly from the ``ir.model``
33+
form view.
34+
35+
**Table of contents**
36+
37+
.. contents::
38+
:local:
39+
40+
Usage
41+
=====
42+
43+
Go to Settings > Technical > Models.
44+
45+
Choose the model you wish to edit, and open its form view. Go to the
46+
"Create/Edit Options" tab, and add the fields you want to manage in 2
47+
different sections:
48+
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
58+
59+
Bug Tracker
60+
===========
61+
62+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
63+
In case of trouble, please check there if your issue has already been reported.
64+
If you spotted it first, help us to smash it by providing a detailed and welcomed
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**>`_.
66+
67+
Do not contact contributors directly about support or help with technical issues.
68+
69+
Credits
70+
=======
71+
72+
Authors
73+
-------
74+
75+
* Camptocamp
76+
77+
Contributors
78+
------------
79+
80+
- `Camptocamp <https://www.camptocamp.com>`__:
81+
82+
- Silvio Gregorini
83+
84+
Maintainers
85+
-----------
86+
87+
This module is maintained by the OCA.
88+
89+
.. image:: https://odoo-community.org/logo.png
90+
:alt: Odoo Community Association
91+
:target: https://odoo-community.org
92+
93+
OCA, or the Odoo Community Association, is a nonprofit organization whose
94+
mission is to support the collaborative development of Odoo features and
95+
promote its widespread use.
96+
97+
This module is part of the `OCA/web <https://github.com/OCA/web/tree/18.0/web_m2x_options_manager>`_ project on GitHub.
98+
99+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from . import models
2+
from .hooks import pre_init_hook
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright 2021 Camptocamp SA
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "Web M2X Options Manager",
6+
"summary": 'Adds an interface to manage the "Create" and'
7+
' "Create and Edit" options for specific models and'
8+
" fields.",
9+
"version": "18.0.1.0.0",
10+
"author": "Camptocamp, Odoo Community Association (OCA)",
11+
"license": "AGPL-3",
12+
"category": "Web",
13+
"data": [
14+
"security/ir.model.access.csv",
15+
"views/ir_model.xml",
16+
"views/m2x_create_edit_option.xml",
17+
],
18+
"demo": [
19+
"demo/res_partner_demo_view.xml",
20+
],
21+
"depends": [
22+
# OCA/server-tools
23+
"base_view_inheritance_extension",
24+
# OCA/web
25+
"web_m2x_options",
26+
],
27+
"website": "https://github.com/OCA/web",
28+
"installable": True,
29+
"pre_init_hook": "pre_init_hook",
30+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<odoo>
3+
<record id="res_partner_demo_form_view" model="ir.ui.view">
4+
<field name="name">res.partner.demo.form.view</field>
5+
<field name="model">res.partner</field>
6+
<field name="priority">1000</field>
7+
<field name="arch" type="xml">
8+
<form>
9+
<sheet>
10+
<group>
11+
<!-- Many2one w/o options -->
12+
<field name="title" />
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+
/>
23+
</group>
24+
</sheet>
25+
</form>
26+
</field>
27+
</record>
28+
</odoo>

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: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * web_m2x_options_manager
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 16.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"PO-Revision-Date: 2024-11-14 18:06+0000\n"
10+
"Last-Translator: mymage <[email protected]>\n"
11+
"Language-Team: none\n"
12+
"Language: it\n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=UTF-8\n"
15+
"Content-Transfer-Encoding: \n"
16+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
17+
"X-Generator: Weblate 5.6.2\n"
18+
19+
#. module: web_m2x_options_manager
20+
#. odoo-python
21+
#: code:addons/web_m2x_options_manager/models/m2x_create_edit_option.py:0
22+
#, python-format
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'!"
25+
26+
#. module: web_m2x_options_manager
27+
#: model:ir.model.fields.selection,name:web_m2x_options_manager.selection__m2x_create_edit_option__option_create__set_true
28+
#: model:ir.model.fields.selection,name:web_m2x_options_manager.selection__m2x_create_edit_option__option_create_edit__set_true
29+
msgid "Add"
30+
msgstr "Aggiungi"
31+
32+
#. module: web_m2x_options_manager
33+
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_m2x_create_edit_option__option_create_edit
34+
msgid "Create & Edit Option"
35+
msgstr "Opzione crea & modifica"
36+
37+
#. module: web_m2x_options_manager
38+
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_m2x_create_edit_option__option_create
39+
msgid "Create Option"
40+
msgstr "Opzione crea"
41+
42+
#. module: web_m2x_options_manager
43+
#: model_terms:ir.ui.view,arch_db:web_m2x_options_manager.view_model_form_inherit
44+
msgid "Create/Edit Options"
45+
msgstr "Opzioni crea/modifica"
46+
47+
#. module: web_m2x_options_manager
48+
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_m2x_create_edit_option__create_uid
49+
msgid "Created by"
50+
msgstr "Creato da"
51+
52+
#. module: web_m2x_options_manager
53+
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_m2x_create_edit_option__create_date
54+
msgid "Created on"
55+
msgstr "Creato il"
56+
57+
#. module: web_m2x_options_manager
58+
#: model:ir.model.fields,help:web_m2x_options_manager.field_m2x_create_edit_option__option_create_edit
59+
msgid ""
60+
"Defines behaviour for 'Create & Edit' option:\n"
61+
"* Do nothing: nothing is done\n"
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"
64+
msgstr ""
65+
"Definisce il comportamento per l'opzione 'Crea e modifica':\n"
66+
"* Non fare nulla: non viene fatto nulla\n"
67+
"* Aggiungi/Rimuovi: l'opzione 'Crea e modifica' è impostata su Vero/Falso "
68+
"solo se non è già presente nella definizione della vista\n"
69+
"* Forza Aggiungi/Rimuovi: l'opzione 'Crea e modifica' è sempre impostata su "
70+
"Vero/Falso, sovrascrivendo qualsiasi opzione preesistente"
71+
72+
#. module: web_m2x_options_manager
73+
#: model:ir.model.fields,help:web_m2x_options_manager.field_m2x_create_edit_option__option_create
74+
msgid ""
75+
"Defines behaviour for 'Create' option:\n"
76+
"* Do nothing: nothing is done\n"
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"
79+
msgstr ""
80+
"Definisce il comportamento per l'opzione 'Crea':\n"
81+
"* Non fare nulla: non viene fatto nulla\n"
82+
"* Aggiungi/Rimuovi: l'opzione 'Crea' è impostata su Vero/Falso solo se non è "
83+
"già presente nella definizione della vista\n"
84+
"* Forza Aggiungi/Rimuovi: l'opzione 'Crea' è sempre impostata su Vero/Falso, "
85+
"sovrascrivendo qualsiasi opzione preesistente"
86+
87+
#. module: web_m2x_options_manager
88+
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_m2x_create_edit_option__display_name
89+
msgid "Display Name"
90+
msgstr "Nome visualizzato"
91+
92+
#. module: web_m2x_options_manager
93+
#: model:ir.model.fields.selection,name:web_m2x_options_manager.selection__m2x_create_edit_option__option_create__none
94+
#: model:ir.model.fields.selection,name:web_m2x_options_manager.selection__m2x_create_edit_option__option_create_edit__none
95+
msgid "Do nothing"
96+
msgstr "Non fare nulla"
97+
98+
#. module: web_m2x_options_manager
99+
#: model_terms:ir.ui.view,arch_db:web_m2x_options_manager.view_model_form_inherit
100+
msgid "Empty"
101+
msgstr "Vuoto"
102+
103+
#. module: web_m2x_options_manager
104+
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_m2x_create_edit_option__field_id
105+
msgid "Field"
106+
msgstr "Campo"
107+
108+
#. module: web_m2x_options_manager
109+
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_m2x_create_edit_option__field_name
110+
msgid "Field Name"
111+
msgstr "Nome campo"
112+
113+
#. module: web_m2x_options_manager
114+
#: model:ir.model,name:web_m2x_options_manager.model_ir_model_fields
115+
msgid "Fields"
116+
msgstr "Campi"
117+
118+
#. module: web_m2x_options_manager
119+
#: model_terms:ir.ui.view,arch_db:web_m2x_options_manager.view_model_form_inherit
120+
msgid "Fill"
121+
msgstr "Popola"
122+
123+
#. module: web_m2x_options_manager
124+
#: model:ir.model.fields.selection,name:web_m2x_options_manager.selection__m2x_create_edit_option__option_create__force_true
125+
#: model:ir.model.fields.selection,name:web_m2x_options_manager.selection__m2x_create_edit_option__option_create_edit__force_true
126+
msgid "Force Add"
127+
msgstr "Forza aggiungi"
128+
129+
#. module: web_m2x_options_manager
130+
#: model:ir.model.fields.selection,name:web_m2x_options_manager.selection__m2x_create_edit_option__option_create__force_false
131+
#: model:ir.model.fields.selection,name:web_m2x_options_manager.selection__m2x_create_edit_option__option_create_edit__force_false
132+
msgid "Force Remove"
133+
msgstr "Forza rimuovi"
134+
135+
#. module: web_m2x_options_manager
136+
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_m2x_create_edit_option__id
137+
msgid "ID"
138+
msgstr "ID"
139+
140+
#. module: web_m2x_options_manager
141+
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_m2x_create_edit_option____last_update
142+
msgid "Last Modified on"
143+
msgstr "Ultima modifica il"
144+
145+
#. module: web_m2x_options_manager
146+
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_m2x_create_edit_option__write_uid
147+
msgid "Last Updated by"
148+
msgstr "Ultimo aggiornamento di"
149+
150+
#. module: web_m2x_options_manager
151+
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_m2x_create_edit_option__write_date
152+
msgid "Last Updated on"
153+
msgstr "Ultimo aggiornamento il"
154+
155+
#. module: web_m2x_options_manager
156+
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_ir_model__m2x_option_ids
157+
msgid "M2X Create Edit Option"
158+
msgstr "Crea opzione modifica M2X"
159+
160+
#. module: web_m2x_options_manager
161+
#: model:ir.model,name:web_m2x_options_manager.model_m2x_create_edit_option
162+
msgid "Manage Options 'Create/Edit' For Fields"
163+
msgstr "Gestione opzioni 'Crea/Modifica' per i campi"
164+
165+
#. module: web_m2x_options_manager
166+
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_m2x_create_edit_option__model_id
167+
msgid "Model"
168+
msgstr "Modello"
169+
170+
#. module: web_m2x_options_manager
171+
#: model:ir.model.fields,field_description:web_m2x_options_manager.field_m2x_create_edit_option__model_name
172+
msgid "Model Name"
173+
msgstr "Nome modello"
174+
175+
#. module: web_m2x_options_manager
176+
#: model:ir.model,name:web_m2x_options_manager.model_ir_model
177+
msgid "Models"
178+
msgstr "Modelli"
179+
180+
#. module: web_m2x_options_manager
181+
#. odoo-python
182+
#: code:addons/web_m2x_options_manager/models/m2x_create_edit_option.py:0
183+
#, python-format
184+
msgid "Only Many2many and Many2one fields can be chosen!"
185+
msgstr "Si possono scegliere solo campi Many2many e Many2one!"
186+
187+
#. module: web_m2x_options_manager
188+
#: model:ir.model.constraint,message:web_m2x_options_manager.constraint_m2x_create_edit_option_model_field_uniqueness
189+
msgid "Options must be unique for each model/field couple!"
190+
msgstr "Le opzioni devono essere univoche per ogni coppia modello/campo!"
191+
192+
#. module: web_m2x_options_manager
193+
#: model:ir.model.fields.selection,name:web_m2x_options_manager.selection__m2x_create_edit_option__option_create__set_false
194+
#: model:ir.model.fields.selection,name:web_m2x_options_manager.selection__m2x_create_edit_option__option_create_edit__set_false
195+
msgid "Remove"
196+
msgstr "Rimuovi"
197+
198+
#. module: web_m2x_options_manager
199+
#: model:ir.model,name:web_m2x_options_manager.model_ir_ui_view
200+
msgid "View"
201+
msgstr "Vista"

0 commit comments

Comments
 (0)