Hello,
Is it possible to embed video in form view?
Rgds,
Anil
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hello,
Is it possible to embed video in form view?
Rgds,
Anil
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:
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")
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>
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>
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.")
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:
video_file = fields.Binary(string="Video File")
<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!
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.
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.
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.
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
RegistrarsePublicaciones relacionadas | Respuestas | Vistas | Actividad | |
---|---|---|---|---|
|
2
ago 25
|
2130 | ||
|
1
jul 25
|
690 | ||
|
1
ago 25
|
1150 | ||
|
0
may 25
|
1244 | ||
|
2
abr 25
|
3381 |