Contributors mailing list archives

contributors@odoo-community.org

Browse archives

Avatar

legacy custom javascript field widgets in odoo 16

by
hugues
- 17/03/2023 11:00:56

hello,

i’m wondering whether custom legacy javascript field widgets are still supported in odoo 16 as in previous versions or whether owl or es modules are mandatory. the documentation still states this to register a custom widget:

var fieldRegistry = require('web.field_registry');

fieldRegistry.add('my-custom-field', CustomFieldChar);

the web.field_registry is an instance of the legacy registry, but it seems that it is another registry that is used to find the widgets when parsing the xml view. because of this, it seems that custom widgets are not found (the warning Missing widget: ${widget} for field of type ${fieldType} appears in the console instead).

i didn’t find any information about this in the migration guide. what is supposed to be done to migrate custom widgets to odoo 16? i guess that ideally, custom widgets should be converted to owl and all javascript code should be converted to es modules. however, what are the minimal needed changes?

cheers,

hugues
coop it easy