From 4f4fae261b7f4d34f70bd977ae72ed90bbb7f822 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Wed, 28 Sep 2022 07:00:23 +0000 Subject: [PATCH] [FIX] web: stop using legacy Many2one field in kanban Before this commit, if there was a kanban view with a field with widget="many2one" explicitely set, the legacy KanbanMany2oneField was used. That field simply displays the name of the related record, with no link. In the wowl kanban view, we only use a FieldComponent if the field is explicitely set, and we use a formatter otherwise. For that reason, this commit simply removes the kanban special case instead of re-introducing it. So by default, a many2one will be displayed in a span, and if someone wants the link in the kanban card, he has to set widget="many2one" (this wasn't possible before). Temporarily, until we remove the fallback on the legacy field registry, we need to add a "fake" entry in the wowl registry, to prevent from fallbacking on legacy. X-original-commit: a3cd97c5c81422e33a5715ecc4dd017cf5172ea8 Part-of: odoo/odoo#101661 --- addons/web/static/src/views/fields/many2one/many2one_field.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/views/fields/many2one/many2one_field.js b/addons/web/static/src/views/fields/many2one/many2one_field.js index 4a7a6e97d10..1d5d026dad3 100644 --- a/addons/web/static/src/views/fields/many2one/many2one_field.js +++ b/addons/web/static/src/views/fields/many2one/many2one_field.js @@ -149,7 +149,7 @@ export class Many2OneField extends Component { nameCreateField: this.props.nameCreateField, setInputFloats: this.setFloating, autocomplete_container: this.autocompleteContainerRef, - } + }; } getDomain() { return this.domain.toList(this.context); @@ -306,4 +306,6 @@ Many2OneField.extractProps = ({ attrs, field }) => { }; registry.category("fields").add("many2one", Many2OneField); +// the two following lines are there to prevent the fallback on legacy widgets registry.category("fields").add("list.many2one", Many2OneField); +registry.category("fields").add("kanban.many2one", Many2OneField);