diff options
| author | Dhruv Patel <dhp@odoo.com> | 2020-06-03 10:35:33 +0000 |
|---|---|---|
| committer | Julien Mougenot <jum@odoo.com> | 2020-06-10 13:08:33 +0000 |
| commit | eacbec1e03b1f25e71875fb7caed646a53af67ed (patch) | |
| tree | 0945bb57b0c438bc8af7ee3b21f1cc49567bf28f /addons/web/static/src/js/fields/relational_fields.js | |
| parent | a392da16015c69161814e83f1cde5ddf40782505 (diff) | |
[IMP] web,*: highlight quick create feature to user
Generally, Users are not necessarily aware that they can quick create a most
records by simply typing in their name+enter in the many2xxx field input.
The exact purpose of this commit is to make sure the user discovers the quick
create feature of our many2xxx fields.
For that, when the input is empty, display 'Start typing to create a record...'
at the bottom of the dropdown when can_create is set and no_create_edit option
not set. So the user can easily understand that by typing and pressing enter
will create the new record.
Also "Search and Create" options in the dropdown only been shown to the user
when it type anything in the input box as the same case in the "Create" option.
Task : 2266557
Co-authored-by: Mohammed Shekha <msh@openerp.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/fields/relational_fields.js')
| -rw-r--r-- | addons/web/static/src/js/fields/relational_fields.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js index 944a7c30ebb..f9a220c6b8f 100644 --- a/addons/web/static/src/js/fields/relational_fields.js +++ b/addons/web/static/src/js/fields/relational_fields.js @@ -600,7 +600,7 @@ var FieldMany2One = AbstractField.extend({ }); } // create and edit ... - if (self.can_create && !self.nodeOptions.no_create_edit) { + if (self.can_create && !self.nodeOptions.no_create_edit && search_val.length > 0) { var createAndEditAction = function () { // Clear the value in case the user clicks on discard self.$('input').val(''); @@ -616,7 +616,13 @@ var FieldMany2One = AbstractField.extend({ label: _t("No results to show..."), }); } - + if (!self.value && !search_val.length && self.can_create + && (!self.nodeOptions.no_quick_create || !self.nodeOptions.no_create_edit)) { + values.push({ + label: _t("Start typing..."), + classname: 'o_m2o_start_typing', + }); + } resolve(values); }); }); |
