43 lines
1.4 KiB
Python
43 lines
1.4 KiB
Python
# -*- coding: utf-8 -*-
|
|
from odoo import models, fields
|
|
|
|
|
|
class AppPromo(models.Model):
|
|
"""Highlight Promo items managed from the Odoo backend.
|
|
|
|
Displayed as a horizontal scrollable row below the carousel on the Flutter app home screen.
|
|
When tapped, the app shows a detail screen with title, image, and the rich-text body.
|
|
"""
|
|
_name = 'mapan.app.promo'
|
|
_description = 'Mobile App Promo Highlight'
|
|
_order = 'sequence, id'
|
|
|
|
name = fields.Char(string='Promo Title', required=True)
|
|
sequence = fields.Integer(string='Sequence', default=10)
|
|
is_active = fields.Boolean(string='Active', default=True)
|
|
|
|
# Rich text body (like the notification body)
|
|
body = fields.Html(
|
|
string='Promo Detail Content',
|
|
help='Rich text content shown when the user taps on this promo highlight.'
|
|
)
|
|
|
|
# Thumbnail image for the list/card view
|
|
image = fields.Image(
|
|
string='Promo Image',
|
|
max_width=800,
|
|
max_height=800,
|
|
help='Image shown on the promo card tile. Square format recommended.'
|
|
)
|
|
image_128 = fields.Image(
|
|
string='Thumbnail',
|
|
related='image',
|
|
max_width=128,
|
|
max_height=128,
|
|
store=True,
|
|
readonly=True,
|
|
)
|
|
|
|
date_start = fields.Date(string='Valid From', help='Leave empty for no start restriction.')
|
|
date_end = fields.Date(string='Valid Until', help='Leave empty for no expiry.')
|