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
    • Artificial Intelligence
    • 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
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

Can I prevent some Users from removing default search filters in Odoo 17?

Subscribe

Get notified when there's activity on this post

This question has been flagged
usersfilters
3 Replies
656 Views
Avatar
Anush Soghomonyan

Hello,

How can I restrict certain users from being able to remove the default filter from the Search view in Odoo 17?
Thank you!

1
Avatar
Discard
Codesphere Tech

Hello
Yes it is possible but you need required small customization for that.

Anush Soghomonyan
Author

I can write small code at Studio level. If that’s convenient, I would appreciate it if you could provide the code, or explain what needs to be done.

Codesphere Tech

It required to update JS file so It is not possible through studio customization.

Avatar
Jainesh Shah(Aktiv Software)
Best Answer

Hi Anush Soghomonyan,


This is not possible at the Studio level because Studio does not provide control over the SearchModel behavior in the web client. A custom module is required.

One approach is to create a security group and patch the Odoo 17 SearchModel to prevent users in that group from removing default search filters.

1. Create a Security Group

<!-- security/security.xml -->
<record id="group_search_filter_manager" model="res.groups">
    <field name="name">Restricted From Removing Default Search Filters</field>
    <field name="category_id" ref="base.module_category_hidden"/>
</record>

Assign this group to users who should be restricted from removing default filters.

2. Patch the SearchModel

/** @odoo-module **/

import { SearchModel } from "@web/search/search_model";
import { patch } from "@web/core/utils/patch";
import { _t } from "@web/core/l10n/translation";

patch(SearchModel.prototype, {
    async load(config) {
        await super.load(config);

        // Store default filters loaded initially
        this._defaultGroupIds = new Set(
            this.query.map((q) => this.searchItems[q.searchItemId]?.groupId)
        );

        // Check whether current user is restricted
        this._canRemoveDefaultFilters = await this.userService.hasGroup(
            "your_module.group_search_filter_manager"
        ).then((isRestricted) => !isRestricted);
    },

    deactivateGroup(groupId) {
        if (
            !this._canRemoveDefaultFilters &&
            this._defaultGroupIds?.has(groupId)
        ) {
            this.env.services.notification.add(
                _t("You are not allowed to remove default filters."),
                { type: "warning" }
            );
            return;
        }
        return super.deactivateGroup(groupId);
    },
});

3. Load the JS File in Assets

Add the JS file to the backend assets in your module manifest:

'assets': {
    'web.assets_backend': [
        'your_module/static/src/js/search_model_patch.js',
    ],
},

Result:

  • Users in the restricted group cannot remove default search filters.
  • Users outside the group can remove filters normally.
  • Only filters loaded by default are protected, while other filters continue to work as usual.


If you have any questions, feel free to reach out.

Hope this helps!

 

Thanks and Regards,

Email: odoo@aktivsoftware.com

0
Avatar
Discard
Anush Soghomonyan
Author

Thank you!

Avatar
Cybrosys Techno Solutions Pvt.Ltd
Best Answer
Hi,

In Odoo 17 Online (SaaS), there is no standard feature to prevent specific users from removing or changing filters in the Search view. Default filters are applied through the search view, action context, or user favorites, but users who have access to the view can generally modify or clear them during their session.

Since you are using Odoo Online and cannot deploy custom modules, your options are limited to standard configuration. You can set default filters using saved favorites or action contexts, but these are not enforced and users can still remove them. To make filters truly mandatory for certain users, you would typically need record rules (to restrict the data itself) or a custom development, neither of which can be implemented through simple configuration alone.

Therefore, in a standard Odoo 17 Online environment, it is not possible to prevent selected users from removing default search filters. If the goal is to restrict which records users can see, using appropriate security groups and record rules would be the recommended approach.


Hope it helps

0
Avatar
Discard
Anush Soghomonyan
Author

Thank you!

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Related Posts Replies Views Activity
Remove access rights to a date Solved
users
Avatar
Avatar
Avatar
2
Mar 26
2568
Managing users access rights UI changed from last week Solved
users
Avatar
Avatar
1
Sep 25
4088
What is exact difference between portal and public user in odoo? when We need to create a public user? Solved
users
Avatar
Avatar
Avatar
Avatar
3
Jul 25
12257
How can I view user login history in my Odoo Standard v18 database?
users
Avatar
Avatar
1
May 25
4091
What is the minimum number of users need to purchase ? Solved
users
Avatar
Avatar
Avatar
2
Jan 25
4894
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
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk Slovenščina Español (América Latina) Español Svenska ภาษาไทย Türkçe українська Tiếng Việt

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

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now