Skip to content

[19.0][IMP] base_optional_quick_create: hide quick create in UI#1249

Draft
gdgellatly wants to merge 40 commits intoOCA:19.0from
gdgellatly:19.0-imp-base_optional_quick_create-gdg
Draft

[19.0][IMP] base_optional_quick_create: hide quick create in UI#1249
gdgellatly wants to merge 40 commits intoOCA:19.0from
gdgellatly:19.0-imp-base_optional_quick_create-gdg

Conversation

@gdgellatly
Copy link
Copy Markdown

@gdgellatly gdgellatly commented Mar 8, 2026

Summary

Supersedes #1239 — builds on top of that migration PR and improves the UX.

The current implementation only patches name_create server-side, so when a
user clicks "Create" in a many2one dropdown for a model with
avoid_quick_create=True, they get an ugly UserError dialog. This is poor UX.

This PR adds a JS-side patch (following the same pattern as web_m2x_options)
that hides the "Create" dropdown option entirely for flagged models:

  • Exposes the avoid_quick_create model list via session_info
  • Patches Many2One.prototype.many2XAutocompleteProps to set quickCreate = null
    for those models
  • The "Create and Edit..." option still works normally
  • The server-side name_create patch is kept as a safety net

Changes

  • models/ir_http.py — new: pushes avoid_quick_create models into session_info
  • static/src/optional_quick_create.esm.js — new: JS patch for Many2One

eLBati and others added 30 commits February 11, 2026 13:16
…ore registring the 'check_quick_create' hook
In order to get visibility on https://www.odoo.com/apps the OCA board has
decided to add the OCA as author of all the addons maintained as part of the
association.
…0 and make it installable * apply a views/models directory arch into the module * fix xpath anchor on ir_model views (osv_memory to transient) * add README.rst * apply some new api
…nsetting the flag clears the patch

Currently translated at 100,0% (3 of 3 strings)

Translation: server-tools-10.0/server-tools-10.0-base_optional_quick_create
Translate-URL: https://translation.odoo-community.org/projects/server-tools-10-0/server-tools-10-0-base_optional_quick_create/de/
When starting Odoo in multiprocess, a change to the field
IrModel.avoid_quick_create would be active only on the current worker.
Otherwise, it would be active after a restart.

The proposed change is to signal a registry change, forcing the other
workers to reload a registry and then be aware of the change.
Currently translated at 100.0% (3 of 3 strings)

Translation: server-ux-14.0/server-ux-14.0-base_optional_quick_create
Translate-URL: https://translation.odoo-community.org/projects/server-ux-14-0/server-ux-14-0-base_optional_quick_create/it/
Currently translated at 100.0% (3 of 3 strings)

Translation: server-ux-16.0/server-ux-16.0-base_optional_quick_create
Translate-URL: https://translation.odoo-community.org/projects/server-ux-16-0/server-ux-16-0-base_optional_quick_create/ja/
Currently translated at 100.0% (3 of 3 strings)

Translation: server-ux-16.0/server-ux-16.0-base_optional_quick_create
Translate-URL: https://translation.odoo-community.org/projects/server-ux-16-0/server-ux-16-0-base_optional_quick_create/es/
Currently translated at 100.0% (3 of 3 strings)

Translation: server-ux-16.0/server-ux-16.0-base_optional_quick_create
Translate-URL: https://translation.odoo-community.org/projects/server-ux-16-0/server-ux-16-0-base_optional_quick_create/it/
Jaydeep Gajera and others added 10 commits February 11, 2026 13:16
Currently translated at 100.0% (3 of 3 strings)

Translation: server-ux-18.0/server-ux-18.0-base_optional_quick_create
Translate-URL: https://translation.odoo-community.org/projects/server-ux-18-0/server-ux-18-0-base_optional_quick_create/tr/
… models

Instead of only blocking name_create server-side (which shows an ugly
UserError dialog), expose the avoid_quick_create model list via
session_info and patch Many2One on the JS side to suppress the
"Create" dropdown option entirely for those models. "Create and Edit"
still works normally.

Follows the same pattern as web_m2x_options (session → patch
Many2One.prototype.many2XAutocompleteProps).

The server-side name_create patch is kept as a safety net.

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.