You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

117 lines
3.9 KiB

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
  1. .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
  2. :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
  3. :alt: License: AGPL-3
  4. =========================
  5. Web widget boolean switch
  6. =========================
  7. This module add a widget ``boolean_switch`` to render boolean fields. One
  8. of it's main features is to quick edit that field without enter in edit mode.
  9. Configuration
  10. =============
  11. In the view (test on tree view and form view), you can declare any boolean
  12. field using this widget.
  13. Example
  14. -------
  15. ```
  16. <field name="active"
  17. widget="boolean_switch"
  18. context="{'fake_parameter': 'foo'}"
  19. options="{'quick_edit': True, 'extra': {'onText': 'Yes', 'offText': 'No' }}"/>
  20. ```
  21. .. note::
  22. ``context`` is sent to the ``write`` method of the field model in case of
  23. special needs with the quick edition.
  24. Options
  25. -------
  26. quick_edit
  27. ~~~~~~~~~~
  28. extra
  29. ~~~~~
  30. ``extra`` is used to set
  31. `bootstrap-switch <http://www.bootstrap-switch.org/options.html>`_ options.
  32. *Available options*:
  33. * **size**: The checkbox size - default: `null` - values: null, 'mini', 'small', 'normal', 'large'
  34. * **animate**: Animate the switch - default: `true`
  35. * **indeterminate**: Indeterminate state - default: `false`
  36. * **inverse**: Inverse switch direction - default: `false`
  37. * **onColor**: Color of the left side of the switch - default: `"primary"` - values: 'primary', 'info', 'success', 'warning', 'danger', 'default'
  38. * **offColor**: Color of the right side of the switch - default: `default` - values: 'primary', 'info', 'success', 'warning', 'danger', 'default'
  39. * **onText**: Text of the left side of the switch - default: `"ON"`
  40. * **offText**: Text of the right side of the switch - default: `"OFF"`,
  41. * **labelText**: Text of the center handle of the switch - default: `"&nbsp;"`,
  42. * **handleWidth**: Width of the left and right sides in pixels - default: `"auto"`,
  43. * **labelWidth**: Width of the center handle in pixels - default: `"auto"`,
  44. * **baseClass**: Global class prefix - default: `"bootstrap-switch"`,
  45. * **wrapperClass**: Container element class(es) - default: `"wrapper"`,
  46. ..warning::
  47. Those parameters are overwritten by this module or highly discouraged:
  48. * **radioAllOff**: Allow this radio button to be unchecked by the user - default: `false`
  49. * **state**: The checkbox state - default: `true`
  50. * **disabled**: Disable state - default: `false`
  51. * **readonly**: Readonly state - default: `false`
  52. * **onInit**: Callback function to execute on initialization - default: `function() {}`,
  53. * **onSwitchChange**: Callback function to execute on switch state change - default: `function() {}`
  54. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
  55. :alt: Try me on Runbot
  56. :target: https://runbot.odoo-community.org/runbot/162/7.0
  57. Known issues / Roadmap
  58. ======================
  59. * Manage Null values
  60. *
  61. Bug Tracker
  62. ===========
  63. Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
  64. In case of trouble, please check there if your issue has already been reported.
  65. If you spotted it first, help us smashing it by providing a detailed and
  66. welcomed feedback `here <https://github.com/OCA/web/issues/new?body=module:%20
  67. web_widget_boolean_switch%0Aversion:%207.0%0A%0A**Steps%20to%20reproduce**%0A-
  68. %20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
  69. Credits
  70. =======
  71. Contributors
  72. ------------
  73. * Pierre Verkest <pverkest@anybox.fr>
  74. Maintainer
  75. ----------
  76. .. image:: https://odoo-community.org/logo.png
  77. :alt: Odoo Community Association
  78. :target: https://odoo-community.org
  79. This module is maintained by the OCA.
  80. OCA, or the Odoo Community Association, is a nonprofit organization whose
  81. mission is to support the collaborative development of Odoo features and
  82. promote its widespread use.
  83. To contribute to this module, please visit http://odoo-community.org.