from odoo import api, fields, models, _
class Album(models.Model):
_name = 'album.album'
_description = 'All information about album gallery'
_rec_name = 'title'
_order = 'event_start_date desc'
title = fields.Char(string="Album Name", required=True)
image = fields.Binary(string="Image", required=True, readonly=False, attachment=True)
event_start_date = fields.Date(string="Event start Date", default=fields.Date.context_today)
event_end_date = fields.Date(string="Event end Date")
note = fields.Text(string="Description")
event_image_ids = fields.One2many('album.image.images', 'image_id', string="Extra Product Media", copy=True)
class Image(models.Model):
_name = 'album.image.images'
_rec_name = 'title_1'
title_1 = fields.Char(string="Image Title")
image_1 = fields.Binary(string='Fav Pics', attachment=True)
image_id = fields.Many2one('album.album', string="Album", auto_join=True, index=True, ondelete="cascade",)
when clicking the image, i want to show the images related to it.
Thank you