[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:
Alexey Pelykh
2019-09-11 14:04:03 +02:00
committed by Thanakrit Pintana
parent 222bec5c5d
commit 5f03f1b541
14 changed files with 1040 additions and 0 deletions

View File

@@ -0,0 +1 @@
* Alexey Pelykh <alexey.pelykh@brainbeanapps.com>

View 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.

View File

@@ -0,0 +1 @@
* In v13, ``$.when`` is going to become `Promise.resolve`

View 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}"
/>