[IMP] web: Drop widget support in search view
Until now the "widget" attribute used in the search view was meant to force the type of a field regardless of its definition. This system was implemented quite a long time ago and is now useful in only one case: searching for "reference" fields (we want them considered as char fields else it is impossible to search on them). This is why this commit completely removes the "widget" attribute support in search views while consistently casting the "reference" fields as "char" fields in the search bar. Task 2061795
This commit is contained in:
@@ -916,9 +916,6 @@ odoo.define("web/static/src/js/control_panel/control_panel_model_extension.js",
|
||||
filter.defaultRank = -10;
|
||||
filter.defaultAutocompleteValue = attrs.defaultAutocompleteValue;
|
||||
}
|
||||
if (attrs.widget) {
|
||||
filter.widget = attrs.widget;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ odoo.define('web.SearchBar', function (require) {
|
||||
*/
|
||||
_createSource(filter) {
|
||||
const field = this.props.fields[filter.fieldName];
|
||||
const type = filter.widget || field.type;
|
||||
const type = field.type === "reference" ? "char" : field.type;
|
||||
const source = {
|
||||
active: true,
|
||||
description: filter.description,
|
||||
|
||||
@@ -538,7 +538,7 @@ odoo.define('web.search_bar_tests', function (require) {
|
||||
actionManager.destroy();
|
||||
});
|
||||
|
||||
QUnit.test("widgets are supported in search view", async function (assert) {
|
||||
QUnit.test("reference fields are supported in search view", async function (assert) {
|
||||
assert.expect(7);
|
||||
|
||||
this.data.partner.fields.ref = { type: 'reference', string: "Reference" };
|
||||
@@ -548,7 +548,7 @@ odoo.define('web.search_bar_tests', function (require) {
|
||||
const archs = Object.assign({}, this.archs, {
|
||||
'partner,false,search': `
|
||||
<search>
|
||||
<field name="ref" widget="char"/>
|
||||
<field name="ref"/>
|
||||
</search>`,
|
||||
});
|
||||
const actionManager = await createActionManager({
|
||||
|
||||
@@ -1856,10 +1856,6 @@ Possible children elements of the search view are:
|
||||
``filter_domain="[]"``
|
||||
``groups``
|
||||
make the field only available to specific users
|
||||
``widget``
|
||||
use specific search widget for the field (the only use case in
|
||||
standard Odoo 8.0 is a ``selection`` widget for
|
||||
:class:`~odoo.fields.Many2one` fields)
|
||||
``domain``
|
||||
if the field can provide an auto-completion
|
||||
(e.g. :class:`~odoo.fields.Many2one`), filters the possible
|
||||
|
||||
Reference in New Issue
Block a user