Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18.0][MIG] web_widget_dropdown_dynamic: Migration to 18.0 #3032

Open
wants to merge 22 commits into
base: 18.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c0910bf
[ADD] web_widget_dropdown_dynamic
alexey-pelykh Sep 11, 2019
dce8707
[IMP] web_widget_dropdown_dynamic: black, isort, prettier
alexey-pelykh Apr 12, 2020
88d09ba
[MIG] web_widget_dropdown_dynamic: Migration to 13.0
alexey-pelykh Apr 12, 2020
105e14b
[UPD] Brainbean Apps => CorporateHub
alexey-pelykh Nov 8, 2020
f0050d3
Added translation using Weblate (Spanish)
claudiagn Feb 17, 2021
ac04b15
Translated using Weblate (Spanish)
claudiagn Feb 17, 2021
828db6b
[IMP] web_widget_dropdown_dynamic: black, isort, prettier
NL66278 May 28, 2021
e7b3b60
[MIG] web_widget_dropdown_dynamic: Migration to 14.0
NL66278 May 28, 2021
4f907e8
Added translation using Weblate (German)
Corneliuus Oct 13, 2021
b4d9c17
Translated using Weblate (German)
Corneliuus Oct 13, 2021
c99849c
[IMP] web_widget_dropdown_dynamic: black, isort, prettier
BankyKmitl Nov 30, 2021
d1c532e
[MIG] web_widget_dropdown_dynamic: Migration to 15.0
BankyKmitl Dec 1, 2021
331fe6f
[16.0][MIG] web_widget_dropdown_dynamic
gbrito Mar 28, 2023
6c45091
[16.0][MIG]web_widget_dropdown_dynamic: Migrate to version 16.0
Jul 6, 2023
4d06844
Added translation using Weblate (Italian)
mymage Nov 27, 2023
9e415ab
[IMP] web_widget_dropdown_dynamic: pre-commit auto fixes
CarlosRoca13 Aug 12, 2024
2e88207
[MIG] web_widget_dropdown_dynamic: Migration to 17.0
CarlosRoca13 Aug 13, 2024
cd54e1f
[UPD] Update web_widget_dropdown_dynamic.pot
Aug 14, 2024
ee04460
[BOT] post-merge updates
OCA-git-bot Aug 14, 2024
987ecbe
Update translation files
weblate Aug 14, 2024
20a9a82
Translated using Weblate (Italian)
mymage Aug 14, 2024
a8789ec
[MIG] web_widget_dropdown_dynamic: Migration to 18.0
HeliconiaSolutions Dec 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 143 additions & 0 deletions web_widget_dropdown_dynamic/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
=======================
Dynamic Dropdown Widget
=======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:cd8f2fbb81d5981346094e7fb21bd25632e10536593177a28be1aca666f715a5
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/licence-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/18.0/web_widget_dropdown_dynamic
:alt: OCA/web
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/web-18-0/web-18-0-web_widget_dropdown_dynamic
: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=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Dynamic dropdown widget that supports resolving options from backend of:

- ``fields.Char``
- ``fields.Integer``
- ``fields.Selection``

**NOTE:** This widget is not intended to *extend* ``fields.Selection``,
but to filter selection values. For fully-dynamic set of options, use
``fields.Char`` instead.

**Table of contents**

.. contents::
:local:

Usage
=====

.. code:: python

@api.model
def method_name(self):
values = [
('value_a', 'Title A'),
]
if self.env.context.get('depending_on') == True:
values += [
('value_b', 'Title B'),
]
return values

.. code:: xml

<field
name="other_field"
/>
<field
name="char_field"
widget="dynamic_dropdown"
options="{'values':'method_name'}"
context="{'depending_on': other_field}"
/>

**DEMO**

On User defined filters added new field to show the feature, it is
called **Dropdown Integer**. If any user selected just One option shoud
appear, but if Mitchell Admin it should be possible to select option One
and Two.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/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 <https://github.com/OCA/web/issues/new?body=module:%20web_widget_dropdown_dynamic%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
-------

* CorporateHub

Contributors
------------

- `CorporateHub <https://corporatehub.eu/>`__

- Alexey Pelykh <[email protected]>

- `Therp BV <https://therp.nl/>`__

