[19.0][IMP] base_optional_quick_create: hide quick create in UI#1249
Draft
gdgellatly wants to merge 40 commits intoOCA:19.0from
Draft
[19.0][IMP] base_optional_quick_create: hide quick create in UI#1249gdgellatly wants to merge 40 commits intoOCA:19.0from
gdgellatly wants to merge 40 commits intoOCA:19.0from
Conversation
…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/
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Supersedes #1239 — builds on top of that migration PR and improves the UX.
The current implementation only patches
name_createserver-side, so when auser clicks "Create" in a many2one dropdown for a model with
avoid_quick_create=True, they get an uglyUserErrordialog. 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:
avoid_quick_createmodel list viasession_infoMany2One.prototype.many2XAutocompletePropsto setquickCreate = nullfor those models
name_createpatch is kept as a safety netChanges
models/ir_http.py— new: pushes avoid_quick_create models into session_infostatic/src/optional_quick_create.esm.js— new: JS patch for Many2One