🎉 Initialize module repository

This commit is contained in:
Marc Wempe
2026-04-03 23:08:57 +02:00
commit bf9156b973
190 changed files with 4090 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
"""Magic: The Gathering legality models."""
from odoo import fields, models
LEGALITY_SELECTION = [
("legal", "Legal"),
("not_legal", "Not Legal"),
("restricted", "Restricted"),
("banned", "Banned"),
]
class MvdTcgMtgCardLegality(models.Model):
"""Store one legality status per MTG card and constructed format."""
_name = "mvd.tcg.mtg.card.legality"
_description = "MTG Card Legality"
_order = "format_sequence, id"
card_id = fields.Many2one(
"mvd.tcg.card",
required=True,
index=True,
ondelete="cascade",
)
format_id = fields.Many2one(
"mvd.tcg.mtg.format",
required=True,
index=True,
ondelete="restrict",
)
format_code = fields.Char(
related="format_id.code",
store=True,
index=True,
)
format_sequence = fields.Integer(
related="format_id.sequence",
store=True,
index=True,
)
status = fields.Selection(
selection=LEGALITY_SELECTION,
required=True,
default="not_legal",
index=True,
)
_card_format_unique = models.Constraint(
"UNIQUE (card_id, format_id)",
"The MTG legality format must be unique per card.",
)