Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
1454 Переглядів

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:

  1. Module Purpose: The module adds a custom snippet to the website editor with a video player to embed server-hosted videos.
  2. 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.

Аватар
Відмінити
Найкраща відповідь

Hi,

Call the template with your moule name.Modify the code as follows:

<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="your_module_name.website_video_block"/> <!-- Replace with your actual module name -->

        </xpath>

    </template>

</odoo>


Hope it helps

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
3
черв. 25
2199
Change resume view Вирішено
4
лип. 25
1051
Repair Management Вирішено
2
трав. 25
814
1
лют. 25
1450
1
лют. 25
1001