<?xml version="1.0"?>

<!--
SPDX-FileCopyrightText: 2008-2026 Luis Falcón <falcon@gnuhealth.org>
SPDX-FileCopyrightText: 2011-2026 GNU Solidario <health@gnusolidario.org>

SPDX-License-Identifier: GPL-3.0-or-later
-->

<tryton>
    <data>

<!-- Replace default Tryton module icons -->
        
        <!-- Stock -->

        <record model="ir.ui.icon" id="inventory_icon">
            <field name="name">gnuhealth-inventory</field>
            <field name="path">icons/tryton-inventory.svg</field>
        </record>
        <menuitem name="Inventory &amp; Stock" sequence="3" id="stock.menu_stock"
            icon="gnuhealth-inventory"/>

<!-- Main views -->


        <record model="ir.ui.view" id="view_party_form">
            <field name="model">party.party</field>
            <field name="inherit" ref="party.party_view_form"/>
            <field name="name">party_form</field>
        </record>

        <record model="ir.ui.view" id="lot_view_form">
            <field name="model">stock.lot</field>
            <field name="inherit" ref="stock_lot.lot_view_form"/>
            <field name="name">lot_form</field>
        </record>
        <record model="ir.ui.view" id="lot_view_tree">
           <field name="model">stock.lot</field>
           <field name="inherit" ref="stock_lot.lot_view_tree"/>
           <field name="name">lot_tree</field>
        </record>


        <record model="ir.ui.view" id="move_view_tree">
            <field name="model">stock.move</field>
            <field name="inherit" ref="stock.move_view_tree"/>
            <field name="name">move_tree</field>
        </record>
        <record model="ir.ui.view" id="move_view_form">
            <field name="model">stock.move</field>
            <field name="inherit" ref="stock.move_view_form"/>
            <field name="name">move_form</field>
        </record>

        <record model="ir.action.act_window" id="act_prescription_move_form1">
            <field name="name">Stock Moves [readonly]</field>
            <field name="res_model">stock.move</field>
            <field name="domain" eval="[('origin.id', '=', Eval('active_id'), 'gnuhealth.prescription.order')]" pyson="1"/>
        </record>
        <record model="ir.action.keyword" id="act_open_prescription_move_keyword1">
            <field name="keyword">form_relate</field>
            <field name="model">gnuhealth.prescription.order,-1</field>
            <field name="action" ref="act_prescription_move_form1"/>
        </record>

        <!-- Shortcut to stock moves from vaccination model -->

        <record model="ir.action.act_window" id="act_vaccination_move_form1">
            <field name="name">Stock Moves [readonly]</field>
            <field name="res_model">stock.move</field>
            <field name="domain" eval="[('origin.id', '=', Eval('active_id'), 'gnuhealth.vaccination')]" pyson="1"/>
        </record>
        <record model="ir.action.keyword" id="act_open_vaccination_move_keyword1">
            <field name="keyword">form_relate</field>
            <field name="model">gnuhealth.vaccination,-1</field>
            <field name="action" ref="act_vaccination_move_form1"/>
        </record>

        <!-- Inherit vaccination view to add stock location field -->
        <record model="ir.ui.view" id="gnuhealth_vaccination_stock_form">
            <field name="model">gnuhealth.vaccination</field>
            <field name="inherit" ref="health.gnuhealth_vaccination_form"/>
            <field name="name">vaccination_form</field>
        </record>

    </data>
</tryton>
