콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
1470 화면

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

아바타
취소
관련 게시물 답글 화면 활동
3
6월 25
2231
Change resume view 해결 완료
4
7월 25
1063
Repair Management 해결 완료
2
5월 25
822
1
2월 25
1489
1
2월 25
1010