<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright 2014-2020 Akretion (http://www.akretion.com/)
  @author Alexis de Lattre <alexis.delattre@akretion.com>
  License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->

<odoo>


<record id="view_location_search" model="ir.ui.view">
    <field name="name">stock.usability.stock.location.search</field>
    <field name="model">stock.location</field>
    <field name="inherit_id" ref="stock.view_location_search" />
    <field name="arch" type="xml">
        <filter name="inactive" position="after">
            <group string="Group By" name="groupby">
                <filter name="usage_groupby" string="Location Type"
                    context="{'group_by': 'usage'}"/>
                <filter name="removal_strategy_groupby" string="Removal Strategy"
                    context="{'group_by': 'removal_strategy_id'}"/>
            </group>
        </filter>
    </field>
</record>

<record id="location_open_orderpoint" model="ir.actions.act_window">
    <field name="name">Reordering Rules</field>
    <field name="res_model">stock.warehouse.orderpoint</field>
    <field name="context">{'default_location_id': active_id, 'search_default_location_id': active_id}</field>
</record>

<record id="view_location_form" model="ir.ui.view">
    <field name="name">stock.usability.stock.location.form</field>
    <field name="model">stock.location</field>
    <field name="inherit_id" ref="stock.view_location_form"/>
    <field name="arch" type="xml">
        <div name="button_box" position="inside">
            <button type="action" name="%(location_open_orderpoint)d"
                string="Reordering Rules"
                class="oe_stat_button" icon="fa-refresh"/>
        </div>
        <button name="%(stock.location_open_quants)d" position="attributes">
            <attribute name="type">object</attribute>
            <attribute name="name">action_show_quants</attribute>
        </button>
    </field>
</record>

<!-- By default, the menu entry for stock location is only under
Configuration > Warehouse management
But, the view of stock location is very useful to be able to list
of the items present on a particular stock location => so every user
should be able to access it. So I add a menu entry under Inventory Control. -->

<menuitem id="stock_location_menu" action="stock.action_location_form"
    parent="stock.menu_warehouse_report"
    groups="stock.group_stock_multi_locations"
    sequence="50"/>

</odoo>
