<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data noupdate="1">

        <!-- Коды показателей -->
        <record id="demo_index_code_revenue" model="hg.index.code">
            <field name="name">ВЫРУЧКА</field>
        </record>
        <record id="demo_index_code_cost" model="hg.index.code">
            <field name="name">СЕБЕСТОИМОСТЬ</field>
        </record>
        <record id="demo_index_code_profit" model="hg.index.code">
            <field name="name">ПРИБЫЛЬ</field>
        </record>

        <!-- Узлы гиперграфа -->
        <record id="demo_node_sales" model="hg.node">
            <field name="name">Продажи</field>
            <field name="res_model">sale.order</field>
            <field name="res_id">0</field>
        </record>
        <record id="demo_node_production" model="hg.node">
            <field name="name">Производство</field>
            <field name="res_model">mrp.production</field>
            <field name="res_id">0</field>
        </record>

        <!-- Показатели -->
        <record id="demo_index_revenue" model="hg.index">
            <field name="name">Выручка за месяц</field>
            <field name="internal_code_id" ref="demo_index_code_revenue"/>
            <field name="external_code">REV-001</field>
            <field name="public" eval="True"/>
            <field name="node_id" ref="demo_node_sales"/>
        </record>
        <record id="demo_index_cost" model="hg.index">
            <field name="name">Себестоимость за месяц</field>
            <field name="internal_code_id" ref="demo_index_code_cost"/>
            <field name="external_code">COST-001</field>
            <field name="public" eval="False"/>
            <field name="node_id" ref="demo_node_production"/>
        </record>
        <record id="demo_index_profit" model="hg.index">
            <field name="name">Прибыль за месяц</field>
            <field name="internal_code_id" ref="demo_index_code_profit"/>
            <field name="external_code">PROF-001</field>
            <field name="public" eval="True"/>
        </record>

        <!-- Значения показателей -->
        <record id="demo_value_revenue_jan" model="hg.value">
            <field name="index_id" ref="demo_index_revenue"/>
            <field name="date_due">2026-01-31</field>
            <field name="value_float_actual">1500000.0</field>
            <field name="value_float_plan">1200000.0</field>
            <field name="type">alone</field>
        </record>
        <record id="demo_value_revenue_feb" model="hg.value">
            <field name="index_id" ref="demo_index_revenue"/>
            <field name="date_due">2026-02-28</field>
            <field name="value_float_actual">1350000.0</field>
            <field name="value_float_plan">1300000.0</field>
            <field name="type">alone</field>
        </record>
        <record id="demo_value_cost_jan" model="hg.value">
            <field name="index_id" ref="demo_index_cost"/>
            <field name="date_due">2026-01-31</field>
            <field name="value_float_actual">900000.0</field>
            <field name="value_float_plan">800000.0</field>
            <field name="type">alone</field>
        </record>
        <record id="demo_value_profit_jan" model="hg.value">
            <field name="index_id" ref="demo_index_profit"/>
            <field name="date_due">2026-01-31</field>
            <field name="value_float_actual">600000.0</field>
            <field name="value_float_plan">400000.0</field>
            <field name="type">alone</field>
        </record>

        <!-- Связи гиперграфа -->
        <record id="demo_link_sales_production" model="hg.link">
            <field name="name">Продажи → Производство</field>
            <field name="source_id" ref="demo_node_sales"/>
            <field name="target_ids" eval="[(6, 0, [ref('demo_node_production')])]"/>
        </record>

    </data>
</odoo>
