I'm creating an Owl component that I'd like to use to extend(inherit) to a contacts view. However, whenever I try to load the relevant page that has my new component, I get an error UncaughtPromiseError > OwlError
Cannot find the definition of component "DialButton"
. And I'm not sure what might be missing.
My code looks like this
The xml:
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="efcx.DialButton">
<a class="ms-3 d-inline-flex align-items-center">
<i class="fa fa-phone"></i><small class="fw-bold ms-1">Call efcx</small>
</a>
</t>
</templates>
The JS:
/** @odoo-module **/
import { registry } from "@web/core/registry";
import { Component } from "@odoo/owl";
export class DialButton extends Component {
static template = "efcx.DialButton";
setup() {
super.setup(...arguments);
}
_dial(){
console.log("Dialing...");
}
}
export const fieldButton = { Component: DialButton, };
registry.add("DialButton", fieldButton);
console.log(registry.get("DialButton"))
The inheritance view (to extend the contact view):
<templates xml:space="preserve"><t t-inherit="web.PhoneField" t-inherit-mode="extension">
<xpath expr="//div[hasclass('o_phone_content')]//a" position="after">
<DialButton/>
</xpath>
</t>
<t t-inherit="web.FormPhoneField" t-inherit-mode="extension">
<xpath expr="//div[hasclass('o_phone_content')]" position="inside">
<DialButton/>
</xpath>
</t>
</templates>
And finally, the portions of the manifest where I'm adding the files:
'assets': {
'web.assets_backend': [
'efcx/static/src/js/dial_button.js',
'efcx/static/src/xml/dial_button.xml',
'efcx/static/src/views/fields/phone_field.xml',
]
Is the component not added to the registry properly? Do I need to update the manifest? I would appreciate any help pointing out the issue 🙏