From 036a86554e901d11b08d0b2191fba406952e99c0 Mon Sep 17 00:00:00 2001 From: sanami Date: Thu, 14 May 2026 05:32:02 +0000 Subject: [PATCH 1/2] [6740][ADD] web_m2x_options --- web_m2x_options/README.rst | 215 +++++++ web_m2x_options/__init__.py | 1 + web_m2x_options/__manifest__.py | 36 ++ web_m2x_options/i18n/ar.po | 46 ++ web_m2x_options/i18n/de.po | 117 ++++ web_m2x_options/i18n/es.po | 106 ++++ web_m2x_options/i18n/es_BO.po | 25 + web_m2x_options/i18n/fi.po | 45 ++ web_m2x_options/i18n/fr.po | 92 +++ web_m2x_options/i18n/hr.po | 63 ++ web_m2x_options/i18n/it.po | 94 +++ web_m2x_options/i18n/ja.po | 27 + web_m2x_options/i18n/nl.po | 80 +++ web_m2x_options/i18n/nl_NL.po | 38 ++ web_m2x_options/i18n/pt_BR.po | 114 ++++ web_m2x_options/i18n/sl.po | 46 ++ web_m2x_options/i18n/tr.po | 45 ++ web_m2x_options/i18n/web_m2x_options.pot | 36 ++ web_m2x_options/i18n/zh_CN.po | 71 +++ web_m2x_options/models/__init__.py | 2 + web_m2x_options/models/ir_config_parameter.py | 17 + web_m2x_options/models/ir_http.py | 11 + web_m2x_options/pyproject.toml | 3 + web_m2x_options/readme/CONTRIBUTORS.md | 32 + web_m2x_options/readme/CREDITS.md | 0 web_m2x_options/readme/DESCRIPTION.md | 10 + web_m2x_options/readme/ROADMAP.md | 10 + web_m2x_options/readme/USAGE.md | 61 ++ web_m2x_options/static/description/icon.png | Bin 0 -> 9455 bytes web_m2x_options/static/description/index.html | 551 ++++++++++++++++++ .../static/src/components/base.xml | 28 + .../static/src/components/form.esm.js | 342 +++++++++++ .../views/fields/standard_field_props.esm.js | 12 + web_m2x_options/tests/__init__.py | 2 + .../tests/test_ir_config_parameter.py | 23 + 35 files changed, 2401 insertions(+) create mode 100644 web_m2x_options/README.rst create mode 100644 web_m2x_options/__init__.py create mode 100644 web_m2x_options/__manifest__.py create mode 100644 web_m2x_options/i18n/ar.po create mode 100644 web_m2x_options/i18n/de.po create mode 100644 web_m2x_options/i18n/es.po create mode 100644 web_m2x_options/i18n/es_BO.po create mode 100644 web_m2x_options/i18n/fi.po create mode 100644 web_m2x_options/i18n/fr.po create mode 100644 web_m2x_options/i18n/hr.po create mode 100644 web_m2x_options/i18n/it.po create mode 100644 web_m2x_options/i18n/ja.po create mode 100644 web_m2x_options/i18n/nl.po create mode 100644 web_m2x_options/i18n/nl_NL.po create mode 100644 web_m2x_options/i18n/pt_BR.po create mode 100644 web_m2x_options/i18n/sl.po create mode 100644 web_m2x_options/i18n/tr.po create mode 100644 web_m2x_options/i18n/web_m2x_options.pot create mode 100644 web_m2x_options/i18n/zh_CN.po create mode 100644 web_m2x_options/models/__init__.py create mode 100644 web_m2x_options/models/ir_config_parameter.py create mode 100644 web_m2x_options/models/ir_http.py create mode 100644 web_m2x_options/pyproject.toml create mode 100644 web_m2x_options/readme/CONTRIBUTORS.md create mode 100644 web_m2x_options/readme/CREDITS.md create mode 100644 web_m2x_options/readme/DESCRIPTION.md create mode 100644 web_m2x_options/readme/ROADMAP.md create mode 100644 web_m2x_options/readme/USAGE.md create mode 100644 web_m2x_options/static/description/icon.png create mode 100644 web_m2x_options/static/description/index.html create mode 100644 web_m2x_options/static/src/components/base.xml create mode 100644 web_m2x_options/static/src/components/form.esm.js create mode 100644 web_m2x_options/static/src/views/fields/standard_field_props.esm.js create mode 100644 web_m2x_options/tests/__init__.py create mode 100644 web_m2x_options/tests/test_ir_config_parameter.py diff --git a/web_m2x_options/README.rst b/web_m2x_options/README.rst new file mode 100644 index 0000000..55fe444 --- /dev/null +++ b/web_m2x_options/README.rst @@ -0,0 +1,215 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +=============== +web_m2x_options +=============== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:0a399ef3837f690bd0756e8b2c072aeeed2f2be0b274b804f688723b11a7a0df + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github + :target: https://github.com/OCA/web/tree/19.0/web_m2x_options + :alt: OCA/web +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/web-19-0/web-19-0-web_m2x_options + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=19.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This modules modifies "many2one" and "many2manytags" form widgets so as +to add some new display control options. + +Options provided includes possibility to remove "Create..." and/or +"Create and Edit..." entries drop down. You can also change default +number of proposition appearing in the drop-down. + +If not specified, the module will avoid proposing any of the create +options if the current user has no permission rights to create the +related object. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +in the field's options dict +--------------------------- + +``limit`` *int* (Default: odoo default value is ``8``) + + Number of displayed record in drop-down panel + +``field_color`` *string* + + A string to define the field used to define color. This option has to + be used with colors. + +``colors`` *dictionary* + + A dictionary to link field value with a HTML color. This option has + to be used with field_color. + +ir.config_parameter options +--------------------------- + +Now you can disable "Create..." and "Create and Edit..." entry for all +widgets in the odoo instance. If you disable one option, you can enable +it for particular field by setting "create: True" option directly on the +field definition. + +``web_m2x_options.create`` *boolean* (Default: depends if user have +create rights) + + Whether to display the "Create..." entry in dropdown panel for all + fields in the odoo instance. + +``web_m2x_options.create_edit`` *boolean* (Default: depends if user have +create rights) + + Whether to display "Create and Edit..." entry in dropdown panel for + all fields in the odoo instance. + +``web_m2x_options.limit`` *int* (Default: odoo default value is ``8``) + + Number of displayed record in drop-down panel for all fields in the + odoo instance + +``web_m2x_options.field_limit_entries`` *int* + + Number of displayed lines on all One2many fields + +To add these parameters go to Configuration -> Technical -> Parameters +-> System Parameters and add new parameters like: + +- web_m2x_options.create: False +- web_m2x_options.create_edit: False +- web_m2x_options.limit: 10 +- web_m2x_options.field_limit_entries: 5 + +Example +------- + +Your XML form view definition could contain: + +.. code:: xml + + ... + + ... + +Known issues / Roadmap +====================== + +Double check that you have no inherited view that remove ``options`` you +set on a field ! If nothing works, add a debugger in the first line of +``_search method`` and enable debug mode in Odoo. When you write +something in a many2one field, javascript debugger should pause. If not +verify your installation. + +- Instead of making the tags rectangle clickable, I think it's better to + put the text as a clickable link, so we will get a consistent + behaviour/aspect with other clickable elements (many2one...). +- Properly support web_m2x_options on Many2OneReferenceField. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* initOS GmbH +* ACSONE SA/NV +* 0k.io +* Tecnativa +* Sygel + +Contributors +------------ + +- David Coninckx + +- Emanuel Cino + +- Holger Brunn + +- Nicolas JEUDY + +- Yannick Vaucher + +- Zakaria Makrelouf + +- `Tecnativa `__: + + - Jairo Llopis + - David Vidal + - Ernesto Tejeda + - Carlos Roca + +- Bhavesh Odedra + +- Dhara Solanki (http://www.initos.com) + +- `Trobz `__: + + - Hoang Diep + +- `Sygel `__: + + - Manuel Regidor + - Valentín Vinagre + - Harald Panten + +- `ACSONE SA/NV `__: + + - Souheil BEJAOUI + +Other credits +------------- + + + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/web `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_m2x_options/__init__.py b/web_m2x_options/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/web_m2x_options/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/web_m2x_options/__manifest__.py b/web_m2x_options/__manifest__.py new file mode 100644 index 0000000..55c20c6 --- /dev/null +++ b/web_m2x_options/__manifest__.py @@ -0,0 +1,36 @@ +# Copyright 2015 0k.io +# Copyright 2016 ACSONE SA/NV +# Copyright 2017 Tecnativa +# Copyright 2020 initOS GmbH. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "web_m2x_options", + "version": "19.0.1.0.0", + "category": "Web", + "author": "initOS GmbH," + "ACSONE SA/NV, " + "0k.io, " + "Tecnativa, " + "Sygel, " + "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/web", + "license": "AGPL-3", + "depends": ["web"], + "assets": { + "web.assets_backend": [ + ( + "before", + "web/static/src/views/fields/*", + "web_m2x_options/static/src/components/form.esm.js", + ), + ( + "after", + "web/static/src/views/fields/standard_field_props.js", + "web_m2x_options/static/src/views/fields/standard_field_props.esm.js", + ), + "web_m2x_options/static/src/components/base.xml", + ] + }, + "installable": True, +} diff --git a/web_m2x_options/i18n/ar.po b/web_m2x_options/i18n/ar.po new file mode 100644 index 0000000..e055752 --- /dev/null +++ b/web_m2x_options/i18n/ar.po @@ -0,0 +1,46 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_m2x_options +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-03 03:50+0000\n" +"PO-Revision-Date: 2018-01-03 03:50+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Arabic (https://www.transifex.com/oca/teams/23907/ar/)\n" +"Language: ar\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 " +"&& n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_http +msgid "HTTP Routing" +msgstr "" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_config_parameter +msgid "System Parameter" +msgstr "" + +#, python-format +#~ msgid "Search More..." +#~ msgstr "البحث عن المزيد ..." + +#, python-format +#~ msgid "Cancel" +#~ msgstr "إلغاء" + +#, python-format +#~ msgid "Create \"%s\"" +#~ msgstr "إنشاء \"%s\"" + +#, python-format +#~ msgid "Create and Edit..." +#~ msgstr "إنشاء وتحرير ..." diff --git a/web_m2x_options/i18n/de.po b/web_m2x_options/i18n/de.po new file mode 100644 index 0000000..2e79349 --- /dev/null +++ b/web_m2x_options/i18n/de.po @@ -0,0 +1,117 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_m2x_options +# +# Translators: +# OCA Transbot , 2017 +# Rudolf Schnapka , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-03 03:50+0000\n" +"PO-Revision-Date: 2023-06-20 11:09+0000\n" +"Last-Translator: Nils Coenen \n" +"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_http +msgid "HTTP Routing" +msgstr "" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_config_parameter +msgid "System Parameter" +msgstr "Systemparameter" + +#, python-format +#~ msgid ", are you sure it does not exist yet?" +#~ msgstr ", bist du sicher, dass es noch nicht existiert?" + +#, python-format +#~ msgid "Create" +#~ msgstr "Anlegen" + +#, python-format +#~ msgid "Create \"%s\"" +#~ msgstr "Erstelle \"%s\"" + +#, python-format +#~ msgid "Create and Edit" +#~ msgstr "Erstellen und bearbeiten" + +#, python-format +#~ msgid "Create and edit..." +#~ msgstr "Erstellen und bearbeiten..." + +#, python-format +#~ msgid "Discard" +#~ msgstr "Verwerfen" + +#, python-format +#~ msgid "New: %s" +#~ msgstr "Neu: %s" + +#, python-format +#~ msgid "No records" +#~ msgstr "Keine Datensätze" + +#, python-format +#~ msgid "Open: " +#~ msgstr "Öffnen: " + +#, python-format +#~ msgid "Search More..." +#~ msgstr "Suche weitere..." + +#, python-format +#~ msgid "Start typing..." +#~ msgstr "Beginne zu tippen..." + +#, python-format +#~ msgid "You are creating a new" +#~ msgstr "Du erstellst ein Neues" + +#, python-format +#~ msgid "as a new" +#~ msgstr "als neu" + +#, python-format +#~ msgid "Cancel" +#~ msgstr "Abbrechen" + +#, python-format +#~ msgid "Create \"%s\"" +#~ msgstr "Anlegen \"%s" + +#, python-format +#~ msgid "Create a %s" +#~ msgstr "Eine %s anlegen" + +#, python-format +#~ msgid "Create and Edit..." +#~ msgstr "Anlegen und Bearbeiten" + +#, python-format +#~ msgid "Create and edit" +#~ msgstr "Anlegen und bearbeiten" + +#, python-format +#~ msgid "No results to show..." +#~ msgstr "Keine Resultate zu zeigen..." + +#, python-format +#~ msgid "Quick search: %s" +#~ msgstr "Schnellsuche: %s" + +#, python-format +#~ msgid "You are creating a new %s, are you sure it does not exist yet?" +#~ msgstr "" +#~ "Sie legen eine neue %s an, sind Sie sicher, dass diese nicht bereits " +#~ "vorhanden ist?" diff --git a/web_m2x_options/i18n/es.po b/web_m2x_options/i18n/es.po new file mode 100644 index 0000000..803eeae --- /dev/null +++ b/web_m2x_options/i18n/es.po @@ -0,0 +1,106 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_m2x_options +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-03 03:50+0000\n" +"PO-Revision-Date: 2023-09-02 20:35+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_http +msgid "HTTP Routing" +msgstr "Enrutamiento HTTP" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_config_parameter +msgid "System Parameter" +msgstr "Parámetro del Sistema" + +#, python-format +#~ msgid ", are you sure it does not exist yet?" +#~ msgstr ",¿Está seguro de que aún no existe?" + +#, python-format +#~ msgid "Create" +#~ msgstr "Crear" + +#, python-format +#~ msgid "Create \"%s\"" +#~ msgstr "Crear \"%s\"" + +#, python-format +#~ msgid "Create and Edit" +#~ msgstr "Crear y Editar" + +#, python-format +#~ msgid "Create and edit..." +#~ msgstr "Crear y editar..." + +#, python-format +#~ msgid "Discard" +#~ msgstr "Descartar" + +#, python-format +#~ msgid "New: %s" +#~ msgstr "Nuevo: %s" + +#, python-format +#~ msgid "No records" +#~ msgstr "Sin registros" + +#, python-format +#~ msgid "Open: " +#~ msgstr "Abrir " + +#, python-format +#~ msgid "Search More..." +#~ msgstr "Buscar más..." + +#, python-format +#~ msgid "Start typing..." +#~ msgstr "Empieza a escribir..." + +#, python-format +#~ msgid "You are creating a new" +#~ msgstr "Estás creando un nuevo" + +#, python-format +#~ msgid "as a new" +#~ msgstr "como un nuevo" + +#, python-format +#~ msgid "Cancel" +#~ msgstr "Cancelar" + +#, python-format +#~ msgid "Create \"%s\"" +#~ msgstr "Crear \"%s\"" + +#, python-format +#~ msgid "Create a %s" +#~ msgstr "Crear un %s" + +#, python-format +#~ msgid "Create and Edit..." +#~ msgstr "Crear y editar..." + +#, python-format +#~ msgid "Create and edit" +#~ msgstr "Crear y editar" + +#, python-format +#~ msgid "You are creating a new %s, are you sure it does not exist yet?" +#~ msgstr "Está creando un nuevo %s, ¿está seguro de no existe ya?" diff --git a/web_m2x_options/i18n/es_BO.po b/web_m2x_options/i18n/es_BO.po new file mode 100644 index 0000000..69c7a33 --- /dev/null +++ b/web_m2x_options/i18n/es_BO.po @@ -0,0 +1,25 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_m2x_options +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: es_BO\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_http +msgid "HTTP Routing" +msgstr "" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_config_parameter +msgid "System Parameter" +msgstr "" diff --git a/web_m2x_options/i18n/fi.po b/web_m2x_options/i18n/fi.po new file mode 100644 index 0000000..a4643a3 --- /dev/null +++ b/web_m2x_options/i18n/fi.po @@ -0,0 +1,45 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_m2x_options +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-03 03:50+0000\n" +"PO-Revision-Date: 2018-01-03 03:50+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Finnish (https://www.transifex.com/oca/teams/23907/fi/)\n" +"Language: fi\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_http +msgid "HTTP Routing" +msgstr "" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_config_parameter +msgid "System Parameter" +msgstr "" + +#, python-format +#~ msgid "Search More..." +#~ msgstr "Hae lisää..." + +#, python-format +#~ msgid "Cancel" +#~ msgstr "Peru" + +#, python-format +#~ msgid "Create \"%s\"" +#~ msgstr "Luo \"%s\"" + +#, python-format +#~ msgid "Create and Edit..." +#~ msgstr "Luo ja muokkaa..." diff --git a/web_m2x_options/i18n/fr.po b/web_m2x_options/i18n/fr.po new file mode 100644 index 0000000..8333ac7 --- /dev/null +++ b/web_m2x_options/i18n/fr.po @@ -0,0 +1,92 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_m2x_options +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-03 03:50+0000\n" +"PO-Revision-Date: 2024-02-02 11:35+0000\n" +"Last-Translator: Hughes Damry \n" +"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_http +msgid "HTTP Routing" +msgstr "" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_config_parameter +msgid "System Parameter" +msgstr "Paramètres système" + +#, python-format +#~ msgid ", are you sure it does not exist yet?" +#~ msgstr ", êtes-vous sûr qu'il n'existe pas déjà ?" + +#, python-format +#~ msgid "Create" +#~ msgstr "Créer" + +#, python-format +#~ msgid "Create and Edit" +#~ msgstr "Créer et Modifier" + +#, python-format +#~ msgid "Create and edit..." +#~ msgstr "Créer et modifier..." + +#, python-format +#~ msgid "Open: " +#~ msgstr "Ouvrir : " + +#, python-format +#~ msgid "Search More..." +#~ msgstr "Rechercher plus..." + +#, python-format +#~ msgid "You are creating a new" +#~ msgstr "Vous créez un nouveau" + +#, python-format +#~ msgid "Cancel" +#~ msgstr "Annuler" + +#, python-format +#~ msgid "Create \"%s\"" +#~ msgstr "Creer \"%s\"" + +#, python-format +#~ msgid "Create a %s" +#~ msgstr "Créer un %s" + +#, python-format +#~ msgid "Create and Edit..." +#~ msgstr "Créer et modifier..." + +#, python-format +#~ msgid "Create and edit" +#~ msgstr "Créer et modifier" + +#, python-format +#~ msgid "No results to show..." +#~ msgstr "Aucun résultat à afficher..." + +#, python-format +#~ msgid "Quick search: %s" +#~ msgstr "Recherche rapide: %s" + +#, python-format +#~ msgid "You are creating a new %s, are you sure it does not exist yet?" +#~ msgstr "" +#~ "Vous créez un nouveau %s, est-ce que vous êtes sur qu'il n'existe pas " +#~ "déjà ?" diff --git a/web_m2x_options/i18n/hr.po b/web_m2x_options/i18n/hr.po new file mode 100644 index 0000000..a5fdf1f --- /dev/null +++ b/web_m2x_options/i18n/hr.po @@ -0,0 +1,63 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_m2x_options +# +# Translators: +# Bole , 2017 +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-03 03:50+0000\n" +"PO-Revision-Date: 2018-01-03 03:50+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n" +"Language: hr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && " +"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_http +msgid "HTTP Routing" +msgstr "" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_config_parameter +msgid "System Parameter" +msgstr "" + +#, python-format +#~ msgid "Create" +#~ msgstr "Kreiraj" + +#, python-format +#~ msgid "Search More..." +#~ msgstr "Traži dalje..." + +#, python-format +#~ msgid "Cancel" +#~ msgstr "Otkaži" + +#, python-format +#~ msgid "Create \"%s\"" +#~ msgstr "Kreiraj \" %s\"" + +#, python-format +#~ msgid "Create a %s" +#~ msgstr "Kreiraj %s" + +#, python-format +#~ msgid "Create and Edit..." +#~ msgstr "Kreiraj i uredi..." + +#, python-format +#~ msgid "Create and edit" +#~ msgstr "Kreiraj i uredi" + +#, python-format +#~ msgid "You are creating a new %s, are you sure it does not exist yet?" +#~ msgstr "Želite kreirati novi %s, jeste li sigurni da već ne postoji?" diff --git a/web_m2x_options/i18n/it.po b/web_m2x_options/i18n/it.po new file mode 100644 index 0000000..8933130 --- /dev/null +++ b/web_m2x_options/i18n/it.po @@ -0,0 +1,94 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_m2x_options +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-03 03:50+0000\n" +"PO-Revision-Date: 2023-12-24 18:42+0000\n" +"Last-Translator: mymage \n" +"Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_http +msgid "HTTP Routing" +msgstr "Instradamento HTTP" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_config_parameter +msgid "System Parameter" +msgstr "Parametro di sistema" + +#, python-format +#~ msgid ", are you sure it does not exist yet?" +#~ msgstr ", si è sicuri che nn esista già?" + +#, python-format +#~ msgid "Create" +#~ msgstr "Crea" + +#, python-format +#~ msgid "Create \"%s\"" +#~ msgstr "Crea \"%s\"" + +#, python-format +#~ msgid "Create and Edit" +#~ msgstr "Crea e modifica" + +#, python-format +#~ msgid "Create and edit..." +#~ msgstr "Crea e modifica..." + +#, python-format +#~ msgid "Discard" +#~ msgstr "Abbandona" + +#, python-format +#~ msgid "New: %s" +#~ msgstr "Nuovo: %s" + +#, python-format +#~ msgid "No records" +#~ msgstr "Nessun record" + +#, python-format +#~ msgid "Open: " +#~ msgstr "Apri: " + +#, python-format +#~ msgid "Search More..." +#~ msgstr "Cerca altro..." + +#, python-format +#~ msgid "Start typing..." +#~ msgstr "Inizia a scrivere..." + +#, python-format +#~ msgid "You are creating a new" +#~ msgstr "Si sta creando un nuovo" + +#, python-format +#~ msgid "as a new" +#~ msgstr "come nuovo" + +#, python-format +#~ msgid "Cancel" +#~ msgstr "Annulla" + +#, python-format +#~ msgid "Create \"%s\"" +#~ msgstr "Crea \"%s\"" + +#, python-format +#~ msgid "Create and Edit..." +#~ msgstr "Crea e Modifica..." diff --git a/web_m2x_options/i18n/ja.po b/web_m2x_options/i18n/ja.po new file mode 100644 index 0000000..7822f47 --- /dev/null +++ b/web_m2x_options/i18n/ja.po @@ -0,0 +1,27 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_m2x_options +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2025-11-12 14:42+0000\n" +"Last-Translator: Ryoko Tsuda \n" +"Language-Team: none\n" +"Language: ja\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 5.10.4\n" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_http +msgid "HTTP Routing" +msgstr "HTTPルーティング" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_config_parameter +msgid "System Parameter" +msgstr "システムパラメータ" diff --git a/web_m2x_options/i18n/nl.po b/web_m2x_options/i18n/nl.po new file mode 100644 index 0000000..251b420 --- /dev/null +++ b/web_m2x_options/i18n/nl.po @@ -0,0 +1,80 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_m2x_options +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-05-17 20:47+0000\n" +"Last-Translator: Bosd \n" +"Language-Team: none\n" +"Language: nl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_http +msgid "HTTP Routing" +msgstr "" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_config_parameter +msgid "System Parameter" +msgstr "Systeem Parameter" + +#, python-format +#~ msgid "Create" +#~ msgstr "Aanmaken" + +#, python-format +#~ msgid "Open: " +#~ msgstr "Open: " + +#, python-format +#~ msgid "Search More..." +#~ msgstr "Zoek meer..." + +#, python-format +#~ msgid "Cancel" +#~ msgstr "Annuleren" + +#, fuzzy, python-format +#~ msgid "Create \"%s\"" +#~ msgstr "Creér%s\"" + +#, python-format +#~ msgid "Create a %s" +#~ msgstr "Maak een %s" + +#, python-format +#~ msgid "Create and Edit..." +#~ msgstr "Aanmaken en bewerken..." + +#, python-format +#~ msgid "Create and edit" +#~ msgstr "Aanmaken en bewerken" + +#, python-format +#~ msgid "No results to show..." +#~ msgstr "Geen resultaten om weer te geven..." + +#, python-format +#~ msgid "Quick search: %s" +#~ msgstr "Snel zoeken: %s" + +#, python-format +#~ msgid "You are creating a new %s, are you sure it does not exist yet?" +#~ msgstr "U maakt een nieuw %s, weet u het zeker dat dit nog niet bestaat?" + +#~ msgid "Display Name" +#~ msgstr "Weergavenaam" + +#~ msgid "ID" +#~ msgstr "ID" + +#~ msgid "Last Modified on" +#~ msgstr "Laatst Gewijzigd op" diff --git a/web_m2x_options/i18n/nl_NL.po b/web_m2x_options/i18n/nl_NL.po new file mode 100644 index 0000000..d37b1ed --- /dev/null +++ b/web_m2x_options/i18n/nl_NL.po @@ -0,0 +1,38 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_m2x_options +# +# Translators: +# Peter Hageman , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-01 03:35+0000\n" +"PO-Revision-Date: 2017-07-01 03:35+0000\n" +"Last-Translator: Peter Hageman , 2017\n" +"Language-Team: Dutch (Netherlands) (https://www.transifex.com/oca/" +"teams/23907/nl_NL/)\n" +"Language: nl_NL\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_http +msgid "HTTP Routing" +msgstr "" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_config_parameter +msgid "System Parameter" +msgstr "" + +#, python-format +#~ msgid "Create" +#~ msgstr "Aanmaken" + +#, python-format +#~ msgid "Cancel" +#~ msgstr "Annuleer" diff --git a/web_m2x_options/i18n/pt_BR.po b/web_m2x_options/i18n/pt_BR.po new file mode 100644 index 0000000..52feb86 --- /dev/null +++ b/web_m2x_options/i18n/pt_BR.po @@ -0,0 +1,114 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_m2x_options +# +# Translators: +# OCA Transbot , 2017 +# Rodrigo de Almeida Sottomaior Macedo , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-03 03:50+0000\n" +"PO-Revision-Date: 2024-05-29 19:34+0000\n" +"Last-Translator: Rodrigo Macedo \n" +"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/" +"teams/23907/pt_BR/)\n" +"Language: pt_BR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_http +msgid "HTTP Routing" +msgstr "Roteamento HTTP" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_config_parameter +msgid "System Parameter" +msgstr "Parâmetros do Sistema" + +#, python-format +#~ msgid ", are you sure it does not exist yet?" +#~ msgstr ", tem certeza que ainda não existe?" + +#, python-format +#~ msgid "Create" +#~ msgstr "Criar" + +#, python-format +#~ msgid "Create \"%s\"" +#~ msgstr "Criar \"%s\"" + +#, python-format +#~ msgid "Create and Edit" +#~ msgstr "Criar e Editar" + +#, python-format +#~ msgid "Create and edit..." +#~ msgstr "Criar e editar..." + +#, python-format +#~ msgid "Discard" +#~ msgstr "Descartar" + +#, python-format +#~ msgid "New: %s" +#~ msgstr "Novo: %s" + +#, python-format +#~ msgid "No records" +#~ msgstr "Sem registros" + +#, python-format +#~ msgid "Open: " +#~ msgstr "Abrir: " + +#, python-format +#~ msgid "Search More..." +#~ msgstr "Buscar mais..." + +#, python-format +#~ msgid "Start typing..." +#~ msgstr "Comece a digitar..." + +#, python-format +#~ msgid "You are creating a new" +#~ msgstr "Você está criando um novo" + +#, python-format +#~ msgid "as a new" +#~ msgstr "como um novo" + +#, python-format +#~ msgid "Cancel" +#~ msgstr "Cancelar" + +#, python-format +#~ msgid "Create \"%s\"" +#~ msgstr "Criar \"%s\"" + +#, python-format +#~ msgid "Create a %s" +#~ msgstr "Criar um %s" + +#, python-format +#~ msgid "Create and Edit..." +#~ msgstr "Criar e editar.." + +#, python-format +#~ msgid "Create and edit" +#~ msgstr "Criar e editar" + +#, python-format +#~ msgid "No results to show..." +#~ msgstr "sem resultado para mostrar..." + +#, python-format +#~ msgid "You are creating a new %s, are you sure it does not exist yet?" +#~ msgstr "" +#~ "Você está criando um novo %s, você tem certeza de que ainda não existe?" diff --git a/web_m2x_options/i18n/sl.po b/web_m2x_options/i18n/sl.po new file mode 100644 index 0000000..8429ebc --- /dev/null +++ b/web_m2x_options/i18n/sl.po @@ -0,0 +1,46 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_m2x_options +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-03 03:50+0000\n" +"PO-Revision-Date: 2018-01-03 03:50+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n" +"Language: sl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || " +"n%100==4 ? 2 : 3);\n" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_http +msgid "HTTP Routing" +msgstr "" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_config_parameter +msgid "System Parameter" +msgstr "" + +#, python-format +#~ msgid "Search More..." +#~ msgstr "Poišči več..." + +#, python-format +#~ msgid "Cancel" +#~ msgstr "Preklic" + +#, python-format +#~ msgid "Create \"%s\"" +#~ msgstr "Ustvari \"%s\"" + +#, python-format +#~ msgid "Create and Edit..." +#~ msgstr "Ustvari in urejaj..." diff --git a/web_m2x_options/i18n/tr.po b/web_m2x_options/i18n/tr.po new file mode 100644 index 0000000..c088761 --- /dev/null +++ b/web_m2x_options/i18n/tr.po @@ -0,0 +1,45 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_m2x_options +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-03 03:50+0000\n" +"PO-Revision-Date: 2018-01-03 03:50+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Turkish (https://www.transifex.com/oca/teams/23907/tr/)\n" +"Language: tr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_http +msgid "HTTP Routing" +msgstr "" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_config_parameter +msgid "System Parameter" +msgstr "" + +#, python-format +#~ msgid "Search More..." +#~ msgstr "Daha Fazla..." + +#, python-format +#~ msgid "Cancel" +#~ msgstr "İptal" + +#, python-format +#~ msgid "Create \"%s\"" +#~ msgstr "Oluştur \"%s\"" + +#, python-format +#~ msgid "Create and Edit..." +#~ msgstr "Oluştur ve düzenle..." diff --git a/web_m2x_options/i18n/web_m2x_options.pot b/web_m2x_options/i18n/web_m2x_options.pot new file mode 100644 index 0000000..f2b5712 --- /dev/null +++ b/web_m2x_options/i18n/web_m2x_options.pot @@ -0,0 +1,36 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_m2x_options +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 19.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: web_m2x_options +#: model:ir.model.fields,field_description:web_m2x_options.field_ir_config_parameter__display_name +#: model:ir.model.fields,field_description:web_m2x_options.field_ir_http__display_name +msgid "Display Name" +msgstr "" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_http +msgid "HTTP Routing" +msgstr "" + +#. module: web_m2x_options +#: model:ir.model.fields,field_description:web_m2x_options.field_ir_config_parameter__id +#: model:ir.model.fields,field_description:web_m2x_options.field_ir_http__id +msgid "ID" +msgstr "" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_config_parameter +msgid "System Parameter" +msgstr "" diff --git a/web_m2x_options/i18n/zh_CN.po b/web_m2x_options/i18n/zh_CN.po new file mode 100644 index 0000000..8c2aa4c --- /dev/null +++ b/web_m2x_options/i18n/zh_CN.po @@ -0,0 +1,71 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_m2x_options +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-07-08 05:19+0000\n" +"Last-Translator: 黎伟杰 <674416404@qq.com>\n" +"Language-Team: none\n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 3.10\n" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_http +msgid "HTTP Routing" +msgstr "" + +#. module: web_m2x_options +#: model:ir.model,name:web_m2x_options.model_ir_config_parameter +msgid "System Parameter" +msgstr "系统参数" + +#, python-format +#~ msgid "Create" +#~ msgstr "创建" + +#, python-format +#~ msgid "Open: " +#~ msgstr "打开: " + +#, python-format +#~ msgid "Search More..." +#~ msgstr "搜索更多..." + +#, python-format +#~ msgid "Cancel" +#~ msgstr "取消" + +#, python-format +#~ msgid "Create \"%s\"" +#~ msgstr "创建 \"%s\"" + +#, python-format +#~ msgid "Create a %s" +#~ msgstr "创建一个%s" + +#, python-format +#~ msgid "Create and Edit..." +#~ msgstr "创建和编辑..." + +#, python-format +#~ msgid "Create and edit" +#~ msgstr "创建和编辑" + +#, python-format +#~ msgid "No results to show..." +#~ msgstr "没有结果显示..." + +#, python-format +#~ msgid "Quick search: %s" +#~ msgstr "快速搜索: %s" + +#, python-format +#~ msgid "You are creating a new %s, are you sure it does not exist yet?" +#~ msgstr "你正在创建一个新的%s,你确定它还不存在吗?" diff --git a/web_m2x_options/models/__init__.py b/web_m2x_options/models/__init__.py new file mode 100644 index 0000000..60b90d3 --- /dev/null +++ b/web_m2x_options/models/__init__.py @@ -0,0 +1,2 @@ +from . import ir_config_parameter +from . import ir_http diff --git a/web_m2x_options/models/ir_config_parameter.py b/web_m2x_options/models/ir_config_parameter.py new file mode 100644 index 0000000..caf4301 --- /dev/null +++ b/web_m2x_options/models/ir_config_parameter.py @@ -0,0 +1,17 @@ +from odoo import api, models + + +class IrConfigParameter(models.Model): + _inherit = "ir.config_parameter" + + @api.model + def get_web_m2x_options(self): + opts = [ + "web_m2x_options.create", + "web_m2x_options.create_edit", + "web_m2x_options.limit", + "web_m2x_options.field_limit_entries", + "web_m2x_options.open", + ] + values = self.sudo().search_read([["key", "in", opts]], ["key", "value"]) + return {res["key"]: res["value"] for res in values} diff --git a/web_m2x_options/models/ir_http.py b/web_m2x_options/models/ir_http.py new file mode 100644 index 0000000..f7933c4 --- /dev/null +++ b/web_m2x_options/models/ir_http.py @@ -0,0 +1,11 @@ +from odoo import models + + +class Http(models.AbstractModel): + _inherit = "ir.http" + + def session_info(self): + IrConfigSudo = self.env["ir.config_parameter"].sudo() + session_info = super().session_info() + session_info.update({"web_m2x_options": IrConfigSudo.get_web_m2x_options()}) + return session_info diff --git a/web_m2x_options/pyproject.toml b/web_m2x_options/pyproject.toml new file mode 100644 index 0000000..4231d0c --- /dev/null +++ b/web_m2x_options/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/web_m2x_options/readme/CONTRIBUTORS.md b/web_m2x_options/readme/CONTRIBUTORS.md new file mode 100644 index 0000000..d35397f --- /dev/null +++ b/web_m2x_options/readme/CONTRIBUTORS.md @@ -0,0 +1,32 @@ +- David Coninckx \<\> + +- Emanuel Cino \<\> + +- Holger Brunn \<\> + +- Nicolas JEUDY \<\> + +- Yannick Vaucher \<\> + +- Zakaria Makrelouf \<\> + +- [Tecnativa](https://www.tecnativa.com): + - Jairo Llopis \<\> + - David Vidal \<\> + - Ernesto Tejeda \<\> + - Carlos Roca + +- Bhavesh Odedra \<\> + +- Dhara Solanki \<\> () + +- [Trobz](https://trobz.com): + - Hoang Diep \<\> + +- [Sygel](https://sygel.es): + - Manuel Regidor \<\> + - Valentín Vinagre \<\> + - Harald Panten \<\> + +- [ACSONE SA/NV](https://acsone.eu): + - Souheil BEJAOUI \<\> \ No newline at end of file diff --git a/web_m2x_options/readme/CREDITS.md b/web_m2x_options/readme/CREDITS.md new file mode 100644 index 0000000..e69de29 diff --git a/web_m2x_options/readme/DESCRIPTION.md b/web_m2x_options/readme/DESCRIPTION.md new file mode 100644 index 0000000..ad2c876 --- /dev/null +++ b/web_m2x_options/readme/DESCRIPTION.md @@ -0,0 +1,10 @@ +This modules modifies "many2one" and "many2manytags" form widgets so as +to add some new display control options. + +Options provided includes possibility to remove "Create..." and/or +"Create and Edit..." entries drop down. You can also change default +number of proposition appearing in the drop-down. + +If not specified, the module will avoid proposing any of the create +options if the current user has no permission rights to create the +related object. diff --git a/web_m2x_options/readme/ROADMAP.md b/web_m2x_options/readme/ROADMAP.md new file mode 100644 index 0000000..5c1e008 --- /dev/null +++ b/web_m2x_options/readme/ROADMAP.md @@ -0,0 +1,10 @@ +Double check that you have no inherited view that remove `options` you +set on a field ! If nothing works, add a debugger in the first line of +`_search method` and enable debug mode in Odoo. When you write something +in a many2one field, javascript debugger should pause. If not verify +your installation. + +- Instead of making the tags rectangle clickable, I think it's better to + put the text as a clickable link, so we will get a consistent + behaviour/aspect with other clickable elements (many2one...). +- Properly support web_m2x_options on Many2OneReferenceField. \ No newline at end of file diff --git a/web_m2x_options/readme/USAGE.md b/web_m2x_options/readme/USAGE.md new file mode 100644 index 0000000..c1e7aeb --- /dev/null +++ b/web_m2x_options/readme/USAGE.md @@ -0,0 +1,61 @@ +## in the field's options dict + +`limit` *int* (Default: odoo default value is `8`) + +> Number of displayed record in drop-down panel + +`field_color` *string* + +> A string to define the field used to define color. This option has to +> be used with colors. + +`colors` *dictionary* + +> A dictionary to link field value with a HTML color. This option has to +> be used with field_color. + +## ir.config_parameter options + +Now you can disable "Create..." and "Create and Edit..." entry for all +widgets in the odoo instance. If you disable one option, you can enable +it for particular field by setting "create: True" option directly on the +field definition. + +`web_m2x_options.create` *boolean* (Default: depends if user have create +rights) + +> Whether to display the "Create..." entry in dropdown panel for all +> fields in the odoo instance. + +`web_m2x_options.create_edit` *boolean* (Default: depends if user have +create rights) + +> Whether to display "Create and Edit..." entry in dropdown panel for +> all fields in the odoo instance. + +`web_m2x_options.limit` *int* (Default: odoo default value is `8`) + +> Number of displayed record in drop-down panel for all fields in the +> odoo instance + +`web_m2x_options.field_limit_entries` *int* + +> Number of displayed lines on all One2many fields + +To add these parameters go to Configuration -\> Technical -\> Parameters +-\> System Parameters and add new parameters like: + +- web_m2x_options.create: False +- web_m2x_options.create_edit: False +- web_m2x_options.limit: 10 +- web_m2x_options.field_limit_entries: 5 + +## Example + +Your XML form view definition could contain: + +``` xml +... + +... +``` diff --git a/web_m2x_options/static/description/icon.png b/web_m2x_options/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e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=>Ig-$ zbW26Ws~IgY>}^5w`vTB(G`PTZaDiGBo5o(tp)qli|NeV( z@H_=R8V39rt5J5YB2Ky?4eJJ#b`_iBe2ot~6%7mLt5t8Vwi^Jy7|jWXqa3amOIoRb zOr}WVFP--DsS`1WpN%~)t3R!arKF^Q$e12KEqU36AWwnCBICpH4XCsfnyrHr>$I$4 z!DpKX$OKLWarN7nv@!uIA+~RNO)l$$w}p(;b>mx8pwYvu;dD_unryX_NhT8*Tj>BTrTTL&!?O+%Rv;b?B??gSzdp?6Uug9{ zd@V08Z$BdI?fpoCS$)t4mg4rT8Q_I}h`0d-vYZ^|dOB*Q^S|xqTV*vIg?@fVFSmMpaw0qtTRbx} z({Pg?#{2`sc9)M5N$*N|4;^t$+QP?#mov zGVC@I*lBVrOU-%2y!7%)fAKjpEFsgQc4{amtiHb95KQEwvf<(3T<9-Zm$xIew#P22 zc2Ix|App^>v6(3L_MCU0d3W##AB0M~3D00EWoKZqsJYT(#@w$Y_H7G22M~ApVFTRHMI_3be)Lkn#0F*V8Pq zc}`Cjy$bE;FJ6H7p=0y#R>`}-m4(0F>%@P|?7fx{=R^uFdISRnZ2W_xQhD{YuR3t< z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 diff --git a/web_m2x_options/static/description/index.html b/web_m2x_options/static/description/index.html new file mode 100644 index 0000000..badeaac --- /dev/null +++ b/web_m2x_options/static/description/index.html @@ -0,0 +1,551 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

