Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions setup/web_hide_custom_search/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
95 changes: 95 additions & 0 deletions web_hide_custom_search/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
======================
Web Hide Custom Search
======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e6b42245e8f445172fd95488fce48ce16240881b5e53d4730208a3b9db9e8197
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--ux-lightgray.png?logo=github
:target: https://github.com/OCA/server-ux/tree/15.0/web_hide_custom_search
:alt: OCA/server-ux
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-ux-15-0/server-ux-15-0-web_hide_custom_search
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-ux&target_branch=15.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows controlling the visibility of the “Add Custom Filter”
and “Add Custom Group” options in the search view for specific models
and specific user groups.

**Table of contents**

.. contents::
:local:

Configuration
=============

To show the “Add Custom Filter” and “Add Custom Group” options for a
specific model to specific groups only:

1. Go to **Settings → Technical → Database Structure → Models**.
2. Open the model where you want to control the visibility of the **Add
Custom Filter** and **Add Custom Group** options.
3. Set the **Custom Search Groups** field as needed. If no groups are
assigned, Odoo will follow its standard behavior.

Alternatively, you can assign models from the Groups form view by adding
them under the "Custom Search Models" tab.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-ux/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/server-ux/issues/new?body=module:%20web_hide_custom_search%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Quartile

Contributors
------------

- `Quartile <https://www.quartile.co>`__:

- Aung Ko Ko Lin

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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.

This module is part of the `OCA/server-ux <https://github.com/OCA/server-ux/tree/15.0/web_hide_custom_search>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions web_hide_custom_search/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
27 changes: 27 additions & 0 deletions web_hide_custom_search/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2025 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Web Hide Custom Search",
"category": "Usability",
"version": "15.0.1.0.0",
"author": "Quartile, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/server-ux",
"license": "AGPL-3",
"depends": ["web"],
"data": [
"views/ir_model_views.xml",
"views/res_groups_views.xml",
],
"assets": {
"web.assets_qweb": [
"web_hide_custom_search/static/src/xml/*.xml",
],
"web.assets_backend": [
"web_hide_custom_search/static/src/js/*.esm.js",
],
"web.qunit_suite_tests": [
"web_hide_custom_search/static/tests/*.esm.js",
],
},
"installable": True,
}
2 changes: 2 additions & 0 deletions web_hide_custom_search/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import ir_model
from . import res_groups
24 changes: 24 additions & 0 deletions web_hide_custom_search/models/ir_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2025 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


class IrModel(models.Model):
_inherit = "ir.model"

custom_search_group_ids = fields.Many2many(
"res.groups",
string="Custom Search Groups",
relation="custom_search_group_rel",
help="If set, only users in these groups will see the 'Add Custom Filter' "
"and 'Add Custom Group' options in the search view for this model.",
)

@api.model
def is_custom_search_visible(self, model_name):
model = self.sudo().search([("model", "=", model_name)], limit=1)
groups = model.custom_search_group_ids
if not model or not groups or self.env.user in groups.users:
return True
return False
16 changes: 16 additions & 0 deletions web_hide_custom_search/models/res_groups.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2025 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class ResGroups(models.Model):
_inherit = "res.groups"

custom_search_model_ids = fields.Many2many(
"ir.model",
relation="custom_search_group_rel",
string="Custom Search Models",
help="Only users in this group will see the 'Add Custom Filter' and "
"'Add Custom Group' options in the search view of the selected models.",
)
11 changes: 11 additions & 0 deletions web_hide_custom_search/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
To show the “Add Custom Filter” and “Add Custom Group” options for a specific model
to specific groups only:

1. Go to **Settings → Technical → Database Structure → Models**.
2. Open the model where you want to control the visibility of the
**Add Custom Filter** and **Add Custom Group** options.
3. Set the **Custom Search Groups** field as needed.
If no groups are assigned, Odoo will follow its standard behavior.

Alternatively, you can assign models from the Groups form view by adding them
under the "Custom Search Models" tab.
2 changes: 2 additions & 0 deletions web_hide_custom_search/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- [Quartile](https://www.quartile.co):
- Aung Ko Ko Lin
2 changes: 2 additions & 0 deletions web_hide_custom_search/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module allows controlling the visibility of the “Add Custom Filter” and
“Add Custom Group” options in the search view for specific models and specific user groups.
Loading
Loading