Skip to Content
Menu
Third Party 239
Download for v 7.0
Availability
Odoo Online
Odoo.sh
On Premise
Technical Name web_widget_boolean_switch
LicenseAGPL-3
Websitehttps://odoo-community.org/
Repositorylp:web-addons/7.0
You bought this module and need support? Click here!

Web widget boolean switch

This module add a widget boolean_switch to render boolean fields. One of it's main features is to quick edit that field without enter in edit mode from list view or form view.

Configuration

In the view (test on tree view and form view), you can declare any boolean field using this widget.

Example

```
<field name="active"

widget="boolean_switch" attrs="{'readonly': [('login', '=', 'admin')]}" context="{'fake_parameter': 'foo'}" options="{'quick_edit': True, 'extra': {'onText': 'Yes',

'offText': 'No'}}"/>

```

Options

quick_edit

extra

extra is used to set bootstrap-switch options.

Available options:

  • size: The checkbox size - default: null - values: null, 'mini', 'small', 'normal', 'large'
  • animate: Animate the switch - default: true
  • indeterminate: Indeterminate state - default: false
  • inverse: Inverse switch direction - default: false
  • onColor: Color of the left side of the switch - default: "primary" - values: 'primary', 'info', 'success', 'warning', 'danger', 'default'
  • offColor: Color of the right side of the switch - default: default - values: 'primary', 'info', 'success', 'warning', 'danger', 'default'
  • onText: Text of the left side of the switch - default: "ON"
  • offText: Text of the right side of the switch - default: "OFF"
  • labelText: Text of the center handle of the switch - default: "&nbsp;",
  • handleWidth: Width of the left and right sides in pixels - default: "auto",
  • labelWidth: Width of the center handle in pixels - default: "auto"
  • baseClass: Global class prefix - default: "bootstrap-switch"
  • wrapperClass: Container element class(es) - default: "wrapper"

Warning

Those parameters are overwritten by this module or highly discouraged:

  • radioAllOff: Allow this radio button to be unchecked by the user - default: false
  • state: The checkbox state - default: true
  • disabled: Disable state - default: false
  • readonly: Readonly state - default: false
  • onInit: Callback function to execute on initialization - default: function() {},
  • onSwitchChange: Callback function to execute on switch state change - default: function() {}

attrs

This attribute is supported as expected!

context

context is sent to the write method of the field model in case of special needs with the quick edition.

Try me on Runbot

Known issues / Roadmap

  • Manage Null values

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed feedback here.

Credits

Contributors

Maintainer

Odoo Community Association

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

To contribute to this module, please visit http://odoo-community.org.

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author, please use the developer contact information. They can usually be found in the description.
Please choose a rating from 1 to 5 for this module.