🎉 Initialize module repository
This commit is contained in:
29
models/mvd_tcg_mtg_card_image.py
Normal file
29
models/mvd_tcg_mtg_card_image.py
Normal file
@@ -0,0 +1,29 @@
|
||||
"""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.",
|
||||
)
|
||||
Reference in New Issue
Block a user