mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[ADD] web_widget_dropdown_dynamic
[UPD] Update web_widget_dropdown_dynamic.pot [UPD] Update web_widget_dropdown_dynamic_example.pot [UPD] README.rst [ADD] icon.png [UPD] README.rst
This commit is contained in:
committed by
Thanakrit Pintana
parent
222bec5c5d
commit
5f03f1b541
1
web_widget_dropdown_dynamic/readme/CONTRIBUTORS.rst
Normal file
1
web_widget_dropdown_dynamic/readme/CONTRIBUTORS.rst
Normal file
@@ -0,0 +1 @@
|
||||
* Alexey Pelykh <alexey.pelykh@brainbeanapps.com>
|
||||
9
web_widget_dropdown_dynamic/readme/DESCRIPTION.rst
Normal file
9
web_widget_dropdown_dynamic/readme/DESCRIPTION.rst
Normal file
@@ -0,0 +1,9 @@
|
||||
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.
|
||||
1
web_widget_dropdown_dynamic/readme/ROADMAP.rst
Normal file
1
web_widget_dropdown_dynamic/readme/ROADMAP.rst
Normal file
@@ -0,0 +1 @@
|
||||
* In v13, ``$.when`` is going to become `Promise.resolve`
|
||||
24
web_widget_dropdown_dynamic/readme/USAGE.rst
Normal file
24
web_widget_dropdown_dynamic/readme/USAGE.rst
Normal file
@@ -0,0 +1,24 @@
|
||||
.. code-block:: 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-block:: xml
|
||||
|
||||
<field
|
||||
name="other_field"
|
||||
/>
|
||||
<field
|
||||
name="char_field"
|
||||
widget="dynamic_dropdown"
|
||||
values="method_name"
|
||||
context="{'depending_on': other_field}"
|
||||
/>
|
||||
Reference in New Issue
Block a user