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.

177 lines
5.1 KiB

  1. # -*- coding: utf-8 -*-
  2. # © <YEAR(S)> <AUTHOR(S)>
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. {
  5. "name": "Web widget boolean switch",
  6. "summary": "This module add widget to render boolean fields",
  7. "version": "7.0.1.0.0",
  8. "category": "web",
  9. "website": "https://odoo-community.org/",
  10. "author": "<pverkest@anybox>, Odoo Community Association (OCA)",
  11. "license": "AGPL-3",
  12. "application": False,
  13. "installable": True,
  14. "external_dependencies": {
  15. "python": [],
  16. "bin": [],
  17. },
  18. "depends": [
  19. "base",
  20. "web",
  21. ],
  22. "data": [
  23. ],
  24. "js": [
  25. 'static/lib/bootstrap-switch/bootstrap-switch.js',
  26. 'static/src/js/web_widget_boolean_switch.js',
  27. ],
  28. 'test': [
  29. 'static/test/web_widget_boolean_switch.js',
  30. ],
  31. "css": [
  32. 'static/lib/bootstrap-switch/bootstrap-switch.css',
  33. ],
  34. 'qweb': [
  35. 'static/src/xml/web_widget_boolean_switch.xml',
  36. ],
  37. "demo": [
  38. 'demo/res_users_view.xml',
  39. ],
  40. 'description': """
  41. .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
  42. :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
  43. :alt: License: AGPL-3
  44. =========================
  45. Web widget boolean switch
  46. =========================
  47. This module add a widget ``boolean_switch`` to render boolean fields. One
  48. of it's main features is to quick edit that field without enter in edit mode
  49. from list view or form view.
  50. Configuration
  51. =============
  52. In the view (test on tree view and form view), you can declare any boolean
  53. field using this widget.
  54. Example
  55. -------
  56. ```
  57. <field name="active"
  58. widget="boolean_switch"
  59. attrs="{'readonly': [('login', '=', 'admin')]}"
  60. context="{'fake_parameter': 'foo'}"
  61. options="{'quick_edit': True, 'extra': {'onText': 'Yes',
  62. 'offText': 'No'}}"/>
  63. ```
  64. Options
  65. -------
  66. quick_edit
  67. ~~~~~~~~~~
  68. extra
  69. ~~~~~
  70. ``extra`` is used to set
  71. `bootstrap-switch <http://www.bootstrap-switch.org/options.html>`_ options.
  72. *Available options*:
  73. * **size**: The checkbox size - default: `null` - values: null, 'mini',
  74. 'small', 'normal', 'large'
  75. * **animate**: Animate the switch - default: `true`
  76. * **indeterminate**: Indeterminate state - default: `false`
  77. * **inverse**: Inverse switch direction - default: `false`
  78. * **onColor**: Color of the left side of the switch - default: `"primary"` -
  79. values: 'primary', 'info', 'success', 'warning', 'danger', 'default'
  80. * **offColor**: Color of the right side of the switch - default: `default` -
  81. values: 'primary', 'info', 'success', 'warning', 'danger', 'default'
  82. * **onText**: Text of the left side of the switch - default: `"ON"`
  83. * **offText**: Text of the right side of the switch - default: `"OFF"`
  84. * **labelText**: Text of the center handle of the switch - default:
  85. `"&nbsp;"`,
  86. * **handleWidth**: Width of the left and right sides in pixels - default:
  87. `"auto"`,
  88. * **labelWidth**: Width of the center handle in pixels - default: `"auto"`
  89. * **baseClass**: Global class prefix - default: `"bootstrap-switch"`
  90. * **wrapperClass**: Container element class(es) - default: `"wrapper"`
  91. .. warning::
  92. Those parameters are overwritten by this module or highly discouraged:
  93. * **radioAllOff**: Allow this radio button to be unchecked by the user -
  94. default: `false`
  95. * **state**: The checkbox state - default: `true`
  96. * **disabled**: Disable state - default: `false`
  97. * **readonly**: Readonly state - default: `false`
  98. * **onInit**: Callback function to execute on initialization - default:
  99. `function() {}`,
  100. * **onSwitchChange**: Callback function to execute on switch state change -
  101. default: `function() {}`
  102. attrs
  103. -----
  104. This attribute is supported as expected!
  105. context
  106. -------
  107. ``context`` is sent to the ``write`` method of the field model in case of
  108. special needs with the quick edition.
  109. .. image:: https://odoo-community.org/website/image/ir.attachment/
  110. 5784_f2813bd/datas
  111. :alt: Try me on Runbot
  112. :target: https://runbot.odoo-community.org/runbot/162/7.0
  113. Known issues / Roadmap
  114. ======================
  115. * Manage Null values
  116. *
  117. Bug Tracker
  118. ===========
  119. Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
  120. In case of trouble, please check there if your issue has already been reported.
  121. If you spotted it first, help us smashing it by providing a detailed and
  122. welcomed feedback `here <https://github.com/OCA/web/issues/new?body=module:%20
  123. web_widget_boolean_switch%0Aversion:%207.0%0A%0A**Steps%20to%20reproduce**%0A-
  124. %20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
  125. Credits
  126. =======
  127. Contributors
  128. ------------
  129. * Pierre Verkest <pverkest@anybox.fr>
  130. Maintainer
  131. ----------
  132. .. image:: https://odoo-community.org/logo.png
  133. :alt: Odoo Community Association
  134. :target: https://odoo-community.org
  135. This module is maintained by the OCA.
  136. OCA, or the Odoo Community Association, is a nonprofit organization whose
  137. mission is to support the collaborative development of Odoo features and
  138. promote its widespread use.
  139. To contribute to this module, please visit http://odoo-community.org.
  140. """,
  141. }