web_m2x_options

+ +

Beta License: AGPL-3 OCA/web Translate me on Weblate Try me on Runboat

+

This modules modifies “many2one” and “many2manytags” form widgets so as +to add some new display control options.

+

Options provided includes possibility to remove “Create…” and/or +“Create and Edit…” entries drop down. You can also change default +number of proposition appearing in the drop-down.

+

If not specified, the module will avoid proposing any of the create +options if the current user has no permission rights to create the +related object.

+

Table of contents

+ +
+

Usage

+
+

in the field’s options dict

+

limit int (Default: odoo default value is 8)

+
+Number of displayed record in drop-down panel
+

field_color string

+
+A string to define the field used to define color. This option has to +be used with colors.
+

colors dictionary

+
+A dictionary to link field value with a HTML color. This option has +to be used with field_color.
+
+
+

ir.config_parameter options

+

Now you can disable “Create…” and “Create and Edit…” entry for all +widgets in the odoo instance. If you disable one option, you can enable +it for particular field by setting “create: True” option directly on the +field definition.

+

web_m2x_options.create boolean (Default: depends if user have +create rights)

+
+Whether to display the “Create…” entry in dropdown panel for all +fields in the odoo instance.
+

web_m2x_options.create_edit boolean (Default: depends if user have +create rights)

