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.

124 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
  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. ```xml
  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::
  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. Usage
  55. =====
  56. To use this module, you need to:
  57. * go to ...
  58. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
  59. :alt: Try me on Runbot
  60. :target: https://runbot.odoo-community.org/runbot/162/7.0
  61. Known issues / Roadmap
  62. ======================
  63. * Manage Null values
  64. *
  65. Bug Tracker
  66. ===========
  67. Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
  68. In case of trouble, please check there if your issue has already been reported.
  69. If you spotted it first, help us smashing it by providing a detailed and
  70. welcomed feedback `here <https://github.com/OCA/web/issues/new?body=module:%20
  71. web_widget_boolean_switch%0Aversion:%207.0%0A%0A**Steps%20to%20reproduce**%0A-
  72. %20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
  73. Credits
  74. =======
  75. Contributors
  76. ------------
  77. * Pierre Verkest <pverkest@anybox.fr>
  78. Maintainer
  79. ----------
  80. .. image:: https://odoo-community.org/logo.png
  81. :alt: Odoo Community Association
  82. :target: https://odoo-community.org
  83. This module is maintained by the OCA.
  84. OCA, or the Odoo Community Association, is a nonprofit organization whose
  85. mission is to support the collaborative development of Odoo features and
  86. promote its widespread use.
  87. To contribute to this module, please visit http://odoo-community.org.