Hi everyone,
I’m on Odoo 17 and I created a very simple custom widget that extends CharField and renders a plain <input>.
The widget works in isolation, but when I use it like this:
<field name="father_name" widget="reusable_input"/>
the form crashes with:
OwlError: Cannot read properties of undefined (reading 'name') at InnerGroup.template
If I remove the widget attribute (or remove the field entirely), the form loads normally.
Here is the widget:
import { registry } from "@web/core/registry"; import { CharField } from "@web/views/fields/char/char_field"; export class ReusableInput extends CharField { onInput(ev) { this.props.update(ev.target.value); } } ReusableInput.template = "school_fee_management.reusable_input"; registry.category("fields").add("reusable_input", ReusableInput);
And the template:
<t t-name="school_fee_management.reusable_input"> <input type="text" t-att-value="props.value" t-on-input="onInput"/> </t>
XML:
<group string="Parent Contact"> <field name="father_name" widget="reusable_input"/> <field name="phone"/> </group>
Has anyone seen this InnerGroup error when using custom widgets in Odoo 17?
What extra metadata or props does the widget need so InnerGroup doesn’t break?
Thanks in advance.
Please try to inherit the template like this:
<t t-name="current name of your template" t-inherit="web.CharField" t-inherit-mode="extension">
Hope it helps.