I’m extending web.HtmlField in Odoo 17 using OWL to add a mic button for voice recording. The button shows in char, text, and search fields but not in HtmlField. Here’s my code:
xml
Copy
<t t-name="web.HtmlField" t-inherit="web.HtmlField" t-inherit-mode="extension" owl="1"> <xpath expr="." position="inside"> <div t-if="state.isVoiceEnabled"> <button class="o_Composer_button o_Composer_toolButton btn btn-light fa fa-microphone border-0 rounded-pill mx-1" id="record_voice" title="Voice" aria-label="Voice" type="button" t-on-click="toggleRecording"> </button> </div> </xpath> </t>
Run HTML
What I’ve Tried
- Added owl="1" and t-inherit-mode="extension".
- Used t-if to conditionally render the button.
Issue
- Expected: Mic icon appears in HtmlField when state.isVoiceEnabled is true.
- Actual: Mic icon shows in char, text, and search fields but not in HtmlField.
Questions
- Why is the mic icon not showing in HtmlField?
- How can I properly extend web.HtmlField to display the button?