+
+Whether to display “Create and Edit…” entry in dropdown panel for +all fields in the odoo instance.
+

web_m2x_options.limit int (Default: odoo default value is 8)

+
+Number of displayed record in drop-down panel for all fields in the +odoo instance
+

web_m2x_options.field_limit_entries int

+
+Number of displayed lines on all One2many fields
+

To add these parameters go to Configuration -> Technical -> Parameters +-> System Parameters and add new parameters like:

+
    +
  • web_m2x_options.create: False
  • +
  • web_m2x_options.create_edit: False
  • +
  • web_m2x_options.limit: 10
  • +
  • web_m2x_options.field_limit_entries: 5
  • +
+
+
+

Example

+

Your XML form view definition could contain:

+
+...
+<field name="partner_id" options="{'limit': 10, 'field_color':'type', 'colors':{'contact':'green', 'invoice': 'red', 'delivery': 'blue'}}"/>
+...
+
+
+
+
+

Known issues / Roadmap

+

Double check that you have no inherited view that remove options you +set on a field ! If nothing works, add a debugger in the first line of +_search method and enable debug mode in Odoo. When you write +something in a many2one field, javascript debugger should pause. If not +verify your installation.

+
    +
  • Instead of making the tags rectangle clickable, I think it’s better to +put the text as a clickable link, so we will get a consistent +behaviour/aspect with other clickable elements (many2one…).
  • +
  • Properly support web_m2x_options on Many2OneReferenceField.
  • +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • initOS GmbH
  • +
  • ACSONE SA/NV
  • +
  • 0k.io
  • +
  • Tecnativa
  • +
  • Sygel
  • +
