🎉 Initialize module repository

This commit is contained in:
Marc Wempe
2026-04-03 23:08:58 +02:00
commit 5d4a312621
13 changed files with 2896 additions and 0 deletions

1
report/__init__.py Normal file
View File

@@ -0,0 +1 @@
# MTG deck report customizations are template-only for now.

View File

@@ -0,0 +1,220 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template
id="report_mvd_tcg_deck_document_mtg_inherit"
inherit_id="mvd_tcg_deck.report_mvd_tcg_deck_document"
>
<xpath expr="//td[hasclass('o_mvd_tcg_report_card_cell')]/div[hasclass('o_mvd_tcg_report_card_name')]/span[@t-field='line.card_id']" position="replace">
<span class="o_mvd_tcg_report_card_name_text" t-field="line.card_id"/>
<t t-if="doc.is_mtg_deck and line.card_id.mtg_face_count &lt;= 1">
<t t-set="mana_symbols" t-value="get_mana_symbols(line.mtg_mana_cost)"/>
<t t-if="mana_symbols">
<span class="o_mvd_tcg_report_inline_symbol_group">
<t t-foreach="mana_symbols" t-as="symbol">
<span class="o_mvd_tcg_report_symbol_frame o_mvd_tcg_report_inline_symbol_frame">
<img
class="o_mvd_tcg_report_symbol_icon o_mvd_tcg_report_inline_symbol_icon"
t-att-src="symbol['src']"
t-att-alt="symbol['label']"
t-att-title="symbol['label']"
/>
</span>
</t>
</span>
</t>
<t t-set="line_color_badges" t-value="get_line_color_badges(line)"/>
<t t-if="line_color_badges">
<span class="o_mvd_tcg_report_inline_symbol_group">
<t t-foreach="line_color_badges" t-as="badge">
<span class="o_mvd_tcg_report_symbol_frame o_mvd_tcg_report_inline_symbol_frame">
<img
class="o_mvd_tcg_report_symbol_icon o_mvd_tcg_report_inline_symbol_icon"
t-att-src="badge['src']"
t-att-alt="badge['label']"
t-att-title="badge['label']"
/>
</span>
</t>
</span>
</t>
</t>
</xpath>
<xpath expr="//div[hasclass('o_mvd_tcg_report_extension_hook')]" position="replace">
<div t-if="doc.is_mtg_deck" class="o_mvd_tcg_report_section o_mvd_tcg_report_section_emphasis">
<t t-set="identity_badges" t-value="get_color_badges(doc.mtg_color_identity_signature)"/>
<t t-set="type_breakdown" t-value="get_mtg_type_breakdown(doc)"/>
<h3 class="o_mvd_tcg_report_section_title">Commander Snapshot</h3>
<table class="o_mvd_tcg_report_snapshot" style="margin-bottom: 8px;">
<tbody>
<tr>
<td>
<div class="o_mvd_tcg_report_snapshot_block">
<h4>Format &amp; Commander</h4>
<p style="margin-bottom: 6px;">
<strong>Format:</strong>
<span t-if="doc.mtg_format_id" t-field="doc.mtg_format_id"/>
<span t-else="" class="o_mvd_tcg_report_muted">No format selected</span>
</p>
<p>
<strong>Commander:</strong>
<span t-if="doc.mtg_commander_card_id" t-field="doc.mtg_commander_card_id"/>
<span t-else="" class="o_mvd_tcg_report_muted">No commander detected</span>
</p>
<p style="margin-top: 8px;">
<strong>Deck Size:</strong>
<span t-field="doc.mtg_mainboard_count"/> mainboard
<span class="o_mvd_tcg_report_muted"> · </span>
<span t-field="doc.mtg_command_zone_count"/> command zone
<span t-if="doc.mtg_sideboard_count">
<span class="o_mvd_tcg_report_muted"> · </span>
<span t-field="doc.mtg_sideboard_count"/> sideboard
</span>
</p>
</div>
</td>
<td>
<div class="o_mvd_tcg_report_snapshot_block">
<h4>Color Identity &amp; Curve</h4>
<p style="margin-bottom: 8px;">
<strong>Identity:</strong>
<t t-if="identity_badges">
<span class="o_mvd_tcg_report_symbol_group" style="margin-left: 4px;">
<t t-foreach="identity_badges" t-as="badge">
<span class="o_mvd_tcg_report_symbol_frame o_mvd_tcg_report_identity_frame">
<img
class="o_mvd_tcg_report_symbol_icon o_mvd_tcg_report_identity_icon"
t-att-src="badge['src']"
t-att-alt="badge['label']"
t-att-title="badge['label']"
/>
</span>
</t>
</span>
<span
class="o_mvd_tcg_report_muted"
style="margin-left: 6px; font-weight: 600; color: #334155;"
t-out="doc.mtg_color_identity_name"
/>
</t>
<span t-else="" class="o_mvd_tcg_report_muted">Color identity not available</span>
</p>
<p>
<strong>Average Mana Value:</strong>
<span t-field="doc.mtg_average_mana_value"/>
</p>
<p style="margin-top: 8px;">
<strong>Rule Warnings:</strong>
<span t-field="doc.mtg_rule_warning_count"/>
</p>
</div>
</td>
</tr>
</tbody>
</table>
<table class="o_mvd_tcg_report_snapshot" style="margin-bottom: 4px;">
<tbody>
<tr>
<td>
<div class="o_mvd_tcg_report_snapshot_block">
<h4>Type Composition</h4>
<table class="o_mvd_tcg_report_data_table">
<tbody>
<t t-foreach="type_breakdown" t-as="row">
<tr>
<td style="width: 34%;"><strong t-out="row['label']"/></td>
<td style="width: 16%;"><t t-out="row['value']"/></td>
<td style="width: 50%;">
<div style="height: 8px; background: #e5edf5; border-radius: 999px; overflow: hidden; margin-top: 4px;">
<div
t-att-style="'height:8px;border-radius:999px;background:' + row['accent'] + ';width:' + str(row['bar_width']) + '%;'"
/>
</div>
</td>
</tr>
</t>
</tbody>
</table>
</div>
</td>
<td>
<div class="o_mvd_tcg_report_snapshot_block">
<h4>Rule Notes</h4>
<div t-if="doc.mtg_rule_summary" class="o_mvd_tcg_report_callout">
<div t-field="doc.mtg_rule_summary"/>
</div>
<p t-else="" class="o_mvd_tcg_report_muted">
No MTG rule notes are currently available.
</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</xpath>
<xpath expr="//td[hasclass('o_mvd_tcg_report_card_cell')]/div[hasclass('o_mvd_tcg_report_card_name')]" position="after">
<t t-set="rule_sections" t-value="get_line_rule_sections(line)"/>
<div
t-if="doc.is_mtg_deck and (line.mtg_type_line or line.mtg_set_id or line.mtg_collector_number or rule_sections)"
class="o_mvd_tcg_report_card_meta"
>
<t t-if="line.card_id.mtg_face_count &gt; 1 and rule_sections">
<div>
<span t-if="line.mtg_set_id" t-field="line.mtg_set_id"/>
<span t-if="line.mtg_set_id and line.mtg_collector_number"> · </span>
<span t-if="line.mtg_collector_number" t-out="line.mtg_collector_number"/>
</div>
<t t-foreach="rule_sections" t-as="section">
<div class="o_mvd_tcg_report_face_block">
<div class="o_mvd_tcg_report_face_title">
<span t-if="section['name']" t-out="section['name']"/>
<t t-set="face_mana_symbols" t-value="get_mana_symbols(section['mana_cost'])"/>
<t t-if="face_mana_symbols">
<span class="o_mvd_tcg_report_inline_symbol_group">
<t t-foreach="face_mana_symbols" t-as="symbol">
<span class="o_mvd_tcg_report_symbol_frame o_mvd_tcg_report_inline_symbol_frame">
<img
class="o_mvd_tcg_report_symbol_icon o_mvd_tcg_report_inline_symbol_icon"
t-att-src="symbol['src']"
t-att-alt="symbol['label']"
t-att-title="symbol['label']"
/>
</span>
</t>
</span>
</t>
</div>
<div t-if="section['type_line']">
<span t-out="section['type_line']"/>
</div>
<div
t-if="section['oracle_text']"
class="o_mvd_tcg_report_oracle"
t-out="render_mtg_rules_text(section['oracle_text'])"
/>
</div>
</t>
</t>
<t t-else="">
<div t-if="line.mtg_type_line">
<span t-field="line.mtg_type_line"/>
</div>
<div>
<span t-if="line.mtg_set_id" t-field="line.mtg_set_id"/>
<span t-if="line.mtg_set_id and line.mtg_collector_number"> · </span>
<span t-if="line.mtg_collector_number" t-out="line.mtg_collector_number"/>
</div>
<div
t-if="rule_sections and rule_sections[0]['oracle_text']"
class="o_mvd_tcg_report_oracle"
t-out="render_mtg_rules_text(rule_sections[0]['oracle_text'])"
/>
</t>
</div>
</xpath>
</template>
</odoo>