<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data noupdate="1">
        <!-- Closed Sessions -->
        <!-- forcecreate is set to false in order to not create record when updating the db -->

        <function model="ir.model.data" name="_update_xmlids">
            <value model="base" eval="[{
                    'xml_id': 'pos_restaurant.payment_method',
                    'record': obj().env.ref('pos_restaurant.pos_config_main_restaurant')._get_payment_method('bank'),
                    'noupdate': True,
                }]" />
        </function>

        <!-- Closed Session 3 -->
        <record id="pos_closed_session_3" model="pos.session" forcecreate="False">
            <field name="name">OpenSession/0004</field>
            <field name="config_id" ref="pos_config_main_restaurant" />
            <field name="user_id" ref="base.user_admin" />
            <field name="name">Restaurant/Demo/03</field>
            <field name="start_at" eval="(DateTime.today() + relativedelta(days=-1)).strftime('%Y-%m-%d %H:%M:%S')" />
            <field name="stop_at"
                eval="(DateTime.today() + relativedelta(days=-1, hours=1)).strftime('%Y-%m-%d %H:%M:%S')" />
        </record>

        <record id="pos_closed_order_3_1" model="pos.order" forcecreate="False">
            <field name="session_id" ref="pos_closed_session_3" />
            <field name="company_id" ref="base.main_company" />
            <field name="state">paid</field>
            <field name="amount_total">14.0</field>
            <field name="amount_tax">0.0</field>
            <field name="amount_paid">14.0</field>
            <field name="amount_return">0.0</field>
            <field name="ticket_code">cs24t</field>
            <field name="preset_id" eval="ref('pos_takein_preset', raise_if_not_found=False)"/>
        </record>

        <record id="pos_closed_orderline_3_1_1" model="pos.order.line" forcecreate="False">
            <field name="product_id" ref="pos_food_margherita" />
            <field name="price_subtotal">7.0</field>
            <field name="price_subtotal_incl">7.0</field>
            <field name="price_unit">7.0</field>
            <field name="order_id" ref="pos_closed_order_3_1" />
            <field name="full_product_name">Margherita</field>
        </record>

        <record id="pos_closed_orderline_3_1_2" model="pos.order.line" forcecreate="False">
            <field name="product_id" ref="pos_food_funghi" />
            <field name="price_subtotal">7.0</field>
            <field name="price_subtotal_incl">7.0</field>
            <field name="price_unit">7.0</field>
            <field name="order_id" ref="pos_closed_order_3_1" />
            <field name="full_product_name">Funghi</field>
        </record>

        <record id="pos_payment_1" model="pos.payment" forcecreate="False">
            <field name="payment_method_id" ref="pos_restaurant.payment_method" />
            <field name="pos_order_id" ref="pos_closed_order_3_1" />
            <field name="amount">14.0</field>
        </record>

        <record id="pos_closed_order_3_2" model="pos.order" forcecreate="False">
            <field name="session_id" ref="pos_closed_session_3" />
            <field name="company_id" ref="base.main_company" />
            <field name="state">paid</field>
            <field name="amount_total">7.0</field>
            <field name="amount_tax">0.0</field>
            <field name="amount_paid">7.0</field>
            <field name="amount_return">0.0</field>
            <field name="ticket_code">bg3yt</field>
            <field name="preset_id" eval="ref('pos_takein_preset', raise_if_not_found=False)"/>
        </record>

        <record id="pos_closed_orderline_3_2_1" model="pos.order.line" forcecreate="False">
            <field name="product_id" ref="pos_food_vege" />
            <field name="price_subtotal">7.0</field>
            <field name="price_subtotal_incl">7.0</field>
            <field name="price_unit">7.0</field>
            <field name="order_id" ref="pos_closed_order_3_2" />
            <field name="full_product_name">Vegetarian</field>
        </record>

        <record id="pos_payment_2" model="pos.payment" forcecreate="False">
            <field name="payment_method_id" ref="pos_restaurant.payment_method" />
            <field name="pos_order_id" ref="pos_closed_order_3_2" />
            <field name="amount">7.0</field>
        </record>

        <function model="pos.session" name="action_pos_session_closing_control"
            eval="[[ref('pos_closed_session_3')]]" />

        <!-- Closed Session 4 -->

        <record id="pos_closed_session_4" model="pos.session" forcecreate="False">
            <field name="name">OpenSession/0005</field>
            <field name="config_id" ref="pos_config_main_restaurant" />
            <field name="user_id" ref="base.user_admin" />
            <field name="name">Restaurant/Demo/04</field>
            <field name="start_at" eval="(DateTime.today() + relativedelta(days=-1)).strftime('%Y-%m-%d %H:%M:%S')" />
            <field name="stop_at"
                eval="(DateTime.today() + relativedelta(days=-1, hours=1)).strftime('%Y-%m-%d %H:%M:%S')" />
        </record>

        <record id="pos_closed_order_4_1" model="pos.order" forcecreate="False">
            <field name="session_id" ref="pos_closed_session_4" />
            <field name="company_id" ref="base.main_company" />
            <field name="state">paid</field>
            <field name="amount_total">6.7</field>
            <field name="amount_tax">0.0</field>
            <field name="amount_paid">6.7</field>
            <field name="amount_return">0.0</field>
            <field name="ticket_code">kq9ty</field>
            <field name="preset_id" eval="ref('pos_takein_preset', raise_if_not_found=False)"/>
        </record>

        <record id="pos_closed_orderline_4_1_1" model="pos.order.line" forcecreate="False">
            <field name="product_id" ref="water" />
            <field name="price_subtotal">2.20</field>
            <field name="price_subtotal_incl">2.20</field>
            <field name="price_unit">2.20</field>
            <field name="order_id" ref="pos_closed_order_4_1" />
            <field name="full_product_name">Water</field>
        </record>

        <record id="pos_closed_orderline_4_1_2" model="pos.order.line" forcecreate="False">
            <field name="product_id" ref="pos_food_bolo" />
            <field name="price_subtotal">4.5</field>
            <field name="price_subtotal_incl">4.5</field>
            <field name="price_unit">4.5</field>
            <field name="order_id" ref="pos_closed_order_4_1" />
            <field name="full_product_name">Pasta Bolognese</field>
        </record>

        <record id="pos_payment_3" model="pos.payment" forcecreate="False">
            <field name="payment_method_id" ref="pos_restaurant.payment_method" />
            <field name="pos_order_id" ref="pos_closed_order_4_1" />
            <field name="amount">6.7</field>
        </record>

        <record id="pos_closed_order_4_2" model="pos.order" forcecreate="False">
            <field name="session_id" ref="pos_closed_session_4" />
            <field name="company_id" ref="base.main_company" />
            <field name="state">paid</field>
            <field name="amount_total">28.0</field>
            <field name="amount_tax">0.0</field>
            <field name="amount_paid">28.0</field>
            <field name="amount_return">0.0</field>
            <field name="ticket_code">ij0ty</field>
            <field name="preset_id" eval="ref('pos_takein_preset', raise_if_not_found=False)"/>
        </record>

        <record id="pos_closed_orderline_4_2_1" model="pos.order.line" forcecreate="False">
            <field name="product_id" ref="pos_food_cheeseburger" />
            <field name="price_subtotal">28.0</field>
            <field name="price_subtotal_incl">28.0</field>
            <field name="price_unit">7.0</field>
            <field name="qty">4</field>
            <field name="order_id" ref="pos_closed_order_4_2" />
            <field name="full_product_name">Cheese Burger</field>
        </record>

        <record id="pos_payment_4" model="pos.payment" forcecreate="False">
            <field name="payment_method_id" ref="pos_restaurant.payment_method" />
            <field name="pos_order_id" ref="pos_closed_order_4_2" />
            <field name="amount">28.0</field>
        </record>

        <function model="pos.session" name="action_pos_session_closing_control"
            eval="[[ref('pos_closed_session_4')]]" />

        <!-- Open Session -->
        <record id="customer_1" model="res.partner">
            <field name="name">John Doe</field>
        </record>

        <record id="pos_open_session_2" model="pos.session" forcecreate="False">
            <field name="name">OpenSession/0003</field>
            <field name="config_id" ref="pos_config_main_restaurant" />
            <field name="user_id" ref="base.user_admin" />
            <field name="start_at" eval="(DateTime.today() + relativedelta(days=-1)).strftime('%Y-%m-%d %H:%M:%S')" />
        </record>

        <record id="pos_open_order_2" model="pos.order" forcecreate="False">
            <field name="session_id" ref="pos_open_session_2" />
            <field name="company_id" ref="base.main_company" />
            <field name="state">draft</field>
            <field name="amount_total">22.90</field>
            <field name="amount_tax">0.0</field>
            <field name="amount_paid">0.0</field>
            <field name="amount_return">0.0</field>
            <field name="partner_id" ref="customer_1" />
            <field name="table_id" ref="table_01" />
            <field name="customer_count">8</field>
            <field name="ticket_code">pp3ss</field>
            <field name="preset_id" eval="ref('pos_takein_preset', raise_if_not_found=False)"/>
        </record>

        <record id="pos_orderline_2" model="pos.order.line" forcecreate="False">
            <field name="product_id" ref="coke" />
            <field name="price_subtotal">4.40</field>
            <field name="price_subtotal_incl">4.40</field>
            <field name="price_unit">2.20</field>
            <field name="qty">2</field>
            <field name="order_id" ref="pos_open_order_2" />
            <field name="full_product_name">Coca-Cola</field>
        </record>

        <record id="pos_orderline_3" model="pos.order.line" forcecreate="False">
            <field name="product_id" ref="pos_food_chirashi" />
            <field name="price_subtotal">18.5</field>
            <field name="price_subtotal_incl">18.5</field>
            <field name="price_unit">9.25</field>
            <field name="qty">2</field>
            <field name="order_id" ref="pos_open_order_2" />
            <field name="full_product_name">Salmon and Avocado</field>
        </record>

        <record id="pos_open_order_3" model="pos.order" forcecreate="False">
            <field name="session_id" ref="pos_open_session_2" />
            <field name="company_id" ref="base.main_company" />
            <field name="state">draft</field>
            <field name="amount_total">21.8</field>
            <field name="amount_tax">0.0</field>
            <field name="amount_paid">0.0</field>
            <field name="amount_return">0.0</field>
            <field name="partner_id" ref="customer_1" />
            <field name="table_id" ref="table_02" />
            <field name="customer_count">3</field>
            <field name="ticket_code">lm5sr</field>
            <field name="preset_id" eval="ref('pos_takein_preset', raise_if_not_found=False)"/>
        </record>

        <record id="pos_orderline_4" model="pos.order.line" forcecreate="False">
            <field name="product_id" ref="pos_food_temaki" />
            <field name="price_subtotal">14.0</field>
            <field name="price_subtotal_incl">14.0</field>
            <field name="price_unit">14.0</field>
            <field name="qty">1</field>
            <field name="order_id" ref="pos_open_order_3" />
            <field name="full_product_name">Lunch Temaki mix 3pc</field>
        </record>

        <record id="pos_orderline_5" model="pos.order.line" forcecreate="False">
            <field name="product_id" ref="pos_food_mozza" />
            <field name="price_subtotal">7.8</field>
            <field name="price_subtotal_incl">7.8</field>
            <field name="price_unit">3.9</field>
            <field name="qty">2</field>
            <field name="order_id" ref="pos_open_order_3" />
            <field name="full_product_name">Mozzarella Sandwich</field>
        </record>

        <record id="pos_open_order_4" model="pos.order" forcecreate="False">
            <field name="session_id" ref="pos_open_session_2" />
            <field name="company_id" ref="base.main_company" />
            <field name="state">draft</field>
            <field name="amount_total">10.5</field>
            <field name="amount_tax">0.0</field>
            <field name="amount_paid">0.0</field>
            <field name="amount_return">0.0</field>
            <field name="partner_id" ref="customer_1" />
            <field name="table_id" ref="table_04" />
            <field name="customer_count">5</field>
            <field name="ticket_code">qrs2t</field>
            <field name="preset_id" eval="ref('pos_takein_preset', raise_if_not_found=False)"/>
        </record>

        <record id="pos_orderline_6" model="pos.order.line" forcecreate="False">
            <field name="product_id" ref="pos_food_chicken" />
            <field name="price_subtotal">3.0</field>
            <field name="price_subtotal_incl">3.0</field>
            <field name="price_unit">3.0</field>
            <field name="qty">1</field>
            <field name="order_id" ref="pos_open_order_4" />
            <field name="full_product_name">Chicken Curry Sandwich</field>
        </record>

        <record id="pos_orderline_7" model="pos.order.line" forcecreate="False">
            <field name="product_id" ref="pos_food_bacon" />
            <field name="price_subtotal">7.5</field>
            <field name="price_subtotal_incl">7.5</field>
            <field name="price_unit">7.5</field>
            <field name="qty">1</field>
            <field name="order_id" ref="pos_open_order_4" />
            <field name="full_product_name">Bacon Burger</field>
        </record>

        <record id="pos_open_order_5" model="pos.order" forcecreate="False">
            <field name="session_id" ref="pos_open_session_2" />
            <field name="company_id" ref="base.main_company" />
            <field name="state">draft</field>
            <field name="amount_total">5.5</field>
            <field name="amount_tax">0.0</field>
            <field name="amount_paid">0.0</field>
            <field name="amount_return">0.0</field>
            <field name="partner_id" ref="customer_1" />
            <field name="table_id" ref="table_06" />
            <field name="customer_count">1</field>
            <field name="ticket_code">cv34t</field>
            <field name="preset_id" eval="ref('pos_takein_preset', raise_if_not_found=False)"/>
        </record>

        <record id="pos_orderline_8" model="pos.order.line" forcecreate="False">
            <field name="product_id" ref="pos_food_4formaggi" />
            <field name="price_subtotal">5.5</field>
            <field name="price_subtotal_incl">5.5</field>
            <field name="price_unit">5.5</field>
            <field name="qty">1</field>
            <field name="order_id" ref="pos_open_order_5" />
            <field name="full_product_name">Pizza 4 Formaggi</field>
        </record>

        <function model="pos.session" name="_set_last_order_preparation_change"
            eval="[[ref('pos_open_order_2'), ref('pos_open_order_3'), ref('pos_open_order_4')]]"/>
    </data>
</odoo>
