Add multimedia URL field and website audio iframe embeds
This commit is contained in:
parent
efae7d5d03
commit
cd54429cf8
5 changed files with 78 additions and 2 deletions
|
|
@ -18,3 +18,22 @@ class ProductTemplate(models.Model):
|
|||
fecha_entrada = fields.Char('Fecha de entrada')
|
||||
fecha_edicion = fields.Char('Fecha de edición')
|
||||
genero = fields.Char('Genero')
|
||||
multimedia_url = fields.Char('URL multimedia')
|
||||
multimedia_embed_url = fields.Char(
|
||||
string='URL multimedia embebida',
|
||||
compute='_compute_multimedia_embed_url',
|
||||
)
|
||||
|
||||
@api.depends('multimedia_url')
|
||||
def _compute_multimedia_embed_url(self):
|
||||
for record in self:
|
||||
url = (record.multimedia_url or '').strip()
|
||||
if not url:
|
||||
record.multimedia_embed_url = False
|
||||
continue
|
||||
|
||||
base_url = url.rstrip('/')
|
||||
if base_url.endswith('/embed/all'):
|
||||
record.multimedia_embed_url = f"{base_url}/"
|
||||
else:
|
||||
record.multimedia_embed_url = f"{base_url}/embed/all/"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue