Question:
I'm developing a custom Odoo 17 website module to add a video block snippet, allowing users to play videos hosted on the server. I'm encountering the following error upon installation or usage of the snippet in Odoo:
plaintextCopy codeValueError: View 'website_video_block' in website 1 not found
This results in an RPC error that prevents the snippet from being displayed. Below is the specific traceback:
plaintextCopy codeTraceback (most recent call last): File "<944>", line 1419, in template_944 ... ValueError: View 'website_video_block' in website 1 not found
Context:
- Module Purpose: The module adds a custom snippet to the website editor with a video player to embed server-hosted videos.
- XML Code (Snippet Definition):
- The snippet definition file includes a <template id="website_video_block" name="Video Block"> to define the block.
- This template is then referenced in another template using <t t-call="website_video_block"/> within the website.snippets template.
Main Code Snippet:
xmlCopy code<odoo> <template id="website_video_block" name="Video Block"> <div class="o_video_block"> <video controls="controls"> <source src="/path_to_videos/default_video.mp4" type="video/mp4"/> Your browser does not support the video tag. </video> </div> </template> <template id="add_video_block_snippet" inherit_id="website.snippets" name="Add Video Block to Snippets"> <xpath expr="//div[@id='snippet_structure']/div" position="inside"> <t t-call="website_video_block"/> </xpath> </template> </odoo>
Error Cause Hypothesis: It appears that Odoo fails to locate or load the website_video_block view, resulting in an RPC error. I've checked for ID naming conflicts, updated the module, and cleared the cache, but the issue persists.
Could there be an issue with the template registration or the inheritance in the XML structure? Any guidance on resolving this would be greatly appreciated.