Skip to content
Merged
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
95 changes: 95 additions & 0 deletions web_m2x_dialog_no_create/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
============================
No Create from Search Dialog
============================

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

.. |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%2Fweb-lightgray.png?logo=github
:target: https://github.com/OCA/web/tree/18.0/web_m2x_dialog_no_create
:alt: OCA/web
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/web-18-0/web-18-0-web_m2x_dialog_no_create
: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/web&target_branch=18.0
:alt: Try me on Runboat

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

This module hides the **New** button in many2one and many2many search
dialogs by default, preventing users from creating records directly from
the dialog.

An allowlist of models can be configured per company in *Settings >
General Settings > Search Dialog*, so the New button is shown only for
selected models.

**Table of contents**

.. contents::
:local:

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

To allow creation from the search dialog for specific models:

1. Go to **Settings > General Settings > Search Dialog**.
2. Add models to the **Allow Create from Search Dialog** field and save.

The setting is company-dependent, so each company can have its own
allowlist. A page refresh may be needed for changes to take effect.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/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/web/issues/new?body=module:%20web_m2x_dialog_no_create%0Aversion:%2018.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>`__:

- Yoshi Tashiro

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/web <https://github.com/OCA/web/tree/18.0/web_m2x_dialog_no_create>`_ 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_m2x_dialog_no_create/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
22 changes: 22 additions & 0 deletions web_m2x_dialog_no_create/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2026 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "No Create from Search Dialog",
"version": "18.0.1.0.0",
"category": "Technical",
"summary": "Hide New button in many2one/many2many search dialogs",
"author": "Quartile, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/web",
"license": "AGPL-3",
"depends": ["base_setup"],
"data": [
"views/res_config_settings_views.xml",
],
"assets": {
"web.assets_backend": [
"web_m2x_dialog_no_create/static/src/select_create_dialog.esm.js",
"web_m2x_dialog_no_create/static/src/select_create_dialog.xml",
],
},
"installable": True,
}
3 changes: 3 additions & 0 deletions web_m2x_dialog_no_create/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import ir_http
from . import res_company
from . import res_config_settings
16 changes: 16 additions & 0 deletions web_m2x_dialog_no_create/models/ir_http.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2026 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import models


class IrHttp(models.AbstractModel):
_inherit = "ir.http"

def session_info(self):
result = super().session_info()
company = self.env.company
result["web_m2x_dialog_no_create"] = {
"allowed_models": company.m2x_dialog_create_model_ids.mapped("model"),
}
return result
13 changes: 13 additions & 0 deletions web_m2x_dialog_no_create/models/res_company.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2026 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class ResCompany(models.Model):
_inherit = "res.company"

m2x_dialog_create_model_ids = fields.Many2many(
"ir.model",
string="Allow Create from Search Dialog",
)
13 changes: 13 additions & 0 deletions web_m2x_dialog_no_create/models/res_config_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2026 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"

m2x_dialog_create_model_ids = fields.Many2many(
related="company_id.m2x_dialog_create_model_ids",
readonly=False,
)
3 changes: 3 additions & 0 deletions web_m2x_dialog_no_create/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
7 changes: 7 additions & 0 deletions web_m2x_dialog_no_create/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
To allow creation from the search dialog for specific models:

1. Go to **Settings > General Settings > Search Dialog**.
2. Add models to the **Allow Create from Search Dialog** field and save.

The setting is company-dependent, so each company can have its own allowlist. A page
refresh may be needed for changes to take effect.
2 changes: 2 additions & 0 deletions web_m2x_dialog_no_create/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- [Quartile](https://www.quartile.co):
- Yoshi Tashiro
6 changes: 6 additions & 0 deletions web_m2x_dialog_no_create/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
This module hides the **New** button in many2one and many2many search dialogs by
default, preventing users from creating records directly from the dialog.

An allowlist of models can be configured per company in
*Settings > General Settings > Search Dialog*, so the New button is shown only for
selected models.
Loading
Loading