- Ronald Portier <[email protected]>

- Thanakrit Pintana <[email protected]>

- `Trobz <https://trobz.com>`__:

- Son Ho <[email protected]>

- `Tecnativa <https://www.tecnativa.com>`__:

- Carlos Roca

- ``Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>``\ \_

Other credits
-------------

The migration of this module from 15.0 to 16.0 was financially supported
by Camptocamp

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 <https://github.com/OCA/web/tree/18.0/web_widget_dropdown_dynamic>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions web_widget_dropdown_dynamic/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import models
26 changes: 26 additions & 0 deletions web_widget_dropdown_dynamic/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2019-2020 Brainbean Apps (https://brainbeanapps.com)
# Copyright 2020 CorporateHub (https://corporatehub.eu)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Dynamic Dropdown Widget",
"summary": "This module adds support for dynamic dropdown widget",
"category": "Web",
"version": "18.0.1.0.0",
"license": "AGPL-3",
"author": "CorporateHub, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/web",
"depends": ["web"],
"installable": True,
"assets": {
"web.assets_backend": [
"web_widget_dropdown_dynamic/static/src/js/field_dynamic_dropdown.esm.js",
],
"web.qunit_suite_tests": [
"web_widget_dropdown_dynamic/static/tests/web_widget_dropdown_dynamic_tests.esm.js",
],
},
"demo": [
"demo/ir_model_fields.xml",
"demo/ir_filters_view.xml",
],
}
17 changes: 17 additions & 0 deletions web_widget_dropdown_dynamic/demo/ir_filters_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="ir_filters_view_form" model="ir.ui.view">
<field name="model">ir.filters</field>
<field name="inherit_id" ref="base.ir_filters_view_form" />
<field name="arch" type="xml">
<field name="user_id" position="after">
<field
name="x_dynamic_dropdown_int"
widget="dynamic_dropdown"
options="{'values': 'dynamic_dropdown_int_method_demo'}"
context="{'depending_on': user_id}"
/>
</field>
</field>
</record>
</odoo>
11 changes: 11 additions & 0 deletions web_widget_dropdown_dynamic/demo/ir_model_fields.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="field_dynamic_dropdown_int" model="ir.model.fields">
<field name="field_description">Dropdown Integer</field>
<field name="model">ir.filters</field>
<field name="model_id" ref="base.model_ir_filters" />
<field name="name">x_dynamic_dropdown_int</field>
<field name="state">manual</field>
<field name="ttype">integer</field>
</record>
</odoo>
34 changes: 34 additions & 0 deletions web_widget_dropdown_dynamic/i18n/de.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_widget_dropdown_dynamic
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2021-10-13 20:46+0000\n"
"Last-Translator: Corneliuus <[email protected]>\n"
"Language-Team: none\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.3.2\n"

#. module: web_widget_dropdown_dynamic
#: model:ir.model.fields,field_description:web_widget_dropdown_dynamic.field_dynamic_dropdown_int
msgid "Dropdown Integer"
msgstr ""

#. module: web_widget_dropdown_dynamic
#. odoo-javascript
#: code:addons/web_widget_dropdown_dynamic/static/src/js/field_dynamic_dropdown.esm.js:0
#, python-format
msgid "Dynamic Dropdown"
msgstr "Dynamisches Dropdown"

#. module: web_widget_dropdown_dynamic
#: model:ir.model,name:web_widget_dropdown_dynamic.model_ir_filters
msgid "Filters"
msgstr ""
34 changes: 34 additions & 0 deletions web_widget_dropdown_dynamic/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_widget_dropdown_dynamic
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2021-02-17 14:45+0000\n"
"Last-Translator: claudiagn <[email protected]>\n"
"Language-Team: none\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.3.2\n"

#. module: web_widget_dropdown_dynamic
#: model:ir.model.fields,field_description:web_widget_dropdown_dynamic.field_dynamic_dropdown_int
msgid "Dropdown Integer"
msgstr ""

#. module: web_widget_dropdown_dynamic
#. odoo-javascript
#: code:addons/web_widget_dropdown_dynamic/static/src/js/field_dynamic_dropdown.esm.js:0
#, python-format
msgid "Dynamic Dropdown"
msgstr "Menú desplegable dinámico"

