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