Bỏ qua để đến Nội dung
Odoo Menu
  • Đăng nhập
  • Dùng thử miễn phí
  • Ứng dụng
    Tài chính
    • Kế toán
    • Hóa đơn
    • Chi phí
    • Bảng tính (BI)
    • Tài liệu
    • Ký tên
    Bán hàng
    • CRM
    • Bán hàng
    • POS Cửa hàng
    • POS Nhà hàng
    • Đăng ký
    • Cho thuê
    Trang web
    • Trình tạo trang web
    • Thương mại điện tử
    • Blog
    • Diễn đàn
    • Trò chuyện trực tiếp
    • Học trực tuyến
    Chuỗi cung ứng
    • Tồn kho
    • Sản xuất
    • PLM
    • Mua hàng
    • Bảo dưỡng
    • Chất lượng
    Nhân sự
    • Nhân viên
    • Tuyển dụng
    • Ngày nghỉ
    • Đánh giá
    • Giới thiệu
    • Đội xe
    Marketing
    • Marketing trên MXH
    • Marketing qua email
    • Marketing qua SMS
    • Sự kiện
    • Tự động hóa Marketing
    • Khảo sát
    Dịch vụ
    • Dự án
    • Bảng chấm công
    • Dịch vụ hiện trường
    • Hỗ trợ
    • Kế hoạch
    • Lịch hẹn
    Năng suất
    • Thảo luận
    • Phê duyệt
    • IoT
    • VoIP
    • Kiến thức
    • WhatsApp
    Ứng dụng của bên thứ ba Studio Odoo Nền tảng Đám mây Odoo
  • Ngành
    Bán lẻ
    • Nhà sách
    • Cửa hàng quần áo
    • Cửa hàng nội thất
    • Cửa hàng tạp hóa
    • Cửa hàng đồ kim khí
    • Cửa hàng đồ chơi
    Ẩm thực & Dịch vụ lưu trú
    • Bar và quán rượu
    • Nhà hàng
    • Đồ ăn nhanh
    • Guest house
    • Nhà phân phối đồ uống
    • Khách sạn
    Bất động sản
    • Công ty môi giới bất động sản
    • Công ty kiến trúc
    • Xây dựng
    • Quản lý bất động sản
    • Làm vườn
    • Hiệp hội chủ sở hữu bất động sản
    Tư vấn
    • Công ty kế toán
    • Đối tác Odoo
    • Công ty marketing
    • Công ty luật
    • Tuyển dụng
    • Thanh tra & chứng nhận
    Sản xuất
    • Dệt may
    • Kim loại
    • Nội thất
    • Ẩm thực
    • Nhà máy bia
    • Quà tặng doanh nghiệp
    Sức khoẻ & fitness
    • CLB thể thao
    • Cửa hàng kính mắt
    • Trung tâm fitness
    • Chuyên gia chăm sóc sức khỏe
    • Hiệu thuốc
    • Tiệm làm tóc
    Thương mại
    • Dịch vụ sửa chữa
    • Phần cứng CNTT & Hỗ trợ
    • Hệ thống năng lượng mặt trời
    • Công ty sản xuất giày
    • Dịch vụ vệ sinh
    • Dịch vụ HVAC
    Khác
    • Tổ chức phi lợi nhuận
    • Cơ quan môi trường
    • Cho thuê biển quảng cáo
    • Nhiếp ảnh
    • Cho thuê xe đạp
    • Đại lý phần mềm
    Xem tất cả ngành
  • Cộng đồng
    Học tập
    • Khóa học
    • Tài liệu
    • Chứng chỉ
    • Đào tạo
    • Blog
    • Podcast
    Thúc đẩy đào tạo
    • Chương trình đào tạo
    • Trò chơi kinh doanh Scale Up!
    • Tham quan Odoo
    Nhận phần mềm
    • Tải xuống
    • So sánh các phiên bản
    • Phiên bản
    Hợp tác
    • Github
    • Diễn đàn
    • Sự kiện
    • Dịch thuật
    • Trở thành đối tác
    • Dịch vụ dành cho Đối tác
    • Đăng ký công ty kế toán của bạn
    Nhận dịch vụ
    • Tìm đối tác
    • Tìm kế toán
    • Gặp chuyên gia hỗ trợ
    • Dịch vụ Triển khai
    • Khách hàng tham khảo
    • Hỗ trợ
    • Nâng cấp
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Nhận một buổi demo
  • Bảng giá
  • Trợ giúp

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Kế toán
  • Tồn kho
  • PoS
  • Dự án
  • MRP
All apps
Bạn cần phải đăng ký để tương tác với cộng đồng.
Tất cả bài viết Người Huy hiệu
Thẻ (Xem tất cả)
odoo accounting v14 pos v15
Về diễn đàn này
Bạn cần phải đăng ký để tương tác với cộng đồng.
Tất cả bài viết Người Huy hiệu
Thẻ (Xem tất cả)
odoo accounting v14 pos v15
Về diễn đàn này
Hỗ trợ

[odoo v11] : How to embed video into form view?

Đăng ký nhận tin

Nhận thông báo khi có hoạt động trên bài viết này

Câu hỏi này đã bị gắn cờ
embedodoo
2 Trả lời
5618 Lượt xem
Ảnh đại diện
Anil Kesariya

Hello,

Is it possible to embed video in form view?

Rgds,

Anil


2
Ảnh đại diện
Huỷ bỏ
Ảnh đại diện
Gracious Joseph
Câu trả lời hay nhất

Yes, it's possible to embed a video into a form view in Odoo. You can achieve this by using the iframe HTML tag within the form view. Here's how you can embed a video, such as a YouTube or local video, into a form view in Odoo:

