30 lines
794 B
Python
30 lines
794 B
Python
"""Localized Scryfall image records for MTG cards."""
|
|
|
|
from odoo import fields, models
|
|
|
|
|
|
class MvdTcgMtgCardImage(models.Model):
|
|
"""Store one localized imported Scryfall image per card and language."""
|
|
|
|
_name = "mvd.tcg.mtg.card.image"
|
|
_description = "MTG Card Image"
|
|
_order = "card_id, language_code, id"
|
|
|
|
card_id = fields.Many2one(
|
|
"mvd.tcg.card",
|
|
required=True,
|
|
index=True,
|
|
ondelete="cascade",
|
|
)
|
|
language_code = fields.Char(required=True, index=True)
|
|
image_1920 = fields.Image(
|
|
required=True,
|
|
max_width=1920,
|
|
max_height=1920,
|
|
)
|
|
|
|
_card_language_unique = models.Constraint(
|
|
"UNIQUE (card_id, language_code)",
|
|
"Only one localized MTG image is allowed per card and language.",
|
|
)
|