#. module: web_widget_dropdown_dynamic
#: model:ir.model,name:web_widget_dropdown_dynamic.model_ir_filters
msgid "Filters"
msgstr ""
34 changes: 34 additions & 0 deletions web_widget_dropdown_dynamic/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_widget_dropdown_dynamic
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-08-14 16:58+0000\n"
"Last-Translator: mymage <[email protected]>\n"
"Language-Team: none\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 5.6.2\n"

#. module: web_widget_dropdown_dynamic
#: model:ir.model.fields,field_description:web_widget_dropdown_dynamic.field_dynamic_dropdown_int
msgid "Dropdown Integer"
msgstr "Intero selezione tendina"

#. module: web_widget_dropdown_dynamic
#. odoo-javascript
#: code:addons/web_widget_dropdown_dynamic/static/src/js/field_dynamic_dropdown.esm.js:0
#, python-format
msgid "Dynamic Dropdown"
msgstr "Dropdown dinamico"

#. module: web_widget_dropdown_dynamic
#: model:ir.model,name:web_widget_dropdown_dynamic.model_ir_filters
msgid "Filters"
msgstr "Filtri"
31 changes: 31 additions & 0 deletions web_widget_dropdown_dynamic/i18n/web_widget_dropdown_dynamic.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_widget_dropdown_dynamic
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.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_widget_dropdown_dynamic
#: model:ir.model.fields,field_description:web_widget_dropdown_dynamic.field_dynamic_dropdown_int
msgid "Dropdown Integer"
msgstr ""

#. module: web_widget_dropdown_dynamic
#. odoo-javascript
#: code:addons/web_widget_dropdown_dynamic/static/src/js/field_dynamic_dropdown.esm.js:0
#, python-format
msgid "Dynamic Dropdown"
msgstr ""

#. module: web_widget_dropdown_dynamic
#: model:ir.model,name:web_widget_dropdown_dynamic.model_ir_filters
msgid "Filters"
msgstr ""
4 changes: 4 additions & 0 deletions web_widget_dropdown_dynamic/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from odoo.tools import config

if not config.get("without_demo"):
from . import ir_filters
19 changes: 19 additions & 0 deletions web_widget_dropdown_dynamic/models/ir_filters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2024 Tecnativa - Carlos Roca
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import api, models


class IrFilters(models.Model):
_inherit = "ir.filters"

@api.model
def dynamic_dropdown_int_method_demo(self):
values = [

Check warning on line 12 in web_widget_dropdown_dynamic/models/ir_filters.py

View check run for this annotation

Codecov / codecov/patch

web_widget_dropdown_dynamic/models/ir_filters.py#L12

Added line #L12 was not covered by tests
("1", "One"),
]
if self.env.context.get("depending_on") == self.env.ref("base.user_admin").id:
values += [

Check warning on line 16 in web_widget_dropdown_dynamic/models/ir_filters.py

View check run for this annotation

Codecov / codecov/patch

web_widget_dropdown_dynamic/models/ir_filters.py#L16

Added line #L16 was not covered by tests
("2", "Two"),
]
return values

Check warning on line 19 in web_widget_dropdown_dynamic/models/ir_filters.py

View check run for this annotation

Codecov / codecov/patch

web_widget_dropdown_dynamic/models/ir_filters.py#L19

Added line #L19 was not covered by tests
3 changes: 3 additions & 0 deletions web_widget_dropdown_dynamic/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
17 changes: 17 additions & 0 deletions web_widget_dropdown_dynamic/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
- [CorporateHub](https://corporatehub.eu/)

- Alexey Pelykh \<<[email protected]>\>

- [Therp BV](https://therp.nl/)

- Ronald Portier \<<[email protected]>\>

- Thanakrit Pintana \<<[email protected]>\>

- [Trobz](https://trobz.com):

> - Son Ho \<<[email protected]>\>

- [Tecnativa](https://www.tecnativa.com):
- Carlos Roca
- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`_
2 changes: 2 additions & 0 deletions web_widget_dropdown_dynamic/readme/CREDITS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
The migration of this module from 15.0 to 16.0 was financially supported
by Camptocamp
Loading
Loading