Steps to Embed a Video in a Form View

1. Add a Char or URL Field to Your Model

If you want the video URL to be dynamic (e.g., a YouTube video URL), add a field to your model to store the video link.

Example:

from odoo import models, fields

class YourModel(models.Model):
    _name = 'your.model'

    video_url = fields.Char(string="Video URL", help="Enter the video URL to embed")

2. Update the Form View XML

Modify the form view to include an iframe tag or video embed logic. Use the video_url field to load the video dynamically.

Example XML:

<record id="view_form_your_model" model="ir.ui.view">
    <field name="name">your.model.form</field>
    <field name="model">your.model</field>
    <field name="arch" type="xml">
        <form>
            <sheet>
                <group>
                    <field name="name"/>
                    <field name="video_url"/>
                </group>
                <group>
                    <div t-if="record.video_url.raw_value" style="margin-top: 20px;">
                        <iframe t-att-src="record.video_url.raw_value"
                                width="560"
                                height="315"
                                frameborder="0"
                                allowfullscreen>
                        </iframe>
                    </div>
                </group>
            </sheet>
        </form>
    </field>
</record>
  • Key Points:
    • t-if="record.video_url.raw_value" ensures the video is displayed only if a URL is provided.
    • t-att-src="record.video_url.raw_value" dynamically sets the src attribute of the iframe to the value of the video_url field.

3. Testing

  1. Navigate to the corresponding form view for your model in Odoo.
  2. Enter a video URL (e.g., a YouTube video: https://www.youtube.com/embed/VIDEO_ID).
  3. Save the record, and the video should appear embedded in the form view.

Alternative: Embed a Hardcoded Video

If you don’t need dynamic video URLs and want to embed a static video, you can directly include the iframe in the XML without using a field:

Example:

<group>
    <iframe src="https://www.youtube.com/embed/VIDEO_ID" 
            width="560" 
            height="315" 
            frameborder="0" 
            allowfullscreen>
    </iframe>
</group>

4. Security Considerations

  • Ensure the video URL comes from a trusted source to prevent embedding malicious content.
  • If users enter the video URL manually, validate it using Odoo's @api.constrains or custom validation logic in the model.

Example Validation:

from odoo.exceptions import ValidationError

@api.constrains('video_url')
def _check_video_url(self):
    for record in self:
        if record.video_url and not record.video_url.startswith("https://www.youtube.com/embed/"):
            raise ValidationError("Please provide a valid YouTube embed URL.")

5. Embedding a Local Video

If the video is hosted locally or within Odoo, you can use the file or binary field and render it using an HTML <video> tag.

Example:

  • Add a Binary field:
    video_file = fields.Binary(string="Video File")
    
  • Update the XML view:
    <group>
        <video t-if="record.video_file.raw_value" controls width="560" height="315">
            <source t-att-src="'data:video/mp4;base64,%s' % record.video_file.raw_value" type="video/mp4"/>
            Your browser does not support the video tag.
        </video>
    </group>
    

By following the steps above, you can easily embed videos into form views in Odoo for dynamic or static content. Let me know if you need further assistance!

0
Ảnh đại diện
Huỷ bỏ
Ảnh đại diện
Mitul Shingala
Câu trả lời hay nhất

hello,

see this link https://www.odoo.com/forum/help-1/question/how-to-display-video-in-the-website-121494

may this will be helps you.

0
Ảnh đại diện
Huỷ bỏ
Anil Kesariya
Tác giả

I appreciate Mitul, for the link you've shared. Unfortunately I'm not looking for that solution, that I know already, that how to embed in website page. My question is how to embed video on form view, which is comes in odoo back end web part. I hope now my question is clear to you. Anyway, thanks.

Kavine S

Were you able to make progress in this. I am using odoo 17 and still there is no way to embed a video in the backend webpart.

Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!

Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!

Đăng ký
Bài viết liên quan Trả lời Lượt xem Hoạt động
(!!C-o-p-a!!)¿Cómo comunicarse con Copa Airlines en Panamá?
odoo
Ảnh đại diện
0
thg 11 25
211
How do I go about this error? I am trying to uninstall a module
odoo
Ảnh đại diện
0
thg 11 25
3328
(#iberia#)¿Cómo llamar a Iberia desde Panamá?
odoo
Ảnh đại diện
0
thg 10 25
397
How to import product variants with my own external id when using dynamic creation mode Đã xử lý
odoo
Ảnh đại diện
Ảnh đại diện
2
thg 8 25
3902
How to import Bulk Image in Product your local database not any cloud, odoo.sh Đã xử lý
odoo
Ảnh đại diện
Ảnh đại diện
1
thg 7 25
1905
Cộng đồng
  • Khóa học
  • Tài liệu
  • Diễn đàn
Open source
  • Tải xuống
  • Github
  • Runbot
  • Dịch thuật
Dịch vụ
  • Lưu trữ Odoo.sh
  • Hỗ trợ
  • Nâng cấp
  • Phát triển tùy chỉnh
  • Đào tạo
  • Tìm kế toán
  • Tìm đối tác
  • Trở thành đối tác
Giới thiệu công ty
  • Công ty của chúng tôi
  • Tài sản thương hiệu
  • Liên hệ
  • Việc làm
  • Sự kiện
  • Podcast
  • Blog
  • Khách hàng
  • Pháp lý • Riêng tư
  • Bảo mật
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo là bộ ứng dụng kinh doanh có open source đáp ứng tất cả các nhu cầu của công ty bạn: CRM, thương mại điện tử, kế toán, tồn kho, POS, quản lý dự án, v.v.

Định hướng giá trị riêng biệt của Odoo là tích hợp hoàn toàn và dễ dàng sử dụng.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now