mapan_loyalty_push/models/app_carousel.py

39 lines
1.2 KiB
Python

# -*- coding: utf-8 -*-
from odoo import models, fields
class AppCarousel(models.Model):
"""Carousel slides managed from the Odoo backend, displayed on the Flutter app home screen."""
_name = 'mapan.app.carousel'
_description = 'Mobile App Carousel Slide'
_order = 'sequence, id'
name = fields.Char(string='Slide Title', required=True)
sequence = fields.Integer(string='Sequence', default=10)
is_active = fields.Boolean(string='Active', default=True)
# Image: uploaded from Odoo backend
image = fields.Image(
string='Banner Image',
max_width=1920,
max_height=720,
help='Banner image for the carousel slide (recommended ratio 16:6).'
)
# External image URL (alternative to uploaded image)
image_url = fields.Char(
string='External Image URL',
help='If set and no image is uploaded, the app will load the image from this URL.'
)
link_url = fields.Char(
string='Tap URL',
help='URL to open when the user taps this carousel slide. Leave empty for no action.'
)
body = fields.Html(
string='Slide Detail Content',
help='Rich text content shown when the user taps on this carousel slide.'
)