+
+
+

Contributors

+ +
+ +
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/web project on GitHub.

+

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

+
+
+
+
+ + diff --git a/web_m2x_options/static/src/components/base.xml b/web_m2x_options/static/src/components/base.xml new file mode 100644 index 0000000..c8df0d8 --- /dev/null +++ b/web_m2x_options/static/src/components/base.xml @@ -0,0 +1,28 @@ + + + + + + + {{ option.style }} + + + + + + props.searchLimit + props.fieldColor + props.fieldColorOptions + + + + diff --git a/web_m2x_options/static/src/components/form.esm.js b/web_m2x_options/static/src/components/form.esm.js new file mode 100644 index 0000000..c156c31 --- /dev/null +++ b/web_m2x_options/static/src/components/form.esm.js @@ -0,0 +1,342 @@ +import * as many2OneField from "@web/views/fields/many2one/many2one_field"; +import * as many2one from "@web/views/fields/many2one/many2one"; +import {FormController} from "@web/views/form/form_controller"; +import {KanbanMany2One, Many2One} from "@web/views/fields/many2one/many2one"; +import {Many2OneReferenceField} from "@web/views/fields/many2one_reference/many2one_reference_field"; +import {Many2XAutocomplete} from "@web/views/fields/relational_utils"; +import {evaluateBooleanExpr} from "@web/core/py_js/py"; +import {fieldColorProps} from "../views/fields/standard_field_props.esm"; +import {isX2Many} from "@web/views/utils"; +import {many2ManyTagsField} from "@web/views/fields/many2many_tags/many2many_tags_field"; +import {patch} from "@web/core/utils/patch"; +import {registry} from "@web/core/registry"; +import {session} from "@web/session"; + +Many2XAutocomplete.props = { + ...Many2XAutocomplete.props, + ...fieldColorProps, +}; + +Many2One.props = { + ...Many2One.props, + searchLimit: {type: Number, optional: true}, +}; + +function evaluateSystemParameterDefaultTrue(option) { + const isOptionSet = session.web_m2x_options[`web_m2x_options.${option}`]; + return isOptionSet ? evaluateBooleanExpr(isOptionSet) : true; +} +function evaluateSystemParameterNumber(option) { + const isOptionSet = session.web_m2x_options[`web_m2x_options.${option}`]; + return isOptionSet ? Number(isOptionSet) : false; +} + +export function m2o_options_props_create(props, attrs, options) { + const canQuickCreate = evaluateSystemParameterDefaultTrue("create"); + if (options.no_create || options.no_quick_create) { + props.canQuickCreate = false; + } else if ("no_quick_create" in options) { + props.canQuickCreate = attrs.can_create + ? evaluateBooleanExpr(attrs.can_create) + : true; + } else if (!canQuickCreate && props.canQuickCreate) { + props.canQuickCreate = false; + } else if (canQuickCreate && !props.canQuickCreate) { + props.canQuickCreate = attrs.can_create + ? evaluateBooleanExpr(attrs.can_create) + : true; + } + return props; +} + +export function m2o_options_props_create_edit(props, attrs, options) { + const canCreateEdit = evaluateSystemParameterDefaultTrue("create_edit"); + if (options.no_create || options.no_create_edit) { + props.canCreateEdit = false; + } else if ("no_create_edit" in options) { + // Same condition set in web/views/fields/many2one/many2one_field + props.canCreateEdit = attrs.can_create + ? evaluateBooleanExpr(attrs.can_create) + : true; + } else if (!canCreateEdit && props.canCreateEdit) { + props.canCreateEdit = false; + } else if (canCreateEdit && !props.canCreateEdit) { + // Same condition set in web/views/fields/many2one/many2one_field + props.canCreateEdit = attrs.can_create + ? evaluateBooleanExpr(attrs.can_create) + : true; + } + return props; +} + +export function m2o_options_props_limit(props, attrs, options) { + const ir_options = session.web_m2x_options; + if (Number(options.limit)) { + props.searchLimit = Number(options.limit); + } else if (Number(ir_options["web_m2x_options.limit"])) { + props.searchLimit = Number(ir_options["web_m2x_options.limit"]); + } + return props; +} + +export function m2o_options_props_open(props, attrs, options) { + if (!("no_open" in options)) { + props.canOpen = evaluateSystemParameterDefaultTrue("open"); + } + return props; +} + +export function m2o_options_props(props, attrs, options) { + let newProps = props; + newProps = m2o_options_props_create(newProps, attrs, options); + newProps = m2o_options_props_create_edit(newProps, attrs, options); + newProps = m2o_options_props_limit(newProps, attrs, options); + newProps = m2o_options_props_open(newProps, attrs, options); + newProps.fieldColor = options.field_color; + newProps.fieldColorOptions = options.colors; + return newProps; +} + +const oldBuildM2OFieldDescription = many2OneField.buildM2OFieldDescription; +many2OneField.buildM2OFieldDescription = (component) => { + const _super = oldBuildM2OFieldDescription(component); + return { + ..._super, + extractProps(staticInfo, dynamicInfo) { + const props = many2OneField.extractM2OFieldProps(staticInfo, dynamicInfo); + return m2o_options_props(props, staticInfo.attrs, staticInfo.options); + }, + }; +}; + +const oldcomputeM2OProps = many2one.computeM2OProps; +many2one.computeM2OProps = (fieldProps) => { + const _super = oldcomputeM2OProps(fieldProps); + return { + ..._super, + searchLimit: fieldProps.searchLimit, + }; +}; + +// FIXME: Many2OneReferenceField does not support m2o_options_props. +// This no-op prevents crashes, but proper option support is still missing. +// See roadmap note in PR #3191 +patch(Many2OneReferenceField, { + // eslint-disable-next-line no-unused-vars + m2o_options_props(props, attrs, options) { + return props; + }, +}); + +// FIXME: KanbanMany2One does not support m2o_options_props (e.g. searchLimit). +// Accepting these props prevents "unknown key" validation errors when the +// field description is built with m2o_options_props (e.g. kanban many2one avatar). +KanbanMany2One.props = { + ...KanbanMany2One.props, + ...fieldColorProps, + searchLimit: {type: Number, optional: true}, +}; + +patch(many2OneField.Many2OneField.prototype, { + get m2oProps() { + const props = super.m2oProps; + props.searchLimit = this.props.searchLimit; + return props; + }, +}); + +patch(Many2One.prototype, { + get many2XAutocompleteProps() { + let search_limit = 0; + if (this.props.searchLimit) { + search_limit = this.props.searchLimit; + } else { + search_limit = evaluateSystemParameterNumber("limit"); + } + const field_color = this.props.fieldColor; + const field_color_options = this.props.fieldColorOptions; + const props = super.many2XAutocompleteProps; + const ret_props = {...props}; + if (Number(search_limit) && Number(search_limit) > 1) { + ret_props.searchLimit = search_limit - 1; + } + if (field_color && field_color_options) { + ret_props.fieldColor = field_color; + ret_props.fieldColorOptions = field_color_options; + } + return ret_props; + }, +}); + +patch(many2ManyTagsField, { + m2m_options_props_create(props, attrs, options) { + const canQuickCreate = evaluateSystemParameterDefaultTrue("create"); + // Create option already available for m2m fields + if (!options.no_quick_create) { + if (!canQuickCreate && props.canQuickCreate) { + props.canQuickCreate = false; + } else if (canQuickCreate && !props.canQuickCreate) { + props.canQuickCreate = attrs.can_create + ? evaluateBooleanExpr(attrs.can_create) + : true; + } + } + return props; + }, + + m2m_options_props_create_edit(props, attrs, options) { + const canCreateEdit = evaluateSystemParameterDefaultTrue("create_edit"); + if (options.no_create_edit) { + props.canCreateEdit = false; + } else if ("no_create_edit" in options) { + // Same condition set in web/views/fields/many2one/many2one_field + props.canCreateEdit = attrs.can_create + ? evaluateBooleanExpr(attrs.can_create) + : true; + } else if (!canCreateEdit && props.canCreateEdit) { + props.canCreateEdit = false; + } else if (canCreateEdit && !props.canCreateEdit) { + // Same condition set in web/views/fields/many2one/many2one_field + props.canCreateEdit = attrs.can_create + ? evaluateBooleanExpr(attrs.can_create) + : true; + } + return props; + }, + + m2m_options_props_limit(props, attrs, options) { + const ir_options = session.web_m2x_options; + if (Number(options.limit) && options.limit > 1) { + props.searchLimit = Number(options.limit) - 1; + } else if ( + Number(ir_options["web_m2x_options.limit"]) && + ir_options["web_m2x_options.limit"] > 1 + ) { + props.searchLimit = Number(ir_options["web_m2x_options.limit"]) - 1; + } + return props; + }, + + m2m_options_props(props, attrs, options) { + let newProps = props; + newProps = this.m2m_options_props_create(newProps, attrs, options); + newProps = this.m2m_options_props_create_edit(newProps, attrs, options); + newProps = this.m2m_options_props_limit(newProps, attrs, options); + newProps.fieldColor = options.field_color; + newProps.fieldColorOptions = options.colors; + return newProps; + }, + extractProps({attrs, options, string}, dynamicInfo) { + const props = super.extractProps({attrs, options, string}, dynamicInfo); + return this.m2m_options_props(props, attrs, options); + }, +}); + +patch(Many2XAutocomplete.prototype, { + async loadOptionsSource(request) { + var options = await super.loadOptionsSource(request); + this.field_color = this.props.fieldColor; + this.colors = this.props.fieldColorOptions; + if (this.colors && this.field_color) { + var value_ids = options.map((result) => result.value); + const objects = await this.orm.call( + this.props.resModel, + "search_read", + [], + { + domain: [["id", "in", value_ids]], + fields: [this.field_color], + } + ); + for (var index in objects) { + for (var index_value in options) { + if (options[index_value].value === objects[index].id) { + // Find value in values by comparing ids + var option = options[index_value]; + // Find color with field value as key + var color = + this.colors[objects[index][this.field_color]] || "black"; + option.style = "color:" + color; + break; + } + } + } + } + return options; + }, +}); + +patch(FormController.prototype, { + /** + * @override + */ + setup() { + super.setup(...arguments); + this._setSubViewLimit(); + }, + /** + * @override + * add more method to add subview limit on formview + */ + async _setSubViewLimit() { + const ir_options = session.web_m2x_options || {}; + const activeFields = this.archInfo.fieldNodes, + isSmall = this.user; + + var limit = ir_options["web_m2x_options.field_limit_entries"]; + if (!(typeof limit === "undefined")) { + limit = parseInt(limit, 10); + } + for (const fieldName in activeFields) { + const field = activeFields[fieldName]; + if (!isX2Many(field)) { + // What follows only concerns x2many fields + continue; + } + // Const fieldInfo = activeFields[fieldName]; + if (field.invisible) { + // No need to fetch the sub view if the field is always invisible + continue; + } + + if (!field.field.useSubView) { + // The FieldComponent used to render the field doesn't need a sub view + continue; + } + let viewType = field.viewMode || "list,kanban"; + viewType = viewType.replace("tree", "list"); + if (viewType.includes(",")) { + viewType = isSmall ? "kanban" : "list"; + } + field.viewMode = viewType; + if (field.views && field.views[viewType] && limit) { + field.views[viewType].limit = limit; + } + } + }, +}); + +// O.W.L. v18+: schema is validated in dev mode on adding to registry +patch(registry.category("fields").validationSchema, { + m2o_options_props_create: {type: Function, optional: true}, + m2o_options_props_create_edit: {type: Function, optional: true}, + m2o_options_props_limit: {type: Function, optional: true}, + m2o_options_props_open: {type: Function, optional: true}, + m2o_options_props: {type: Function, optional: true}, + m2m_options_props_create: {type: Function, optional: true}, + m2m_options_props_create_edit: {type: Function, optional: true}, + m2m_options_props_limit: {type: Function, optional: true}, + m2m_options_props: {type: Function, optional: true}, +}); + +registry.category("fields").add( + "many2one", + { + ...many2OneField.buildM2OFieldDescription(many2OneField.Many2OneField), + extractProps(staticInfo, dynamicInfo) { + const props = many2OneField.extractM2OFieldProps(staticInfo, dynamicInfo); + return m2o_options_props(props, staticInfo.attrs, staticInfo.options); + }, + }, + {force: true} +); diff --git a/web_m2x_options/static/src/views/fields/standard_field_props.esm.js b/web_m2x_options/static/src/views/fields/standard_field_props.esm.js new file mode 100644 index 0000000..928ba9f --- /dev/null +++ b/web_m2x_options/static/src/views/fields/standard_field_props.esm.js @@ -0,0 +1,12 @@ +import {patch} from "@web/core/utils/patch"; +import {standardFieldProps} from "@web/views/fields/standard_field_props"; + +export const fieldColorProps = { + fieldColor: {type: String, optional: true}, + fieldColorOptions: {type: Object, optional: true}, +}; + +patch(standardFieldProps, { + ...fieldColorProps, + searchLimit: {type: Number, optional: true}, +}); diff --git a/web_m2x_options/tests/__init__.py b/web_m2x_options/tests/__init__.py new file mode 100644 index 0000000..b472ff3 --- /dev/null +++ b/web_m2x_options/tests/__init__.py @@ -0,0 +1,2 @@ +# Copyright 2020 initOS GmbH. +from . import test_ir_config_parameter diff --git a/web_m2x_options/tests/test_ir_config_parameter.py b/web_m2x_options/tests/test_ir_config_parameter.py new file mode 100644 index 0000000..69c85e2 --- /dev/null +++ b/web_m2x_options/tests/test_ir_config_parameter.py @@ -0,0 +1,23 @@ +# Copyright 2020 initOS GmbH. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo.tests import TransactionCase + + +class TestIrConfigParameter(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.env["ir.config_parameter"].set_param("web_m2x_options.limit", 10) + cls.env["ir.config_parameter"].set_param("web_m2x_options.create_edit", "True") + cls.env["ir.config_parameter"].set_param("web_m2x_options.create", "True") + + def test_web_m2x_options_key(self): + web_m2x_options = self.env["ir.config_parameter"].get_web_m2x_options() + self.assertIn("web_m2x_options.limit", web_m2x_options) + + def test_web_m2x_options_value(self): + web_m2x_options = self.env["ir.config_parameter"].get_web_m2x_options() + self.assertEqual(web_m2x_options["web_m2x_options.limit"], "10") + self.assertTrue(bool(web_m2x_options["web_m2x_options.create_edit"])) + self.assertTrue(bool(web_m2x_options["web_m2x_options.create"])) From 384697d8d53ca494809bc376ecbe7aa82cbecf81 Mon Sep 17 00:00:00 2001 From: Aungkokolin1997 Date: Fri, 29 May 2026 06:42:06 +0000 Subject: [PATCH 2/2] reflect oca changes --- .../static/src/components/form.esm.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/web_m2x_options/static/src/components/form.esm.js b/web_m2x_options/static/src/components/form.esm.js index c156c31..b285dd1 100644 --- a/web_m2x_options/static/src/components/form.esm.js +++ b/web_m2x_options/static/src/components/form.esm.js @@ -146,6 +146,25 @@ patch(many2OneField.Many2OneField.prototype, { }); patch(Many2One.prototype, { + // Enforce the create/create_edit/open system parameters here, on the shared + // Many2One component, rather than only in the many2one field's extractProps. + // Specialized widgets (e.g. sol_product_many2one on sale/purchase order lines) + // define their own extractProps and never call m2o_options_props, so a + // field-level override does not reach them. They all render this component, + // so gating it here covers every many2one. + get activeActions() { + const actions = super.activeActions; + if (!evaluateSystemParameterDefaultTrue("create_edit")) { + actions.createEdit = false; + } + return actions; + }, + get hasLinkButton() { + if (!evaluateSystemParameterDefaultTrue("open")) { + return false; + } + return super.hasLinkButton; + }, get many2XAutocompleteProps() { let search_limit = 0; if (this.props.searchLimit) { @@ -164,6 +183,9 @@ patch(Many2One.prototype, { ret_props.fieldColor = field_color; ret_props.fieldColorOptions = field_color_options; } + if (!evaluateSystemParameterDefaultTrue("create")) { + ret_props.quickCreate = null; + } return ret_props; }, });