Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Property Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
      • Get a Tailored Demo
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +32 2 290 34 90
    • Get a Tailored Demo
  • Pricing
  • Help
  1. APPS
  2. Technical
  3. Mutex Toggle Field v 16.0
  4. Sales Conditions FAQ

Mutex Toggle Field

by YLHC Technology https://www.ylhctec.com , co. https://www.ylhctec.com , ltd. https://www.ylhctec.com
Odoo
v 16.0 Third Party 22
Download for v 16.0 Deploy on Odoo.sh
Apps purchases are linked to your Odoo account, please sign in or sign up first.
Availability
Odoo Online
Odoo.sh
On Premise
Lines of code 49
Technical Name ylhc_mutex_toggle
LicenseOPL-1
Websitehttps://www.ylhctec.com
Versions 16.0 17.0 18.0 19.0
You bought this module and need support? Click here!
  • Description
  • License

Mutex Toggle Field

Mutually Exclusive Toggle Widget for Odoo List Views


Technical Widget Module

Ylhc Mutex Toggle Field provides a mutually exclusive toggle widget for boolean fields in Odoo list views. When enabled on a record, it automatically disables the toggle on all other records in the list, ensuring only one item can be active at a time. Perfect for selecting a default item, primary record, or exclusive option!

How It Works:
This widget extends Odoo's standard boolean toggle field with mutex (mutually exclusive) functionality. When you toggle a field ON in one record, the widget automatically sets the same field to OFF in all other records. This ensures only one record can have the toggle enabled at any given time - perfect for scenarios like "set as default", "is primary", "featured item", or "active selection".

Visit Our Website for More Information Contact Support: support@ylhctec.com
Usage Guide See Features

Usage Guide

Implementing the mutex toggle widget is simple and straightforward. Follow these steps to add mutually exclusive toggle functionality to your boolean fields:

Installation
  1. Navigate to Apps menu in Odoo
  2. Search for "Mutex Toggle Field"
  3. Click Install button
  4. Wait for installation to complete
Basic Usage

Add the widget to any boolean field in your list view XML:

<field name="is_default" widget="mutex_toggle"/>
Complete Example

Here's a complete example showing how to use the mutex toggle widget in a list view:

<odoo>
    <record id="view_partner_bank_tree" model="ir.ui.view">
        <field name="name">partner.bank.tree</field>
        <field name="model">res.partner.bank</field>
        <field name="arch" type="xml">
            <tree>
                <field name="acc_number"/>
                <field name="bank_name"/>
                <field name="is_default" widget="mutex_toggle"/>
            </tree>
        </field>
    </record>
</odoo>
Common Use Cases
  • Default Selection: Mark one item as the default (e.g., default bank account, default address)
  • Primary Record: Designate a primary contact, primary phone number, etc.
  • Featured Item: Highlight one featured product, article, or image
  • Active Selection: Set one active configuration from multiple options
  • Preferred Option: Choose preferred shipping method, payment method, etc.
Important Notes:
  • The widget only works in list/tree views
  • All records must be loaded in the current list view for proper mutex behavior
  • The widget patches Odoo's boolean toggle to prevent auto-save
  • Works with standard Odoo boolean fields - no model modifications required

Key Features

Ylhc Mutex Toggle Field provides essential functionality for managing mutually exclusive boolean fields in Odoo list views. Simple, efficient, and developer-friendly.

Mutex Functionality

Automatic mutual exclusion - only one record can have the toggle enabled at a time.

Easy Integration

Simply add widget="mutex_toggle" to any boolean field - no model changes required.

List View Optimized

Designed specifically for Odoo list/tree views with seamless user experience.

Controlled Saving

Patches boolean toggle to prevent auto-save, giving you full control over when changes persist.

Clean Code

Well-structured, maintainable JavaScript code following Odoo best practices.

Lightweight

Minimal code footprint with no performance impact on your Odoo instance.

Odoo 18 Ready

Fully compatible with Odoo 18.0 and OWL 2.0 framework.

Developer Friendly

Simple API, clear documentation, and straightforward implementation.

Frequently Asked Questions

Do I need to modify my models to use this widget?

No! The mutex toggle widget works with standard Odoo boolean fields. No model modifications, custom fields, or database changes are required.

Does it work in form views?

The mutex toggle widget is specifically designed for list/tree views. In form views, it will behave as a standard boolean field.

What happens if I toggle a field ON?

When you enable a toggle, the widget automatically sets the same field to OFF in all other visible records in the list. Only one record will have the toggle enabled.

Can I use it on multiple fields?

Yes! You can use the mutex_toggle widget on multiple different boolean fields in the same view. Each field operates independently with its own mutex behavior.

Is it compatible with Odoo Community Edition?

Yes! The widget works perfectly with both Odoo Community and Enterprise editions for version 18.0.

Odoo Proprietary License v1.0

This software and associated files (the "Software") may only be used (executed,
modified, executed after modifications) if you have purchased a valid license
from the authors, typically via Odoo Apps, or if you have received a written
agreement from the authors of the Software (see the COPYRIGHT file).

You may develop Odoo modules that use the Software as a library (typically
by depending on it, importing it and using its resources), but without copying
any source code or material from the Software. You may distribute those
modules under the license of your choice, provided that this license is
compatible with the terms of the Odoo Proprietary License (For example:
LGPL, MIT, or proprietary licenses similar to this one).

It is forbidden to publish, distribute, sublicense, or sell copies of the Software
or modified copies of the Software.

The above copyright notice and this permission notice must be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

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.
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with