Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

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

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
embedodoo
2 Răspunsuri
5641 Vizualizări
Imagine profil
Anil Kesariya

Hello,

Is it possible to embed video in form view?

Rgds,

Anil


2
Imagine profil
Abandonează
Imagine profil
Gracious Joseph
Cel mai bun răspuns

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
Imagine profil
Abandonează
Imagine profil
Mitul Shingala
Cel mai bun răspuns

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
Imagine profil
Abandonează
Anil Kesariya
Autor

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.

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
How do I go about this error? I am trying to uninstall a module
odoo
Imagine profil
0
nov. 25
3368
How to import product variants with my own external id when using dynamic creation mode Rezolvat
odoo
Imagine profil
Imagine profil
2
aug. 25
3952
How to import Bulk Image in Product your local database not any cloud, odoo.sh Rezolvat
odoo
Imagine profil
Imagine profil
1
iul. 25
1944
Odoo sh - Connect As
odoo
Imagine profil
1
aug. 25
1154
邮箱无法正常使用
odoo
Imagine profil
0
mai 25
2157
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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