Odoo provides field widgets, ways of presenting fields on views. Where none suits a genuine need, a developer can create a custom one. This piece is about it.
When a custom field widget is needed
A field widget is the way a field is presented and interacted with on a view, and Odoo provides widgets for the kinds and uses of fields. For most field presentation, choosing the right standard widget is the answer. But sometimes a developer has a genuine need that none of the standard widgets suits: a field that should be presented or interacted with in a particular custom way, for which no standard widget genuinely fits. Creating a custom field widget is the answer to that genuine need.
What creating a custom field widget involves
Creating a custom field widget is building a new way to present and interact with a field. A field widget is part of Odoo's front end, so creating a custom field widget is front-end development: it is built in Odoo's front-end framework, OWL, as the kind of component a field widget is. So creating a custom field widget involves the genuine front-end development of building that custom widget, the custom presentation and interaction for the field, within Odoo's front-end framework.
The honest note: a custom widget is for a genuine need
An honest and important note. Creating a custom field widget is genuine front-end development, real effort, real code, real front-end work, and it is custom code the business then owns and maintains. So a custom field widget should be created only for a genuine need that the standard widgets genuinely do not meet. A developer should first genuinely consider whether a standard widget can meet the need, since standard widgets meet most field-presentation needs and require no custom development. A custom field widget should be created where the need is genuine and no standard widget genuinely fits, not reached for casually. The honest discipline is to use the standard widgets where they serve, and create a custom one only where there is a genuine need they cannot meet.
Create it the Odoo way
Creating a custom field widget, being front-end development, should be done the Odoo way: built within Odoo's front-end framework, as Odoo's field widgets are built, following the framework's conventions. A custom field widget built that way works properly within Odoo and is maintainable. A developer creating a custom field widget should do it within the framework's conventions, working with the framework.
The takeaway
Creating a custom field widget in Odoo is building a custom way to present and interact with a field, for a genuine need that the standard field widgets do not meet. It is genuine front-end development, built in Odoo's front-end framework, OWL. The honest discipline is to use the standard widgets where they serve, since they meet most needs and require no custom development, and to create a custom field widget only where there is a genuine need they cannot meet. Create it the Odoo way, within the framework's conventions. For how we approach Odoo, see our ERP practice.