Currently i want to preview the video i uploaded using binary field. odoo 16. is there any way to do it?
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
- Project
- MRP
Câu hỏi này đã bị gắn cờ
I can't import videos
ImportError: cannot import name 'video' from 'odoo.tools' (D:\1\server\odoo\tools\__init__.py) - -
In Odoo 16, you can use the video_preview widget to display a preview image and play a video. Here are the steps to use the video_preview widget in your module:
- Import the necessary modules:
javascript
from odoo import models, fields, api from odoo.tools import video
- Define a field for the video:
python
class VideoExample(models.Model): _name = 'video.example' name = fields.Char(string='Name') video = fields.Binary(string='Video', attachment=True) video_preview = fields.Binary(string='Video Preview', compute='_compute_video_preview') @api.depends('video') def _compute_video_preview(self): for rec in self: rec.video_preview = video.Video.from_binary(rec.video).preview_image() if rec.video else None
- Add the video_preview widget to your form view:
The video_preview widget will automatically display a preview image and play the video when the user clicks on it. Note that the video field is of type Binary, and the video_preview field is computed based on the video field using the video_preview function from the odoo.tools.video module.
That's it! Now you should be able to display and play videos in your Odoo 16 module using the video_preview widget.
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 | |
---|---|---|---|---|
|
0
thg 11 23
|
1105 | ||
|
1
thg 5 25
|
2458 | ||
|
1
thg 4 25
|
3475 | ||
|
1
thg 4 25
|
4304 | ||
|
1
thg 4 25
|
1780 |
Hoàng Ngọc Dũng
ngocdungnb06@gmail.com / 0385672944