<?xml version="1.0" encoding="utf-8" ?>
<odoo>
    <!-- ============================================ -->
    <!-- Group Orders (Pedidos de Grupo) -->
    <!-- ============================================ -->

    <!-- Pedido semanal activo de Garaialde -->
    <record id="group_order_garaialde_weekly" model="group.order">
        <field name="name">Eskaera Astekaria Garaialde</field>
        <field name="sequence">10</field>
        <field name="group_ids" eval="[(6, 0, [ref('group_garaialde')])]" />
        <field name="type">regular</field>
        <field name="start_date" eval="(DateTime.today() - timedelta(days=30)).strftime('%Y-%m-%d')" />
        <field name="end_date" eval="False" />
        <field name="period">weekly</field>
        <field name="pickup_day">4</field>
        <!-- Friday -->
        <field name="cutoff_day">3</field>
        <!-- Thursday -->
        <field name="home_delivery" eval="True" />
        <field name="delivery_product_id" ref="product_home_delivery_service" />
        <field name="supplier_ids" eval="[(6, 0, [ref('supplier_baserritarra'), ref('supplier_ekotalde'), ref('supplier_artizarra'), ref('supplier_okindegia')])]" />
        <field name="category_ids" eval="[(6, 0, [ref('categ_fruta_fresca'), ref('categ_verdura_fresca'), ref('categ_lacteos'), ref('categ_pan_reposteria')])]" />
        <field name="company_id" ref="base.main_company" />
    </record>

    <!-- Pedido quincenal activo de Lamiakada -->
    <record id="group_order_lamiakada_biweekly" model="group.order">
        <field name="name">Eskaera Hamabostaldia Lamiakada</field>
        <field name="sequence">20</field>
        <field name="group_ids" eval="[(6, 0, [ref('group_lamiakada')])]" />
        <field name="type">regular</field>
        <field name="start_date" eval="(DateTime.today() - timedelta(days=15)).strftime('%Y-%m-%d')" />
        <field name="end_date" eval="False" />
        <field name="period">biweekly</field>
        <field name="pickup_day">5</field>
        <!-- Saturday -->
        <field name="cutoff_day">4</field>
        <!-- Friday -->
        <field name="home_delivery" eval="False" />
        <field name="supplier_ids" eval="[(6, 0, [ref('supplier_biozikloa'), ref('supplier_hiruki')])]" />
        <field name="category_ids" eval="[(6, 0, [ref('categ_fruta_fresca'), ref('categ_conservas')])]" />
        <field name="company_id" ref="base.main_company" />
    </record>

    <!-- Pedido mensual de Eko Auzolan -->
    <record id="group_order_ekoauzolan_monthly" model="group.order">
        <field name="name">Eskaera Hilabetekoa Eko Auzolan</field>
        <field name="sequence">30</field>
        <field name="group_ids" eval="[(6, 0, [ref('group_ekoauzolan')])]" />
        <field name="type">regular</field>
        <field name="start_date" eval="(DateTime.today() - timedelta(days=60)).strftime('%Y-%m-%d')" />
        <field name="end_date" eval="False" />
        <field name="period">monthly</field>
        <field name="pickup_day">0</field>
        <!-- Monday -->
        <field name="cutoff_day">6</field>
        <!-- Sunday -->
        <field name="home_delivery" eval="True" />
        <field name="delivery_product_id" ref="product_home_delivery_service" />
        <field name="supplier_ids" eval="[(6, 0, [ref('supplier_baserritarra'), ref('supplier_biozikloa'), ref('supplier_artizarra')])]" />
        <field name="product_ids" eval="[(6, 0, [ref('product_queso_idiazabal'), ref('product_bonito_conserva'), ref('product_pimientos_piquillo')])]" />
        <field name="company_id" ref="base.main_company" />
    </record>

    <!-- Pedido especial (una vez) - Productos de temporada -->
    <record id="group_order_special_seasonal" model="group.order">
        <field name="name">Eskaera Berezia - Denboraldia</field>
        <field name="sequence">40</field>
        <field name="group_ids" eval="[(6, 0, [ref('group_garaialde'), ref('group_lamiakada')])]" />
        <field name="type">special</field>
        <field name="start_date" eval="DateTime.today().strftime('%Y-%m-%d')" />
        <field name="end_date" eval="(DateTime.today() + timedelta(days=14)).strftime('%Y-%m-%d')" />
        <field name="period">once</field>
        <field name="pickup_day">5</field>
        <!-- Saturday -->
        <field name="cutoff_day">3</field>
        <!-- Thursday -->
        <field name="home_delivery" eval="False" />
        <field name="supplier_ids" eval="[(6, 0, [ref('supplier_baserritarra')])]" />
        <field name="product_ids" eval="[(6, 0, [ref('product_tomate_ecologico'), ref('product_pimiento_verde'), ref('product_lechuga_km0')])]" />
        <field name="company_id" ref="base.main_company" />
    </record>

    <!-- Pedido promocional (una vez) - Navidad -->
    <record id="group_order_promo_christmas" model="group.order">
        <field name="name">Eskaera Promozionala - Gabonak</field>
        <field name="sequence">50</field>
        <field name="group_ids" eval="[(6, 0, [ref('group_garaialde'), ref('group_lamiakada'), ref('group_ekoauzolan')])]" />
        <field name="type">promotional</field>
        <field name="start_date" eval="(DateTime.today() + timedelta(days=5)).strftime('%Y-%m-%d')" />
        <field name="end_date" eval="(DateTime.today() + timedelta(days=21)).strftime('%Y-%m-%d')" />
        <field name="period">once</field>
        <field name="pickup_day">4</field>
        <!-- Friday -->
        <field name="cutoff_day">2</field>
        <!-- Wednesday -->
        <field name="home_delivery" eval="True" />
        <field name="delivery_product_id" ref="product_home_delivery_service" />
        <field name="supplier_ids" eval="[(6, 0, [ref('supplier_okindegia'), ref('supplier_hiruki'), ref('supplier_artizarra')])]" />
        <field name="product_ids" eval="[(6, 0, [ref('product_goxua'), ref('product_queso_idiazabal'), ref('product_bonito_conserva')])]" />
        <field name="company_id" ref="base.main_company" />
    </record>

    <!-- Pedido pasado (cerrado) - Ejemplo histórico -->
    <record id="group_order_past_closed" model="group.order">
        <field name="name">Eskaera Astekaria (Itxita)</field>
        <field name="sequence">100</field>
        <field name="group_ids" eval="[(6, 0, [ref('group_garaialde')])]" />
        <field name="type">regular</field>
        <field name="start_date" eval="(DateTime.today() - timedelta(days=90)).strftime('%Y-%m-%d')" />
        <field name="end_date" eval="(DateTime.today() - timedelta(days=30)).strftime('%Y-%m-%d')" />
        <field name="period">weekly</field>
        <field name="pickup_day">4</field>
        <field name="cutoff_day">3</field>
        <field name="home_delivery" eval="True" />
        <field name="delivery_product_id" ref="product_home_delivery_service" />
        <field name="supplier_ids" eval="[(6, 0, [ref('supplier_baserritarra'), ref('supplier_artizarra')])]" />
        <field name="category_ids" eval="[(6, 0, [ref('categ_fruta_fresca'), ref('categ_lacteos')])]" />
        <field name="company_id" ref="base.main_company" />
    </record>

    <!-- Pedido multi-grupo (varios grupos participan) -->
    <record id="group_order_multi_group" model="group.order">
        <field name="name">Eskaera Kolektiboa - Ekintza Elkartua</field>
        <field name="sequence">15</field>
        <field name="group_ids" eval="[(6, 0, [ref('group_garaialde'), ref('group_lamiakada'), ref('group_ekoauzolan')])]" />
        <field name="type">regular</field>
        <field name="start_date" eval="(DateTime.today() - timedelta(days=7)).strftime('%Y-%m-%d')" />
        <field name="end_date" eval="False" />
        <field name="period">monthly</field>
        <field name="pickup_day">6</field>
        <!-- Sunday -->
        <field name="cutoff_day">5</field>
        <!-- Saturday -->
        <field name="home_delivery" eval="True" />
        <field name="delivery_product_id" ref="product_home_delivery_service" />
        <field name="supplier_ids" eval="[(6, 0, [ref('supplier_baserritarra'), ref('supplier_biozikloa'), ref('supplier_ekotalde')])]" />
        <field name="category_ids" eval="[(6, 0, [ref('categ_verdura_fresca'), ref('categ_fruta_fresca')])]" />
        <field name="excluded_product_ids" eval="[(6, 0, [ref('product_platano_canarias')])]" />
        <field name="company_id" ref="base.main_company" />
    </record>

    <!-- Pedido con productos excluidos (ejemplo blacklist) -->
    <record id="group_order_with_exclusions" model="group.order">
        <field name="name">Eskaera Urtekoa - Produktu Iraunkorra</field>
        <field name="sequence">25</field>
        <field name="group_ids" eval="[(6, 0, [ref('group_lamiakada')])]" />
        <field name="type">regular</field>
        <field name="start_date" eval="DateTime.today().strftime('%Y-%m-%d')" />
        <field name="end_date" eval="False" />
        <field name="period">monthly</field>
        <field name="pickup_day">1</field>
        <!-- Tuesday -->
        <field name="cutoff_day">0</field>
        <!-- Monday -->
        <field name="home_delivery" eval="False" />
        <field name="supplier_ids" eval="[(6, 0, [ref('supplier_hiruki')])]" />
        <field name="category_ids" eval="[(6, 0, [ref('categ_conservas')])]" />
        <field name="excluded_product_ids" eval="[(6, 0, [ref('product_pimientos_piquillo')])]" />
        <field name="excluded_supplier_ids" eval="[(6, 0, [])]" />
        <field name="company_id" ref="base.main_company" />
    </record>

</odoo>
