<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>

        <!-- Top menu item -->
        <menuitem name="Warehouse"
            id="menu_stock_root"
            groups="group_stock_manager,group_stock_user"
            sequence="70"/>

        <menuitem id="menu_stock_warehouse_mgmt" name="Operations" parent="menu_stock_root" sequence="1"/>
        <menuitem id="menu_stock_product" name="Products" parent="menu_stock_root" sequence="6"/>
        <menuitem name="Products by Category" id="menu_product_by_category_stock_form" action="product.product_category_action"
            parent="stock.menu_stock_product" sequence="0" groups="base.group_no_one"/>
        <menuitem action="product.product_template_action" id="menu_stock_products_menu" parent="menu_stock_product" sequence="1"/>
        <menuitem id="menu_stock_configuration" name="Configuration" parent="menu_stock_root" sequence="15" groups="group_stock_manager"/>
        <menuitem id="menu_stock_inventory_control" name="Inventory Control" parent="menu_stock_root" sequence="2"/>
        <menuitem
            id="menu_product_in_config_stock" name="Products"
            parent="stock.menu_stock_configuration" sequence="45" groups="base.group_no_one"/>
        <menuitem
            action="product.product_category_action_form" id="menu_product_category_config_stock"
            parent="stock.menu_product_in_config_stock" sequence="0"/>
        <menuitem
            action="product.product_normal_action" id="menu_product_variant_config_stock"
            parent="stock.menu_product_in_config_stock" sequence="2"/>
        <menuitem
            action="product.product_template_action" id="menu_product_template_config_stock"
            parent="stock.menu_product_in_config_stock" sequence="1"/>
        <menuitem
            action="product.product_ul_form_action" groups="product.group_stock_packaging"
            id="menu_product_packaging_stock_action" parent="stock.menu_product_in_config_stock" sequence="3"/>
        <menuitem
            id="menu_stock_unit_measure_stock" name="Units of Measure"
            parent="stock.menu_product_in_config_stock"  sequence="35" groups="product.group_uom"/>
        <menuitem
            action="product.product_uom_categ_form_action" id="menu_stock_uom_categ_form_action"
            parent="menu_stock_configuration" sequence="30" groups="product.group_uom"/>
        <menuitem
            action="product.product_uom_form_action" id="menu_stock_uom_form_action"
            parent="menu_stock_configuration" sequence="35" groups="product.group_uom"/>

        <record id="stock_inventory_line_tree" model="ir.ui.view">
            <field name="name">stock.inventory.line.tree</field>
            <field name="model">stock.inventory.line</field>
            <field name="arch" type="xml">
                <tree string="Stock Inventory Lines">
                    <field name="product_id"/>
                    <field name="product_qty"/>
                    <field name="product_uom_id" groups="product.group_uom"/>
                    <field name="location_id" groups="stock.group_locations"/>
                </tree>
            </field>
        </record>

        <record id="view_inventory_filter" model="ir.ui.view">
            <field name="name">stock.inventory.filter</field>
            <field name="model">stock.inventory</field>
            <field name="arch" type="xml">
                <search string="Search Inventory">
                    <field name="name" string="Inventory Reference"/>
                    <field name="date"/>
                    <field name="company_id" groups="base.group_multi_company"/>
                    <group expand="0" string="Group By">
                        <filter string="Status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
                        <filter string="Inventories Month" icon="terp-go-month" domain="[]" context="{'group_by':'date'}" help="Physical Inventories by Month"/>
                    </group>
                </search>

            </field>
        </record>

        <record id="view_inventory_tree" model="ir.ui.view">
            <field name="name">stock.inventory.tree</field>
            <field name="model">stock.inventory</field>
            <field name="arch" type="xml">
                <tree string="Lot Inventory" colors="grey:state == 'cancel'">
                    <field name="name"/>
                    <field name="date"/>
                    <field name="state"/>
                </tree>
            </field>
        </record>

        <record id="view_inventory_form" model="ir.ui.view">
            <field name="name">stock.inventory.form</field>
            <field name="model">stock.inventory</field>
            <field name="arch" type="xml">
                <form string="Inventory Adjustment">
                <header>
                    <button name="prepare_inventory" states="draft" string="Start Inventory" type="object" class="oe_highlight" groups="stock.group_stock_user"/>
                    <button name="action_done" states="confirm" string="Validate Inventory" type="object" class="oe_highlight" groups="stock.group_stock_manager"/>
                    <button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object"/>
                    <button name="action_cancel_inventory" states="confirm" string="Cancel Inventory" type="object"/>
                    <field name="state" widget="statusbar" statusbar_visible="draft,confirm,done"/>
                </header>
                <sheet>
                    <div class="oe_title">
                        <label for="name" class="oe_edit_only"/>
                        <h1><field name="name" placeholder="e.g. Annual inventory"/></h1>
                    </div>
                    <group>
                        <group>
                            <field name="location_id" domain="[('usage','not in', ['supplier','production'])]"/>
                            <field name="filter" string="Inventory of" widget='radio' attrs="{'readonly': [('state', '!=', 'draft')]}"/>
                        </group>
                        <group>
                            <field name="date"/>
                            <field name="company_id" groups="base.group_multi_company" widget="selection"/>
                            <field name="product_id" domain="[('type','=','product')]" attrs="{'invisible': [('filter', 'not in', ('product', 'product_owner'))], 'required': [('filter', 'in', ('product', 'product_owner'))]}"/>
                            <field name="lot_id" attrs="{'invisible': [('filter', '!=', 'lot')], 'required': [('filter', '=', 'lot')]}" groups="stock.group_production_lot" />
                            <field name="partner_id" attrs="{'invisible': [('filter', 'not in', ('owner', 'product_owner'))], 'required': [('filter', 'in', ('owner', 'product_owner'))]}" groups="stock.group_tracking_owner"/>
                            <field name="package_id" attrs="{'invisible': [('filter', '!=', 'pack')], 'required': [('filter', '=', 'pack')]}" groups="stock.group_tracking_lot"/>
                        </group>
                    </group>
                    <notebook attrs="{'invisible':[('state','=','draft')]}">
                        <page string="Inventory Details" >
                            <button name="reset_real_qty" states="confirm" string="⇒ Set quantities to 0" type="object" class="oe_link oe_right" groups="stock.group_stock_user"/>
                            <field name="line_ids" string="Inventory Details" context="{'default_location_id': location_id,  'default_product_id': product_id, 'default_prod_lot_id': lot_id, 'default_package_id': package_id, 'default_partner_id': partner_id}">
                                <tree string="Inventory Details" editable="bottom" colors="blue: product_qty != theoretical_qty; red: theoretical_qty &lt; 0">
                                    <field name="product_id"  domain="[('type','=','product')]" on_change="onchange_createline(location_id, product_id, product_uom_id, package_id, prod_lot_id, partner_id)"/>
                                    <field name="product_uom_id" groups="product.group_uom" string="UoM" on_change="onchange_createline(location_id, product_id, product_uom_id, package_id, prod_lot_id, partner_id)"/>
                                    <field name="location_id" domain="[('id', 'child_of', parent.location_id)]" groups="stock.group_locations" on_change="onchange_createline(location_id, product_id, product_uom_id, package_id, prod_lot_id, partner_id)"/>
                                    <field name="prod_lot_id" on_change="onchange_createline(location_id, product_id, product_uom_id, package_id, prod_lot_id, partner_id)" domain="[('product_id', '=', product_id)]" context="{'default_product_id': product_id}"  groups="stock.group_production_lot"/>
                                    <field name="package_id" domain="['|', ('location_id','=', False), ('location_id', '=', location_id)]" on_change="onchange_createline(location_id, product_id, product_uom_id, package_id, prod_lot_id, partner_id)" groups="stock.group_tracking_lot"/>
                                    <field name="partner_id" on_change="onchange_createline(location_id, product_id, product_uom_id, package_id, prod_lot_id, partner_id)" groups="stock.group_tracking_owner"/>
                                    <field name="theoretical_qty" readonly="1"/>
                                    <field name="product_qty" string="Real Quantity"/>
                                    <field name="state" invisible="True"/>
                                </tree>
                            </field>
                            <p></p>
                            <h3 class="oe_grey">Notes</h3>
                            <ul class="oe_grey"><li>Inventory adjustments will be made by comparing the theoretical and the checked quantities.</li>
                            <li>You can delete lines to ignore some products.</li>
                            <li>If a product is not at the right place, set the checked quantity to 0 and create a new line with correct location.</li>
                            </ul>
                        </page>
                        <page string="Inventory Adjustments" attrs="{'invisible': [('state', '!=', 'done')]}">
                            <field name="move_ids">
                                <tree colors="grey:scrapped == True" string="Stock Moves">
                                    <field name="product_id"/>
                                    <field name="product_uom_qty" on_change="onchange_quantity(product_id, product_uom_qty, product_uom, product_uos)"/>
                                    <field name="product_uom" string="Unit of Measure" groups="product.group_uom"/>
                                    <field name="product_uos" groups="product.group_uos"/>
                                    <field name="picking_id" invisible="1" />
                                    <field name="create_date" invisible="1" />
                                    <field name="date_expected" invisible="1" />
                                    <button name="%(stock.move_scrap)d"
                                       string="Scrap Products" type="action"
                                       icon="terp-gtk-jump-to-ltr" context="{'scrap': True}"
                                       states="draft,waiting,confirmed,assigned"
                                       groups="base.group_user"/>
                                    <field name="scrapped" invisible="1"/>
                                    <field name="location_id"/>
                                    <field name="location_dest_id"/>
                                    <field name="state"/>
                                </tree>
                            </field>
                        </page>
                    </notebook>
                </sheet>
                </form>
            </field>
        </record>

        <record id="action_inventory_form" model="ir.actions.act_window">
            <field name="name">Inventory Adjustments</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">stock.inventory</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="view_inventory_tree"/>
            <field name="search_view_id" ref="view_inventory_filter"/>
            <field name="help" type="html">
              <p class="oe_view_nocontent_create">
                Click to start an inventory. 
              </p><p>
                Periodical Inventories are used to count the number of products
                available per location. You can use it once a year when you do
                the general inventory or whenever you need it, to adapt the
                current inventory level of a product.
              </p>
            </field>
        </record>
        <menuitem action="action_inventory_form" id="menu_action_inventory_form" parent="menu_stock_inventory_control" sequence="30"/>


        <menuitem id="menu_traceability" name="Traceability" parent="menu_stock_root" 
            sequence="3"/>

        <record id="view_production_lot_form" model="ir.ui.view">
            <field name="name">stock.production.lot.form</field>
            <field name="model">stock.production.lot</field>
            <field name="arch" type="xml">
                <form string="Serial Number">
                    <div class="oe_button_box oe_right">
                        <button name="action_traceability" icon="fa-arrow-up" class="oe_stat_button" string="Traceability" type="object" attrs="{'invisible': [('quant_ids','=',[])]}"/>
                    </div>
                    <div class="oe_title">
                        <label for="name" class="oe_edit_only"/>
                        <h1>
                            <field name="name"/>
                        </h1>
                    </div>
                    <group name="main_group">
                        <group>
                            <field name="product_id"/>
                            <field name="ref"/>
                        </group>
                    </group>
                    <notebook>
                        <page string="Products">
                            <field name="quant_ids">
                                <tree string="Stock Moves">
                                    <field name="name"/>
                                    <field name="product_id"/>
                                    <field name="qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
                                    <field name="location_id" groups="stock.group_locations"/>
                                </tree>
                             </field>
                        </page>
                    </notebook>
                </form>
            </field>
        </record>
        <record id="view_production_lot_tree" model="ir.ui.view">
            <field name="name">stock.production.lot.tree</field>
            <field name="model">stock.production.lot</field>
            <field name="arch" type="xml">
                <tree string="Serial Number">
                    <field name="name"/>
                    <field name="ref"/>
                    <field name="product_id"/>
                    <field name="create_date"/>
                </tree>
            </field>
        </record>

        <record model="ir.ui.view" id="search_product_lot_filter">
            <field name="name">Production Lots Filter</field>
            <field name="model">stock.production.lot</field>
            <field name="arch" type="xml">
                <search string="Product Lots Filter">
                    <field name="name" string="Product Lots" filter_domain="['|',('name','ilike',self),('ref','ilike',self)]"/>
                    <field name="product_id"/>
                    <group expand="0" string="Group By">
                        <filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>
                    </group>
                </search>
            </field>
        </record>

        <record id="action_production_lot_form" model="ir.actions.act_window">
            <field name="name">Serial Numbers</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">stock.production.lot</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="view_production_lot_tree"/>
            <field name="search_view_id" ref="search_product_lot_filter"/>
            <field name="context">{}</field>
            <field name="help" type="html">
              <p class="oe_view_nocontent_create">
                Click to add a serial number.
              </p><p>
                This is the list of all the production lots you recorded. When
                you select a lot, you can get the traceability of the products contained in lot.
              </p>
            </field>
        </record>
        <menuitem action="action_production_lot_form" id="menu_action_production_lot_form"
            parent="menu_traceability" groups="stock.group_production_lot"
            sequence="1"/>

        #
        # Lot composition (history)
        #
        <record id="stock_move_tree" model="ir.ui.view">
            <field name="name">Stock Moves</field>
            <field name="model">stock.move</field>
            <field name="arch" type="xml">
                <tree colors="grey:state == 'cancel'" string="Moves" create="false">
                    <field name="product_id"/>
                    <field name="product_uom_qty"/>
                    <field name="product_uom"  string="Unit of Measure" groups="product.group_uom"/>
                    <field name="product_packaging" domain="[('product_tmpl_id','=',product_tmpl_id)]" groups="product.group_stock_packaging"/>
                    <field name="picking_id"/>
                    <field name="location_id" groups="stock.group_locations"/>
                    <field name="location_dest_id" groups="stock.group_locations"/>
                    <field name="create_date" groups="base.group_no_one"/>
                    <field name="date" string="Date" groups="base.group_no_one"/>
                    <field name="date_expected" string="Date Expected"/>
                    <field name="state"/>
                </tree>
            </field>
        </record>

        <record model="ir.actions.act_window" id="location_open_quants">
            <field name="context">{'search_default_productgroup': 1}</field>
            <field name="domain">[('location_id', 'child_of', active_ids)]</field>
            <field name="name">Current Stock</field>
            <field name="res_model">stock.quant</field>
        </record>

        <act_window
            context="{'location': active_id, 'search_default_real_stock_available': 1, 'search_default_virtual_stock_available': 1,
                        'search_default_virtual_stock_negative': 1, 'search_default_real_stock_negative': 1}"
            id="act_product_location_open"
            name="Products"
            res_model="product.product"
            src_model="stock.location"/>

        <record id="view_location_form" model="ir.ui.view">
            <field name="name">stock.location.form</field>
            <field name="model">stock.location</field>
            <field name="arch" type="xml">
                <form string="Stock Location">
                    <div class="oe_right oe_button_box" name="buttons">
                        <button string="Current Stock" 
                                class="oe_stat_button" 
                                icon="fa-building-o" name="%(location_open_quants)d" type="action"
                                context="{'search_default_internal_loc': 1}"/>
                        <button string="Products"
                                class="oe_stat_button"
                                icon="fa-filter" name="%(act_product_location_open)d" type="action"
                                context="{'location_id': active_id}"
                                />
                    </div>
                    <label for="name" class="oe_edit_only"/>
                    <h1><field name="name"/></h1>
                    <label for="location_id" class="oe_edit_only"/>
                    <h2><field name="location_id"/></h2>

                    <group>
                        <group string="Additional Information">
                            <field name="usage"/>
                            <field name="partner_id"/>
                            <field name="company_id" groups="base.group_multi_company" widget="selection"/>
                            <field name="scrap_location"/>
                            <field name="active"/>
                        </group>
                        <group string="Localization" name="localization">
                            <field name="posx"/>
                            <field name="posy"/>
                            <field name="posz"/>
                            <field name="loc_barcode"/>
                        </group>
                        <group string="Logistics" groups="stock.group_adv_location">
                            <field name="removal_strategy_id" options="{'no_create': True}"/>
                            <field name="putaway_strategy_id"/>
                        </group>
                    </group>
                    <separator string="Additional Information"/>
                    <field name="comment"/>
                </form>
            </field>
        </record>

        <record id="view_location_search" model="ir.ui.view">
            <field name="name">stock.location.search</field>
            <field name="model">stock.location</field>
            <field name="arch" type="xml">
                <search string="Stock Locations">
                    <field name="name" string="Stock Locations"/>
                    <filter icon="terp-go-home" name="in_location" string="Internal" domain="[('usage', '=', 'internal')]" help="Internal Locations"/>
                    <filter icon="terp-personal" name="customer" string="Customer" domain="[('usage', '=', 'customer')]" help="Customer Locations"/>
                    <filter icon="terp-personal" name="supplier" string="Supplier" domain="[('usage', '=', 'supplier')]" help="Supplier Locations"/>
                    <field name="location_id" string="Parent Location"/>
                </search>
            </field>
        </record>


        <record id="view_location_tree2" model="ir.ui.view">
            <field name="name">stock.location.tree</field>
            <field name="model">stock.location</field>
            <field name="priority" eval="2"/>
            <field name="arch" type="xml">
                <tree string="Stock Location" colors="blue:usage=='view';darkred:usage=='internal'">
                    <field name="complete_name"/>
                    <field name="usage"/>
                    <field name="company_id" groups="base.group_multi_company"/>
                </tree>
            </field>
        </record>
        
        <record id="view_putaway" model="ir.ui.view">
            <field name="name">product.putaway.form</field>
            <field name="model">product.putaway</field>
            <field name="arch" type="xml">
                <form string="Putaway">
                   <group colspan="4">
                       <field name="name"/>
		       <field name="method"/>
                   </group>
                   <div attrs="{'invisible': [('method', '!=', 'fixed')]}">
                       <separator string="Fixed Locations Per Categories"/>
                       <field name="fixed_location_ids" colspan="4" nolabel="1">
                           <tree editable="top">
                               <field name="sequence" widget='handle'/>
                               <field name="category_id"/> 
                               <field name="fixed_location_id"/> 
                           </tree>
                       </field>
                   </div>
               </form>
            </field>
        </record>

        <record id="view_removal" model="ir.ui.view">
            <field name="name">product.removal.form</field>
            <field name="model">product.removal</field>
            <field name="arch" type="xml">
                <form string="Removal">
                    <group col="4">
                        <field name="name"/>
                        <field name="method"/>
                    </group>
               </form>
            </field>
        </record>

        <record id="stock_location_path_tree" model="ir.ui.view">
            <field name="name">stock.location.path.tree</field>
            <field name="model">stock.location.path</field>
            <field name="arch" type="xml">
                <tree string="Location Paths">
                    <field name="location_from_id" />
                    <field name="location_dest_id" />
                    <field name="name" />
                </tree>
            </field>
        </record>

        <record id="stock_location_path_form" model="ir.ui.view">
            <field name="name">stock.location.path.form</field>
            <field name="model">stock.location.path</field>
            <field name="arch" type="xml">
                <form string="Location Paths">
                    <group col="4">
                        <group>
                            <field name="name"/>
                            <field name="location_from_id"/>
                            <field name="location_dest_id"/>
                        </group>
                        <group>
                            <field name="company_id" groups="base.group_multi_company" />
                            <field name="picking_type_id"/>
                            <field name="auto"/>
                            <label for="delay" string="Delay"/>
                        <div>
                            <field name="delay" class="oe_inline"/>days
                        </div>
                        </group>
                    </group>
                </form>
            </field>
        </record>

        <record id="product_category_form_view_inherit" model="ir.ui.view">
            <field name="name">product.category.form</field>
            <field name="model">product.category</field>
            <field name="inherit_id" ref="product.product_category_form_view" />
            <field name="arch" type="xml">
                <xpath expr="//group[@name='parent']" position="inside">
                    <group string="Logistics" colspan="2">
                        <field name="route_ids" widget="many2many_tags"/>
                        <div class="oe_inline" colspan="2">
                            <p attrs="{'invisible':[('parent_id','=',False)]}">
                            The following routes will apply to the products in this category taking into account parent categories: 
                            <field name="total_route_ids" nolabel="1" widget="many2many_tags"/>
                            </p>
                        </div>
                        <field name="removal_strategy_id" options="{'no_create': True}"/>
                    </group>
                </xpath>
            </field>
        </record>
        

        <record id="action_location_form" model="ir.actions.act_window">
            <field name="name">Locations</field>
            <field name="res_model">stock.location</field>
            <field name="type">ir.actions.act_window</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="view_location_tree2"/>
            <field name="search_view_id" ref="view_location_search"/>
            <field name="context">{'search_default_in_location':1}</field>
            <field name="help" type="html">
              <p class="oe_view_nocontent_create">
                Click to add a location.
              </p><p>
                Define your locations to reflect your warehouse structure and
                organization. Odoo is able to manage physical locations
                (warehouses, shelves, bin, etc), partner locations (customers,
                suppliers) and virtual locations which are the counterpart of
                the stock operations like the manufacturing orders
                consumptions, inventories, etc.
              </p><p>  
                Every stock operation in Odoo moves the products from one
                location to another one.  For instance, if you receive products
                from a supplier, Odoo will move products from the Supplier
                location to the Stock location. Each report can be performed on
                physical, partner or virtual locations.
              </p>
            </field>
        </record>
        <menuitem action="action_location_form" id="menu_action_location_form" groups="stock.group_locations"
            parent="menu_stock_configuration" sequence="5"/>


        <record id="act_product_stock_move_open" model="ir.actions.act_window">
            <field name="context">{'search_default_done': 1,'search_default_product_id': active_id, 'default_product_id': active_id}</field>
            <field name="name">Moves</field>
            <field name="res_model">stock.move</field>
        </record>

        <record id="view_warehouse" model="ir.ui.view">
            <field name="name">stock.warehouse</field>
            <field name="model">stock.warehouse</field>
            <field name="arch" type="xml">
                <form string="Warehouse">
                    <sheet>
                        <div class="oe_right oe_button_box">                        
                            <button name="view_all_routes_for_wh" 
                                    string="Routes"
                                    icon="fa-refresh"
                                    class="oe_stat_button" 
                                    type="object"/> 
                        </div>
                        <label for="name" class="oe_edit_only"/>
                        <h1><field name="name"/></h1>
                        <group>
                            <group>
                                <field name="code"/>
                            </group>
                            <group>
                                <field name="company_id" groups="base.group_multi_company" widget="selection"/>
                                <field name="partner_id"/>
                            </group>
                            <notebook colspan="4" groups="stock.group_adv_location">
                                <page string="Warehouse Configuration" colspan="4">
                                    <group colspan="4">
                                        <field name="reception_steps" widget='radio'/>
                                        <field name="delivery_steps" widget='radio'/>
                                        <field name="default_resupply_wh_id" widget='selection' on_change="onchange_filter_default_resupply_wh_id(default_resupply_wh_id, resupply_wh_ids)"/>
                                        <field name="resupply_wh_ids" domain="[('id', '!=', id)]" widget='many2many_checkboxes' on_change="onchange_filter_default_resupply_wh_id(default_resupply_wh_id, resupply_wh_ids)"/> 
                                    </group>
                                </page>
                                <page string="Technical Information" groups='base.group_no_one'>
                                    <group>
                                        <group string="Locations">
                                            <field name="wh_input_stock_loc_id" readonly="1"/>
                                            <field name="wh_qc_stock_loc_id" readonly="1"/>
                                            <field name="wh_pack_stock_loc_id" readonly="1"/>
                                            <field name="wh_output_stock_loc_id" readonly="1"/>
                                        </group>
                                        <group string="Picking Types">
                                            <field name="in_type_id" readonly="1"/>
                                            <field name="int_type_id" readonly="1"/>
                                            <field name="pick_type_id" readonly="1"/>
                                            <field name="pack_type_id" readonly="1"/>
                                            <field name="out_type_id" readonly="1"/>
                                        </group>
                                    </group>
                                </page>
                            </notebook>
                        </group>
                    </sheet>
                </form>
            </field>
        </record>
        <record id="view_warehouse_tree" model="ir.ui.view">
            <field name="name">stock.warehouse.tree</field>
            <field name="model">stock.warehouse</field>
            <field name="arch" type="xml">
                <tree string="Warehouse">
                    <field name="name"/>
                    <field name="lot_stock_id" groups="stock.group_locations"/>
                    <field name="partner_id"/>
                </tree>
            </field>
        </record>
        <record id="action_warehouse_form" model="ir.actions.act_window">
            <field name="name">Warehouses</field>
            <field name="res_model">stock.warehouse</field>
            <field name="type">ir.actions.act_window</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="view_warehouse_tree"/>
            <field name="help" type="html">
              <p class="oe_view_nocontent_create">
                Click to define a new warehouse.
              </p>
            </field>
        </record>
        <menuitem action="action_warehouse_form" id="menu_action_warehouse_form" groups="stock.group_locations"
            parent="menu_stock_configuration" sequence="1"/>

        <!--
            Stock picking
            Defaults and Internal Pickings
        -->

        <record model="ir.ui.view" id="stock_picking_calendar">
            <field name="name">stock.picking.calendar</field>
            <field name="model">stock.picking</field>
            <field name="priority" eval="2"/>
            <field name="arch" type="xml">
                <calendar string="Calendar View" date_start="min_date" date_stop="max_date" color="partner_id">
                    <field name="origin"/>
                    <field name="picking_type_id"/>
                    <field name="partner_id"/>
                </calendar>
            </field>
        </record>

        <record id="vpicktree" model="ir.ui.view">
            <field name="name">stock.picking.tree</field>
            <field name="model">stock.picking</field>
            <field name="arch" type="xml">
                <tree colors="blue:state == 'draft';grey:state == 'cancel';red:state not in ('cancel', 'done') and min_date &lt; current_date" string="Picking list">
                    <field name="name"/>
                    <field name="location_dest_id"/>
                    <field name="partner_id"/>
                    <field name="date"/>
                    <field name="min_date" invisible="1"/>
                    <field name="origin"/>
                    <field name="group_id" invisible="1"/>
                    <field name="backorder_id"/>
                    <field name="state"/>
                    <field name="priority" invisible="1"/>
                    <field name="picking_type_id" invisible="1"/>
                </tree>
            </field>
        </record>

        <record id="view_picking_form" model="ir.ui.view">
            <field name="name">stock.picking.form</field>
            <field name="model">stock.picking</field>
            <field eval="12" name="priority"/>
            <field name="arch" type="xml">
                <form string="Transfer">
                <header>
                    <button name="action_confirm" states="draft" string="Mark as Todo" type="object" class="oe_highlight" groups="base.group_user"/>
                    <button name="action_assign" states="confirmed" string="Check Availability" type="object" class="oe_highlight" groups="base.group_user"/>
                    <button name="rereserve_pick" states="partially_available" string="Recheck Availability" type="object" class="oe_highlight" groups="base.group_user"/>
                    <button name="force_assign" states="confirmed,waiting,partially_available" string="Force Availability" type="object" groups="base.group_user"/>
                    <button name="do_enter_transfer_details" states="assigned,partially_available" string="Transfer" groups="stock.group_stock_user" type="object" class="oe_highlight"/>
                    <button name="do_print_picking" string="Print Picking List" groups="stock.group_stock_user" type="object" attrs="{'invisible': ['|', ('picking_type_code', '=', 'outgoing'), ('state', '!=', 'assigned')]}"/>
                    <button name="%(act_stock_return_picking)d" string="Reverse Transfer" states="done" type="action" groups="base.group_user"/>
                    <button name="action_cancel" states="assigned,confirmed,partially_available,draft,waiting" string="Cancel Transfer" groups="base.group_user" type="object"/>
                    <button name="do_unreserve" string="Unreserve" groups="base.group_user" type="object" attrs="{'invisible': [('quant_reserved_exist', '=', False)]}"/>
                    <field name="state" widget="statusbar" statusbar_visible="draft,confirmed,partially_available,assigned,done" statusbar_colors='{"shipping_except":"red","invoice_except":"red","waiting_date":"blue"}'/>
                </header>
                <sheet>
                    <div class="oe_right oe_button_box">
                        <button name="do_partial_open_barcode" groups="stock.group_stock_user" type="object" class="oe_stock_scan_button" attrs="{'invisible': ['|',('pack_operation_exist', '=', True),('state','not in',('assigned', 'partially_available'))]}"><img src="/stock/static/src/img/scan.png" class="oe_stock_scan_image oe_stock_scan_image_btn"/></button>
                        <button name="open_barcode_interface" groups="stock.group_stock_user" type="object" class="oe_stock_scan_button" attrs="{'invisible': ['|',('pack_operation_exist', '=', False),('state','not in',('assigned', 'partially_available'))]}"><img src="/stock/static/src/img/scan.png" class="oe_stock_scan_image oe_stock_scan_image_btn"/></button>
                    </div>
                    <h1>
                        <field name="name" class="oe_inline" attrs="{'invisible': [('name','=','/')]}" readonly="1"/>
                    </h1>
                    <group>
                        <group>
                            <field name="partner_id"/>                            
                            <field name="backorder_id" readonly="1" attrs="{'invisible': [('backorder_id','=',False)]}"/>
                        </group>
                        <group>
                            <field name="date"/>
                            <field name="min_date"/>
                            <field name="origin" placeholder="e.g. PO0032" class="oe_inline"/>
                            <label for="owner_id" groups="stock.group_tracking_owner"/>
                            <div groups="stock.group_tracking_owner">
                                <field name="owner_id"/>
                                <button name="action_assign_owner" string="Assign Owner" type="object" attrs="{'invisible': ['|',('pack_operation_exist', '=', False),('state', 'not in', ('draft','assigned','confirmed'))]}"
                                    class="oe_link oe_edit_only"/>
                            </div>
                        </group>
                    </group>
                    <notebook>
                        <page string="Products">
                            <separator string="Stock Moves" attrs="{'invisible': [('pack_operation_exist', '=', False)]}"/>
                            <field name="move_lines" context="{'address_in_id': partner_id, 'form_view_ref':'stock.view_move_picking_form', 'tree_view_ref':'stock.view_move_picking_tree', 'default_picking_type_id': picking_type_id,'default_picking_id': active_id}"/>
                            <field name="pack_operation_exist" invisible="1"/>
                            <field name="note" placeholder="Add an internal note..." class="oe_inline"/>
                        </page>
                        <page string="Operations" attrs="{'invisible': ['|', ('state','!=','done'), ('pack_operation_ids','=',[])]}">
                            <field name="pack_operation_ids" context="{'default_picking_id': active_id, 'default_location_id': location_id, 'default_location_dest_id': location_dest_id}">
                                <tree editable="top">
                                    <field name="package_id" groups="stock.group_tracking_lot"/>
                                    <field name="product_id" on_change="product_id_change(product_id, product_uom_id, product_qty)"/>
                                    <field name="product_uom_id" groups="product.group_uom"/>
                                    <field name="lot_id" domain="[('product_id','=?', product_id)]" context="{'product_id': product_id}" groups="stock.group_production_lot"/>
                                    <field name="picking_id" invisible="1"/>
                                    <field name="owner_id" groups="stock.group_tracking_owner"/>
                                    <field name="product_qty" attrs="{'required': [('product_id', '!=', False)]}"/>
                                    <field name="location_id" domain="[('id', 'child_of', parent.location_id)]"/>
                                    <field name="location_dest_id" domain="[('id', 'child_of', parent.location_dest_id)]"/>
                                    <field name="result_package_id" groups="stock.group_tracking_lot" context="{'location_id': location_dest_id}"/>
                                </tree>
                            </field>
                            <p class="oe_grey" groups="stock.group_tracking_lot">
                            If there is no product but a source package, this means the source package was moved entirely.  If there is a product and a source package, the product was taken from the source package.  
                            </p>
                        </page>
                        <page string="Additional Info">
                            <group string="General Informations">
                                <group>
                                    <field name="move_type"/>
                                    <field name="picking_type_id"/>
                                    <field name="picking_type_code" invisible="1"/>
                                    <field name="quant_reserved_exist" invisible="1"/>                                    
                                    <field name="location_id" invisible="1"/>
                                    <field name="location_dest_id" invisible="1"/>
                                </group>
                                <group>
                                    <field name="company_id" groups="base.group_multi_company" widget="selection"/>
                                    <field name="date_done" groups="base.group_no_one"/>
                                    <field name="group_id"/>
                                    <field name="priority"/>
                                </group>
                            </group>
                        </page>
                    </notebook>
                </sheet>
                <div class="oe_chatter">
                    <field name="message_follower_ids" widget="mail_followers"/>
                    <field name="message_ids" widget="mail_thread"/>
                </div>
                </form>
            </field>
        </record>

        <record id="view_picking_internal_search" model="ir.ui.view">
            <field name="name">stock.picking.internal.search</field>
            <field name="model">stock.picking</field>
            <field name="arch" type="xml">
                <search string="Picking Lists">
                    <field name="name" string="Picking List" filter_domain="['|',('name','ilike', self),('origin','ilike',self)]"/>
                    <filter icon="terp-check" name="draft" string="Draft" domain="[('state','=','draft')]" help="Draft Moves"/>
                    <filter icon="terp-check" name="available" string="Ready" domain="[('state','in',('assigned', 'partially_available'))]" help="Assigned Moves"/>
                    <filter icon="terp-check" name="waiting" string="Waiting Availability" domain="[('state','=', 'confirmed')]" help="Waiting Moves"/>
                    <filter icon="terp-camera_test" name="confirmed" string="Confirmed" domain="[('state','in', ('confirmed', 'waiting', 'assigned'))]" help="Confirmed Moves"/>
                    <filter icon="terp-dialog-close" name="done" string="Done" domain="[('state','=','done')]" help="Pickings already processed"/>
                    <separator/>
                    <filter name="late" string="Late" domain="[('min_date','&lt;', time.strftime('%%Y-%%m-%%d %%H:%%M:%%S'))]" help="Pickings that are late on scheduled time"/>
                    <separator/>
                    <filter name="backorder" string="Backorders" domain="[('backorder_id','&lt;&gt;', False)]" help="Remaining parts of picking partially processed"/>
                    <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
                    <field name="product_id"/>
                    <field name="picking_type_id"/>
                    <field name="group_id"/>
                    <group expand="0" string="Group By">
                        <filter string="Status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
                        <filter string="Order Date" icon="terp-go-month" domain="[]"  context="{'group_by':'date'}"/>
                        <filter string="Expected Date" icon="terp-go-month" domain="[]"  context="{'group_by':'min_date'}"/>
                        <filter string="Origin" domain="[]" context="{'group_by':'origin'}"/>
                        <filter string="Picking Type" domain="[]" context="{'group_by':'picking_type_id'}"/>
                        <filter string="Procurement Group" domain="[]" context="{'group_by':'group_id'}"/>
                    </group>
                </search>
            </field>
        </record>

        <record id="action_picking_tree_all" model="ir.actions.act_window">
            <field name="name">Stock Operations</field>
            <field name="res_model">stock.picking</field>
            <field name="type">ir.actions.act_window</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form,calendar</field>
            <field name="domain"></field>
            <field name="context">{
                    'contact_display': 'partner_address',
            }
            </field>
            <field name="search_view_id" ref="view_picking_internal_search"/>
        </record>

        <record id="action_picking_tree_done" model="ir.actions.act_window">
            <field name="name">Done Transfers</field>
            <field name="res_model">stock.picking</field>
            <field name="type">ir.actions.act_window</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form,calendar</field>
            <field name="domain"></field>
            <field name="context">{
                    'search_default_picking_type_id': [active_id],
                    'default_picking_type_id': active_id,
                    'contact_display': 'partner_address',
                    'search_default_done': 1,
            }
            </field>
            <field name="search_view_id" ref="view_picking_internal_search"/>
        </record>

        <record id="action_picking_tree_ready" model="ir.actions.act_window">
            <field name="name">Ready Transfers</field>
            <field name="res_model">stock.picking</field>
            <field name="type">ir.actions.act_window</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form,calendar</field>
            <field name="domain"></field>
            <field name="context">{
                    'search_default_picking_type_id': [active_id],
                    'default_picking_type_id': active_id,
                    'contact_display': 'partner_address',
                    'search_default_available': 1,
            }
            </field>
            <field name="search_view_id" ref="view_picking_internal_search"/>
        </record>

        <record id="action_picking_tree_done_grouped" model="ir.actions.act_window">
            <field name="name">Done Transfers by Date</field>
            <field name="res_model">stock.picking</field>
            <field name="type">ir.actions.act_window</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form,calendar</field>
            <field name="domain"></field>
            <field name="context">{
                    'search_default_picking_type_id': [active_id],
                    'default_picking_type_id': active_id,
                    'contact_display': 'partner_address',
                    'search_default_done': 1,
                    'group_by': ['date'],
            }
            </field>
            <field name="search_view_id" ref="view_picking_internal_search"/>
        </record>

        <record id="action_picking_tree_waiting" model="ir.actions.act_window">
            <field name="name">Waiting Availability Transfers</field>
            <field name="res_model">stock.picking</field>
            <field name="type">ir.actions.act_window</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form,calendar</field>
            <field name="domain"></field>
            <field name="context">{
                    'search_default_picking_type_id': [active_id],
                    'default_picking_type_id': active_id,
                    'contact_display': 'partner_address',
                    'search_default_waiting': 1,
            }
            </field>
            <field name="search_view_id" ref="view_picking_internal_search"/>
        </record>

        <record id="action_picking_tree_late" model="ir.actions.act_window">
            <field name="name">Late Transfers</field>
            <field name="res_model">stock.picking</field>
            <field name="type">ir.actions.act_window</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form,calendar</field>
            <field name="domain"></field>
            <field name="context">{
                    'search_default_picking_type_id': [active_id],
                    'default_picking_type_id': active_id,
                    'contact_display': 'partner_address',
                    'search_default_late': 1,
                    'search_default_confirmed': 1,
            }
            </field>
            <field name="search_view_id" ref="view_picking_internal_search"/>
        </record>

        <record id="action_picking_tree_backorder" model="ir.actions.act_window">
            <field name="name">Backorders</field>
            <field name="res_model">stock.picking</field>
            <field name="type">ir.actions.act_window</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form,calendar</field>
            <field name="domain"></field>
            <field name="context">{
                    'search_default_picking_type_id': [active_id],
                    'default_picking_type_id': active_id,
                    'contact_display': 'partner_address',
                    'search_default_backorder': 1,
                    'search_default_confirmed': 1,
            }
            </field>
            <field name="search_view_id" ref="view_picking_internal_search"/>
        </record>

        <record id="action_picking_tree" model="ir.actions.act_window">
            <field name="name">Transfers</field>
            <field name="res_model">stock.picking</field>
            <field name="type">ir.actions.act_window</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form,calendar</field>
            <field name="domain"></field>
            <field name="context">{
                    'search_default_picking_type_id': [active_id],
                    'default_picking_type_id': active_id,
                    'contact_display': 'partner_address',
            }
            </field>
            <field name="search_view_id" ref="view_picking_internal_search"/>
            <field name="help" type="html">
              <p class="oe_view_nocontent_create">
                Click to create a stock operation. 
              </p><p>
                Most operations are prepared automatically by Odoo according
                to your preconfigured logistics rules, but you can also record
                manual stock movements.
              </p>
            </field>
        </record>

        <record id="view_move_graph" model="ir.ui.view">
            <field name="name">stock.move.graph</field>
            <field name="model">stock.move</field>
            <field name="arch" type="xml">
                <graph string="Stock Moves Analysis" type="pivot">
                    <field name="product_id" type="row"/>
                    <field name="location_dest_id" groups="stock.group_locations" type="row"/>
                    <field name="product_uom_qty" type="measure"/>
                </graph>
            </field>
        </record>

        <record id="view_move_tree" model="ir.ui.view">
            <field name="name">stock.move.tree</field>
            <field name="model">stock.move</field>
            <field eval="8" name="priority"/>
            <field name="arch" type="xml">
                <tree colors="grey:state == 'cancel';red:(state not in ('cancel','done')) and date > current_date" string="Moves">
                    <field name="name"/>
                    <field name="picking_id" string="Reference"/>
                    <field name="origin"/>
                    <field name="picking_type_id"/>
                    <field name="create_date" invisible="1" groups="base.group_no_one"/>
                    <field name="product_id" on_change="onchange_product_id(product_id,location_id,location_dest_id, False)"/>
                    <field name="product_uom_qty" on_change="onchange_quantity(product_id, product_uom_qty, product_uom, product_uos)"/>
                    <field name="product_uom" string="Unit of Measure" groups="product.group_uom"/>
                    <field name="product_uos_qty" groups="product.group_uos"/>
                    <field name="product_uos" groups="product.group_uos"/>
                    <button name="%(stock.move_scrap)d"
                        string="Scrap Products" type="action"
                        icon="terp-gtk-jump-to-ltr" context="{'scrap': True}"
                        states="draft,waiting,confirmed,assigned"
                        groups="stock.group_stock_user"/>
                    <field name="location_id" groups="stock.group_locations"/>
                    <field name="location_dest_id" groups="stock.group_locations"/>
                    <field name="date" groups="base.group_no_one"/>
                    <field name="date_expected"/>
                    <field name="state"/>
                    <button name="action_done" states="confirmed,assigned" string="Process" type="object" 
                            groups="stock.group_stock_user" icon="gtk-go-forward" help="Done"/>
                </tree>
            </field>
        </record>

        <record id="view_move_picking_tree" model="ir.ui.view">
            <field name="name">stock.move.tree</field>
            <field name="model">stock.move</field>
            <field eval="4" name="priority"/>
            <field name="arch" type="xml">
                <tree colors="grey:scrapped == True" string="Stock Moves">
                    <field name="product_id"/>
                    <field name="product_uom_qty" on_change="onchange_quantity(product_id, product_uom_qty, product_uom, product_uos)"/>
                    <field name="product_uom" string="Unit of Measure" groups="product.group_uom"/>
                    <field name="product_uos_qty" groups="product.group_uos"/>
                    <field name="product_uos" groups="product.group_uos"/>
                    <field name="location_id" groups="stock.group_locations" invisible="1"/>
                    <field name="picking_id" invisible="1" />
                    <field name="create_date" invisible="1" />
                    <field name="date_expected" invisible="1" />
                    <button name="%(stock.move_scrap)d"
                       string="Scrap Products" type="action"
                       icon="terp-gtk-jump-to-ltr" context="{'scrap': True}"
                       states="draft,waiting,confirmed,assigned"
                       groups="stock.group_stock_user"/>
                    <field name="scrapped" invisible="1"/>
                    <field name="availability" invisible="1"/>
                    <field name="reserved_availability" invisible="1"/>
                    <field name="location_dest_id" groups="stock.group_locations"/>
                    <field name="remaining_qty" invisible="1"/>
                    <field name="string_availability_info"/>
                    <field name="state"/>
                </tree>
            </field>
        </record>

        <record id="view_move_form" model="ir.ui.view">
            <field name="name">stock.move.form</field>
            <field name="model">stock.move</field>
            <field eval="1" name="priority"/>
            <field name="arch" type="xml">
                <form string="Stock Moves">
                <header>
                    <button name="action_confirm" states="draft" string="Process Later" type="object" class="oe_highlight"/>
                    <button name="action_done" states="draft,assigned,confirmed" string="Process Entirely" type="object" class="oe_highlight"/>
                    <button name="force_assign" states="confirmed" string="Set Available" type="object" class="oe_highlight"/>
                    <button name="action_cancel" states="draft,assigned,confirmed" string="Cancel Move" type="object"/>
                    <field name="state" widget="statusbar" statusbar_visible="draft,confirmed,assigned,done" statusbar_colors='{"waiting":"blue","confirmed":"blue"}'/>
                </header>
                <sheet>
                    <group>
                        <group name="main_grp" colspan="4">
                            <group name="main_grp_col1">
                                <field name="product_id" on_change="onchange_product_id(product_id,location_id,location_dest_id, False)"/>
                                <label for="product_uom_qty"/>
                                <div>
                                    <field name="product_uom_qty"
                                        on_change="onchange_quantity(product_id, product_uom_qty, product_uom, product_uos)"
                                        class="oe_inline"/>
                                    <field name="product_uom" groups="product.group_uom" class="oe_inline"/>
                                    <button name="%(stock.move_scrap)d"
                                            string="Scrap" type="action"
                                            icon="terp-gtk-jump-to-ltr" context="{'scrap': True}"
                                            states="draft,waiting,confirmed,assigned" colspan="1"/>
                                </div>
                                <field name="name"/>
                                <label for="product_uos_qty" groups="product.group_uos"/>
                                <div groups="product.group_uos">
                                    <field name="product_uos_qty"
                                        on_change="onchange_uos_quantity(product_id, product_uos_qty, product_uos, product_uom)"
                                        class="oe_inline"/>
                                    <field name="product_uos" class="oe_inline"/>
                                </div>
                            </group>
                            <group name="main_grp_col2">
                                <field name="picking_type_id"/>
                                <field name="priority"/>
                                <field name="company_id" groups="base.group_multi_company" widget="selection"/>
                                <field name="date_expected" on_change="onchange_date(date,date_expected)" attrs="{'invisible': [('state', '=', 'done')]}"/>
                                <field name="date" attrs="{'invisible': [('state', '!=', 'done')]}"/>
                            </group>
                        </group>
                        <group name="origin_grp" string="Origin">
                            <field name="origin"/>
                            <field name="location_id" groups="stock.group_locations"/>
                            <field name="picking_id" domain="[('picking_type_id','=',picking_type_id)]"/>
                            <field name="create_date" groups="base.group_no_one"/>
                            <field name="procure_method" attrs="{'readonly': [('state', '!=', 'draft')]}" groups="stock.group_adv_location"/>
                            <field name="group_id"/>
                        </group>
                        <group name="destination_grp" string="Destination" groups="stock.group_locations">
                            <field name="location_dest_id" />
                            <field name="partner_id" context="{'contact_display':'partner'}" />
                        </group>
                        <group name="quants_grp" string="Reserved Quants" colspan="4" groups="base.group_no_one">
                            <field name="reserved_quant_ids"/>
                        </group>
                    </group>
                </sheet>
                </form>
            </field>
        </record>

        <record id="view_move_picking_form" model="ir.ui.view">
            <field name="name">stock.move.form</field>
            <field name="model">stock.move</field>
            <field eval="20" name="priority"/>
            <field name="arch" type="xml">
                <form string="Stock Moves">
                <header>
                        <button name="force_assign" states="confirmed" string="Force Availability" type="object" groups="base.group_user"/>
                        <button name="action_confirm" states="draft" string="Confirm" type="object" groups="base.group_user"/>
                        <button name="do_unreserve" states="assigned" string="Cancel Availability" type="object" groups="base.group_user"/>
                        <field name="state" widget="statusbar" statusbar_visible="draft,assigned,done"/>
                </header>
                <group>
                    <group>
                        <field name="product_id" on_change="onchange_product_id(product_id,location_id,location_dest_id, parent.partner_id)"/>
                        <field name="procure_method" attrs="{'readonly': [('state', '!=', 'draft')]}" groups="stock.group_adv_location"/>
                        <field name="picking_type_id" invisible="1"/>
                        <label for="product_uom_qty"/>
                        <div>
                            <field name="product_uom_qty" on_change="onchange_quantity(product_id, product_uom_qty, product_uom, product_uos)" class="oe_inline"/>
                            <field name="product_uom" string="Unit Of Measure" groups="product.group_uom" class="oe_inline"/>
                            <button name="%(stock.move_scrap)d"
                                string="Scrap" type="action"
                                icon="terp-gtk-jump-to-ltr" context="{'scrap': True}"
                                states="draft,waiting,confirmed,assigned"
                                groups="base.group_user"/>
                        </div>
                        <label for="product_uos_qty" groups="product.group_uos"/>
                        <div groups="product.group_uos">
                            <field name="product_uos_qty" on_change="onchange_uos_quantity(product_id, product_uos_qty, product_uos, product_uom)" class="oe_inline"/>
                            <field name="product_uos" on_change="onchange_quantity(product_id, product_uom_qty, product_uom, product_uos)" class="oe_inline"/>
                        </div>
                        <field name="name"/>
                        <field name="product_tmpl_id" invisible="1"/>
                        <field name="product_packaging" groups="product.group_stock_packaging" domain="[('product_tmpl_id','=',product_tmpl_id)]"/>
                    </group>
                    <group>
                        <field name="create_date" invisible="1"/>
                        <field name="date"/>
                        <field name="date_expected" on_change="onchange_date(date,date_expected)"/>
                    </group>
                    <group string="Locations" groups="stock.group_locations">
                        <field name="location_id" domain="[('usage','&lt;&gt;','view')]"/>
                        <field name="location_dest_id" domain="[('usage','&lt;&gt;','view')]"/>
                    </group>
                    <group name="quants_grp" string="Reserved Quants" colspan="4" groups="base.group_no_one">
                        <field name="reserved_quant_ids"/>
                    </group>
                </group>
                </form>
            </field>
        </record>

        <record id="view_move_search" model="ir.ui.view">
            <field name="name">stock.move.search</field>
            <field name="model">stock.move</field>
            <field eval="3" name="priority"/>
            <field name="arch" type="xml">
                <search string="Stock Moves">
                    <field name="origin" filter_domain="['|', '|', ('origin', 'ilike', self), ('name', 'ilike', self), ('picking_id', 'ilike', self)]" string="Reference"/>
                    <field name="date" groups="base.group_no_one"/>

                    <filter icon="terp-camera_test" string="Ready" name="ready" domain="[('state','=','assigned')]" help="Stock moves that are Available (Ready to process)"/>
                    <filter icon="terp-stock" string="To Do" name="future" domain="[('state','in',('assigned','confirmed','waiting'))]" help="Stock moves that are Confirmed, Available or Waiting"/>
                    <filter icon="terp-dialog-close" string="Done" name="done" domain="[('state','=','done')]" help="Stock moves that have been processed"/>
                    <separator/>
                    <filter icon="terp-go-today" string="Today" domain="[('date','&lt;=', datetime.datetime.combine(context_today(), datetime.time(23,59,59))), ('date','&gt;=', datetime.datetime.combine(context_today(), datetime.time(0,0,0)))]" help="Orders processed Today or planned for Today"/>
                    <field name="product_id"/>
                    <field name="name" string="Location" filter_domain="['|',('location_id','ilike',self),('location_dest_id','ilike',self)]"/>
                    <field name="partner_id" string="Partner"  filter_domain="[('picking_id.partner_id','child_of',self)]"/>
                    <group expand="0" string="Group By">
                        <filter string="Product" name="by_product" icon="terp-accessories-archiver" domain="[]"  context="{'group_by':'product_id'}"/>
                        <filter string="Picking" name="groupby_picking_id" icon="terp-accessories-archiver" domain="[]"  context="{'group_by':'picking_id'}"/>
                        <filter string="Source" name="groupby_location_id" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'location_id'}" groups="stock.group_locations"/>
                        <filter string="Destination" name="groupby_dest_location_id" icon="terp-gtk-jump-to-ltr" domain="[]" context="{'group_by':'location_dest_id'}" groups="stock.group_locations"/>
                        <filter icon="terp-stock_effects-object-colorize" string="Status" domain="[]" context="{'group_by':'state'}"/>
                        <filter string="Creation" name="groupby_create_date" icon="terp-go-month" domain="[]" context="{'group_by':'create_date'}" groups="base.group_no_one"/>
                        <filter string="Scheduled" name="groupby_date" icon="terp-go-month" domain="[]" context="{'group_by':'date_expected'}"/>
                    </group>
                </search>
            </field>
        </record>

        <record id="action_move_form2" model="ir.actions.act_window">
            <field name="name">Stock Moves</field>
            <field name="res_model">stock.move</field>
            <field name="type">ir.actions.act_window</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="view_move_tree"/>
            <field name="search_view_id" ref="view_move_search"/>
            <field name="context">{}</field>
            <field name="help" type="html">
              <p class="oe_view_nocontent_create">
                Click to create a stock movement.
              </p><p>
                This menu gives you the full traceability of inventory
                operations on a specific product. You can filter on the product
                to see all the past or future movements for the product.
              </p>
            </field>
        </record>
        
        <record model="ir.actions.act_window.view" id="action_stock_move_tree_all">
            <field name="sequence" eval="1"/>
            <field name="view_mode">tree</field>
            <field name="view_id" ref="view_move_tree"/>
            <field name="act_window_id" ref="action_move_form2"/>
        </record>

        <record model="ir.actions.act_window.view" id="action_stock_move_form_all">
            <field name="sequence" eval="3"/>
            <field name="view_mode">form</field>
            <field name="view_id" ref="view_move_form"/>
        <field name="act_window_id" ref="action_move_form2"/>
        </record>

        <record model="ir.actions.act_window.view" id="action_stock_move_graph_all">
            <field name="sequence" eval="3"/>
            <field name="view_mode">graph</field>
            <field name="view_id" ref="view_move_graph"/>
        <field name="act_window_id" ref="action_move_form2"/>
        </record>

        <menuitem action="action_move_form2" id="menu_action_move_form2" parent="menu_traceability" sequence="3" groups="stock.group_locations"/>

        <!--
            Receipt Picking (By Stock Move)
            From stock_partial_move_view
        -->
        <record id="view_move_tree_receipt_picking" model="ir.ui.view">
            <field name="name">stock.move.tree2</field>
            <field name="model">stock.move</field>
            <field name="priority" eval="6"/>
            <field name="arch" type="xml">
                <tree colors="grey:state == 'cancel'" string="Moves">
                    <field name="date" widget="date"/>
                    <field name="picking_id" string="Reference" invisible="1"/>
                    <field name="origin"/>
                    <field name="partner_id" string="Supplier"/>
                    <field name="product_id"/>
                    <field name="product_uom_qty"/>
                    <field name="product_uom" string="Unit of Measure" groups="product.group_uom"/>
                    <field name="location_id" invisible="1"/>
                    <field name="location_dest_id" invisible="1"/>
                    <field name="create_date" invisible="1"/>
                    <field name="date_expected" invisible="1"/>
                    <button name="%(stock.move_scrap)d"
                        string="Scrap Products" type="action"
                        icon="terp-gtk-jump-to-ltr" context="{'scrap': True}"
                        states="draft,waiting,confirmed,assigned"
                        groups="stock.group_stock_user"/>
                    <field name="state"/>
                    <button name="action_done" states="draft,assigned,confirmed"
                        icon="gtk-go-forward" type="object" groups="stock.group_stock_user"
                        class="oe_highlight" help="Done"/>
                </tree>
            </field>
        </record>

        <!-- test -->
        <record id="view_move_tree_receipt_picking_board" model="ir.ui.view">
            <field name="name">stock.move.tree3</field>
            <field name="model">stock.move</field>
            <field eval="6" name="priority"/>
            <field name="arch" type="xml">
                <tree string="Moves">
                    <field name="picking_id" string="Reference"/>
                    <field name="product_id"/>
                    <field name="product_uom_qty"/>
                    <field name="product_uom" string="Unit of Measure" groups="product.group_uom"/>
                    <field name="date" groups="base.group_no_one"/>
                </tree>
            </field>
        </record>

        <record id="action_receipt_picking_move" model="ir.actions.act_window">
            <field name="name">Incoming  Products</field>
            <field name="res_model">stock.move</field>
            <field name="type">ir.actions.act_window</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="domain" eval="[('picking_id.picking_type_id.code','=','incoming'), ('location_id.usage','!=','internal'), ('location_dest_id.usage', '=', 'internal')]"/>
            <field name="view_id" ref="view_move_tree_receipt_picking"/>
            <field name="context">{'product_receive': True, 'search_default_future': True}</field>
            <field name="help" type="html">
              <p class="oe_view_nocontent_create">
                Click to register a product receipt. 
              </p><p>
                Here you can receive individual products, no matter what
                purchase order or picking order they come from. You will find
                the list of all products you are waiting for. Once you receive
                an order, you can filter based on the name of the supplier or
                the purchase order reference. Then you can confirm all products
                received using the buttons on the right of each line.
              </p>
            </field>
        </record>

        <!-- Stock incoterms -->
        <record id="view_incoterms_tree" model="ir.ui.view">
            <field name="name">stock.incoterms.tree</field>
            <field name="model">stock.incoterms</field>
            <field name="arch" type="xml">
                <tree string="Incoterms">
                    <field name="code"/>
                    <field colspan="4" name="name"/>
                </tree>
            </field>
        </record>
        <record id="stock_incoterms_form" model="ir.ui.view">
            <field name="name">stock.incoterms.form</field>
            <field name="model">stock.incoterms</field>
            <field name="arch" type="xml">
                <form string="Incoterms">
                    <sheet>
                        <field name="name"/>
                        <field name="code"/>
                        <field name="active"/>
                    </sheet>
                </form>
            </field>
        </record>
        <record id="action_incoterms_tree" model="ir.actions.act_window">
            <field name="name">Incoterms</field>
            <field name="res_model">stock.incoterms</field>
            <field name="type">ir.actions.act_window</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
        </record>

        <menuitem action="action_incoterms_tree" id="menu_action_incoterm_open" parent="menu_stock_configuration" sequence="40"/>


         <record id="view_pickingtype_filter" model="ir.ui.view">
            <field name="name">stock.picking.type.filter</field>
            <field name="model">stock.picking.type</field>
            <field name="arch" type="xml">
                <search string="Picking Type">
                    <field name="name"/>
                    <field name="sequence_id"/>
                    <field name="warehouse_id"/>
                </search>
            </field>
        </record>
        <record model="ir.ui.view" id="view_picking_type_tree">
            <field name="name">Picking types</field>
            <field name="model">stock.picking.type</field>
            <field name="arch" type="xml">
                <tree string="Picking Types">
                    <field name="sequence" widget="handle"/>
                    <field name="name"/>
                    <field name="warehouse_id"/>
                    <field name="sequence_id"/>
                </tree>
            </field>
        </record>
        <record model="ir.ui.view" id="view_picking_type_form">
            <field name="name">Picking Types</field>
            <field name="model">stock.picking.type</field>
            <field name="arch" type="xml">
                <form string="Picking Types">
                    <sheet>
                        <group>
                            <group>
                                <field name="name"/>
                                <field name="sequence_id"/>
                                <field name="warehouse_id"/>
                            </group>
                            <group>
                                <field name="code" on_change="onchange_picking_code(code)"/>
                                <field name="return_picking_type_id"/>
                            </group>
                        </group>
                        <separator string="Locations"/>
                        <group>
                            <field name="default_location_src_id" attrs="{'required': [('code', '=', 'internal')]}"/>
                            <field name="default_location_dest_id" attrs="{'required': [('code', 'in', ('internal', 'incoming'))]}"/>
                        </group>
                    </sheet>
                </form>
            </field>
        </record>


        <record id="stock_picking_type_kanban" model="ir.ui.view">
            <field name="name">stock.picking.type.kanban</field>
            <field name="model">stock.picking.type</field>
            <field name="arch" type="xml">
                <kanban class="oe_background_grey" create="0">
                    <field name="complete_name"/>
                    <field name="color"/>
                    <field name="count_picking_ready"/>
                    <field name="count_picking_draft"/>
                    <field name="count_picking_waiting"/>
                    <field name="count_picking_late"/>
                    <field name="count_picking_backorders"/>
                    <templates>
                        <t t-name="kanban-box">
                            <div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_stock_picking_type">
                                <div class="oe_dropdown_toggle oe_dropdown_kanban" groups="stock.group_stock_manager">
                                    <span class="oe_e">í</span>
                                    <ul class="oe_dropdown_menu">
                                        <t t-if="widget.view.is_action_enabled('edit')"><li><a type="edit">Edit...</a></li></t>
                                        <t t-if="widget.view.is_action_enabled('delete')"><li><a type="delete">Delete</a></li></t>
                                        <t t-if="widget.view.is_action_enabled('edit')"><li><ul class="oe_kanban_colorpicker" data-field="color"/></li></t>
                                    </ul>
                                </div>
                                <div class="oe_kanban_content">
                                    <h4 class="text-center"><strong><field name="complete_name"/></strong></h4>
                                    <div class="oe_right">
                                        <a name="open_barcode_interface" type="object">
                                            <img src="/stock/static/src/img/scan.png"
                                                alt="Click to launch the barcode interface"
                                                class="oe_stock_scan_image" title="Click to launch the barcode interface"/>
                                        </a>
                                    </div>
                                    <div class="oe_items_list oe_kanban_ellipsis">
                                        <div>
                                            <a name="%(action_picking_tree_ready)d" type="action">
                                                <field name="count_picking_ready"/> Ready
                                            </a>
                                            <a name="%(action_picking_tree_done)d" type="action" class="oe_sparkline_bar_link">
                                                <field name="last_done_picking" widget="sparkline_bar" options="{'type': 'tristate', 'colorMap': {'0': 'orange', '-1': 'red', '1': 'green'}}">Last 10 Done Operations</field>
                                            </a>
                                        </div>
                                        <div t-if="record.count_picking_waiting.raw_value &gt; 0">
                                            <a name="%(action_picking_tree_waiting)d" type="action">
                                                <field name="count_picking_waiting"/> Waiting Availability
                                            </a>
                                        </div>
                                        <div>
                                            <a name="%(action_picking_tree)d" type="action">All Operations</a>
                                        </div>
                                    </div>
                                    <div class="oe_picking_type_gauge">
                                        <field name="rate_picking_late" widget="gauge" style="width:150px; height: 110px;" options="{'levelcolors': ['#a9d70b', '#f9c802', '#ff0000'], 'action_jump': '%(action_picking_tree_late)d'}">Late (%%)</field>
                                        <field name="rate_picking_backorders" widget="gauge" style="width:150px; height: 110px;">Backorders (%%)</field>
                                        <div class="oe_gauge_labels">
                                            <div class="oe_gauge_label_column">
                                                <a name="%(action_picking_tree_late)d" type="action">
                                                    <field name="count_picking_late"/> Late
                                                </a>
                                            </div>
                                            <div class="oe_gauge_label_column">
                                                <a name="%(action_picking_tree_backorder)d" type="action">
                                                    <field name="count_picking_backorders"/> Backorders
                                                </a>
                                            </div>
                                        </div>
                                    </div>

                                </div>
                            </div>
                        </t>
                    </templates>
                </kanban>
            </field>
        </record>

        <record id="action_picking_type_form" model="ir.actions.act_window">
            <field name="name">All Operations</field>
            <field name="res_model">stock.picking.type</field>
            <field name="type">ir.actions.act_window</field>
            <field name="view_type">form</field>
            <field name="view_mode">kanban,form</field>
            <field name="help" type="html">
              <p class="oe_view_nocontent_create">
                Click to create a new picking type. 
              </p><p>
                The picking type system allows you to assign each stock
                operation a specific type which will alter its views accordingly.  
                On the picking type you could e.g. specify if packing is needed by default, 
                if it should show the customer.  
              </p>
            </field>
        </record>
        
        <record id="action_picking_type_list" model="ir.actions.act_window">
            <field name="name">All Operations</field>
            <field name="res_model">stock.picking.type</field>
            <field name="type">ir.actions.act_window</field>
            <field name="view_type">form</field>
            <field name="view_mode">list,form</field>            
        </record>

        <menuitem
            action="action_picking_type_form"
            id="menu_action_picking_type_form"
            parent="menu_stock_warehouse_mgmt" sequence="1"/>

        <menuitem 
            id="menu_pickingtype" 
            name="Types of Operation" 
            parent="stock.menu_stock_configuration" 
            action="action_picking_type_list" />
        

        <!-- Order Point -->
        <record id="view_warehouse_orderpoint_tree" model="ir.ui.view">
            <field name="name">stock.warehouse.orderpoint.tree</field>
            <field name="model">stock.warehouse.orderpoint</field>
            <field name="arch" type="xml">
                <tree string="Reordering Rules">
                    <field name="name"/>
                    <field name="warehouse_id" groups="stock.group_locations"/>
                    <field name="location_id" groups="stock.group_locations"/>
                    <field name="product_id"/>
                    <field name="product_uom" groups="product.group_uom"/>
                    <field name="product_min_qty"/>
                    <field name="product_max_qty"/>
                </tree>
            </field>
        </record>

        <record model="ir.ui.view" id="warehouse_orderpoint_search">
            <field name="name">stock.warehouse.orderpoint.search</field>
            <field name="model">stock.warehouse.orderpoint</field>
            <field name="arch" type="xml">
                <search string="Reordering Rules Search">
                    <field name="name" string="Reordering Rules"/>
                    <field name="warehouse_id"/>
                    <field name="location_id" groups="stock.group_locations"/>
                    <field name="company_id" groups="base.group_multi_company"/>
                    <field name="product_id"/>
                    <group expand="0" string="Group By">
                        <filter string="Warehouse" icon="terp-go-home" domain="[]"  context="{'group_by':'warehouse_id'}"/>
                        <filter string="Location" icon="terp-go-home" domain="[]" context="{'group_by':'location_id'}"/>
                    </group>
                </search>
            </field>
        </record>

        <record id="view_warehouse_orderpoint_form" model="ir.ui.view">
            <field name="name">stock.warehouse.orderpoint.form</field>
            <field name="model">stock.warehouse.orderpoint</field>
            <field name="arch" type="xml">
                <form string="Reordering Rules">
                    <sheet>
                        <div class="oe_right oe_button_box">
                            <button name="action_view_proc_to_process" type="object" string="Procurement Orders to Process"/>                            
                        </div>
                        <group>
                            <group>
                                <field name="name" />
                                <field name="product_id" on_change="onchange_product_id(product_id)"/>
                            </group>
                            <group>
                                <field name="warehouse_id" on_change="onchange_warehouse_id(warehouse_id)" widget="selection" groups="stock.group_locations"/>
                                <field name="product_uom" groups="product.group_uom"/>
                                <field name="location_id" groups="stock.group_locations"/>
                                <field name="group_id" groups="stock.group_adv_location"/>
                                <field name="company_id" groups="base.group_multi_company" widget="selection"/>
                            </group>
                        </group>
                        <group>
                            <group string="Rules">
                                <field name="product_min_qty" />
                                <field name="product_max_qty" />
                                <field name="qty_multiple" string="Quantity Multiple"/>
                            </group>
                            <group string="Misc">
                                <field name="active" />
                            </group>
                        </group>                        
                    </sheet>
                </form>
            </field>
        </record>

        <record id="action_orderpoint_form" model="ir.actions.act_window">
            <field name="name">Reordering Rules</field>
            <field name="res_model">stock.warehouse.orderpoint</field>
            <field name="type">ir.actions.act_window</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="view_warehouse_orderpoint_tree"/>
            <field name="search_view_id" ref="warehouse_orderpoint_search" />
            <field name="help" type="html">
              <p class="oe_view_nocontent_create">
                Click to add a reordering rule.
              </p><p>You can define your minimum stock rules, so that Odoo will automatically create draft manufacturing orders or request for quotations according to the stock level. Once the virtual stock of a product (= stock on hand minus all confirmed orders and reservations) is below the minimum quantity, Odoo will generate a procurement request to increase the stock up to the maximum quantity.</p>
            </field>
        </record>

        <act_window
            context="{'search_default_warehouse_id': active_id, 'default_warehouse_id': active_id}"
            id="act_stock_warehouse_2_stock_warehouse_orderpoint"
            name="Reordering Rules"
            res_model="stock.warehouse.orderpoint"
            src_model="stock.warehouse"
            groups="stock.group_stock_user"/>

        <!-- Procurements -->

        <record id="view_procurement_form_stock_inherit" model="ir.ui.view">
            <field name="name">procurement.order.form.stock.inherit</field>
            <field name="model">procurement.order</field>
            <field name="inherit_id" ref="procurement.procurement_form_view"/>
            <field name="arch" type="xml">
                <xpath expr="//group[@name='scheduling']" position="before">
                    <group>
                        <field name="warehouse_id" on_change="change_warehouse_id(warehouse_id, context)"/>
                        <field name="location_id" domain="[('usage', '=', 'internal')]"/>
                        <field name="route_ids" widget="many2many_tags"/>
                    </group>
                </xpath>
                <xpath expr="//div[@name='button_box']" position="inside">
                    <button name="do_view_pickings" string="Group's Pickings" type="object"/>
                </xpath>
                <xpath expr="//field[@name='rule_id']" position="replace">
                    <field name="rule_id" domain="['|', ('location_id', '=', False), ('location_id', '=', location_id)]"/>
                    <field name="partner_dest_id"/>
                </xpath>
            </field>
        </record>
        <record id="view_procurement_tree_stock_inherit" model="ir.ui.view">
            <field name="name">procurement.order.tree.stock.inherit</field>
            <field name="model">procurement.order</field>
            <field name="inherit_id" ref="procurement.procurement_tree_view"/>
            <field name="arch" type="xml">
                <xpath expr="//field[@name='origin']" position="before">
                    <field name="location_id"/>
                </xpath>
            </field>
        </record>
        <record id="view_procurement_rule_tree_stock_inherit" model="ir.ui.view">
            <field name="name">procurement.rule.tree.stock.inherit</field>
            <field name="model">procurement.rule</field>
            <field name="inherit_id" ref="procurement.view_procurement_rule_tree"/>
            <field name="arch" type="xml">
                <xpath expr="//field[@name='action']" position="after">
                    <field name="picking_type_id"/>
                </xpath>
            </field>
        </record>

        <record id="view_procurement_rule_form_stock_inherit" model="ir.ui.view">
            <field name="name">procurement.rule.form.stock.inherit</field>
            <field name="model">procurement.rule</field>
            <field name="inherit_id" ref="procurement.view_procurement_rule_form"/>
            <field name="arch" type="xml">
                <xpath expr="//field[@name='action']" position="before">
                    <field name="location_id"/>
                    <field name="warehouse_id" groups="base.group_no_one"/>
                    <field name="route_id" groups="base.group_no_one"/>
                </xpath>
                <xpath expr="//field[@name='action']" position="after">
                    <field name="picking_type_id" attrs="{'required': [('action', '!=', 'manufacture')]}"/>
                </xpath>
                <xpath expr="//field[@name='group_id']" position="after">
                    <field name="propagate"/>
                    <field name="propagate_warehouse_id"/>
                </xpath>
                <xpath expr="//group[@name='propagation_group']" position="before">
                    <group attrs="{'invisible': [('action', '!=', 'move')]}" string="Moving Options">
                        <field name="procure_method" groups="stock.group_adv_location"/>
                        <field name="location_src_id" attrs="{'required': [('action', '=', 'move')]}"  domain="[('usage','!=','view')]" />
                        <field name="partner_address_id" groups="stock.group_adv_location" context="{'show_address': 1}" options="{'always_reload': 1}"/>
                        <label for="delay" string="Delay"  groups="stock.group_adv_location"/>
                        <div groups="stock.group_adv_location">
                           <field name="delay" class="oe_inline"/>days
                        </div>
                    </group>
                </xpath>
            </field>
        </record>
        
        <record model="ir.actions.act_window" id="procrules">
            <field name="context">{}</field>
            <field name="name">Pull Rules</field>
            <field name="res_model">procurement.rule</field>
        </record>
        
        <record id="quant_search_view" model="ir.ui.view">
            <field name="name">stock.quant.search</field>
            <field name="model">stock.quant</field>
            <field eval="10" name="priority"/>
            <field name="arch" type="xml">
                <search string="Quants">
                    <field name="product_id"/>
                    <field name="location_id"/>
                    <field name="package_id" groups="stock.group_tracking_lot"/>
                    <field name="lot_id" groups="stock.group_production_lot"/>
                    <field name="owner_id" groups="stock.group_tracking_owner"/>
                    <group expand='0' string='Filters'>
                        <filter name='internal_loc' string="Internal Locations" domain="[('location_id.usage','=', 'internal')]"/>
                    </group>
                    <group expand='0' string='Group by...'>
                       <filter name="productgroup" string='Product' context="{'group_by' : 'product_id'}"/>
                       <filter string='Owner' context="{'group_by' : 'owner_id'}" groups="stock.group_tracking_owner"/>
                       <filter string='Lot' context="{'group_by' : 'lot_id'}" groups="stock.group_production_lot"/>
                       <filter name="locationgroup" string='Location' icon="terp-stock_symbol-selection" domain="[]" context="{'group_by' : 'location_id'}"/>
                       <filter string='Package' icon="terp-stock_symbol-selection" domain="[]" context="{'group_by' : 'package_id'}" groups="stock.group_tracking_lot"/>
                       <filter string='Packaging' icon="terp-stock_symbol-selection" domain="[]" context="{'group_by' : 'packaging_type_id'}" groups="stock.group_tracking_lot"/>
                       <filter string='Company' icon="terp-go-home" domain="[]" context="{'group_by' : 'company_id'}" groups="base.group_multi_company"/>
                   </group>
                </search>
            </field>
        </record>
        
        <record model="ir.actions.act_window" id="quantsact">
            <field name="name">Quants</field>
            <field name="res_model">stock.quant</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form,graph</field>
            <field name="help">This analysis gives you a fast overview on the current stock level of your products and their today's inventory value.</field>
        </record>

        <record model="ir.ui.view" id="view_stock_quant_form">
            <field name="name">stock.quant.form</field>
            <field name="model">stock.quant</field>
            <field eval="10" name="priority"/>
            <field name="arch" type="xml">
                <form string="Quants" create="false" edit="false">
                    <div class="oe_right oe_button_box">
                        <button name="action_view_quant_history" type="object" string="Quant History"/>                            
                    </div>
                    <group>
                        <field name="product_id"/>
                        <field name="qty"/>
                        <field name="lot_id" groups="stock.group_production_lot"/>
                        <field name="package_id" groups="stock.group_tracking_lot"/>
                        <field name="location_id"/>
                        <field name="in_date"/>
                        <field name="reservation_id"/>
                        <field name="propagated_from_id"/>
                        <field name="owner_id" groups="stock.group_tracking_owner"/>
                        <field name="inventory_value"/>
                    </group>
                </form>
            </field>
        </record>


        <record model="ir.ui.view" id="view_stock_quant_tree">
            <field name="name">stock.quant.tree</field>
            <field name="model">stock.quant</field>
            <field eval="10" name="priority"/>
            <field name="arch" type="xml">
                <tree string="Quants" create="0">
                    <field name="product_id"/>
                    <field name="qty"/>
                    <field name="location_id"/>
                    <field name="owner_id" groups="stock.group_tracking_owner"/>
                    <field name="lot_id" groups="stock.group_production_lot"/>
                    <field name="package_id" groups="stock.group_tracking_lot"/>
                    <field name="packaging_type_id" invisible="1"/>
                    <field name="in_date"/>
                    <field name="inventory_value"/>
                    <field name="reservation_id" invisible='1'/>
                    <field name="propagated_from_id" invisible='1'/>
                    <field name='company_id' groups="base.group_multi_company"/>
                </tree>
            </field>
        </record>

       <record model="ir.ui.view" id="view_stock_quant_graph_value">
            <field name="name">stock.quant.graph</field>
            <field name="model">stock.quant</field>
            <field eval="12" name="priority"/>
            <field name="arch" type="xml">
                <graph string="Quants">
                    <field name="product_id"/>
                    <field name="qty"/>
                    <field name="location_id"/>
                </graph>
            </field>
        </record>

        <!-- Procurements are located in Warehouse menu hierarchy, MRP users should come to Stock application to use it.  -->
        <menuitem id="menu_stock_sched" name="Schedulers" parent="stock.menu_stock_root" sequence="4" groups="stock.group_stock_manager"/>
        <menuitem action="action_procurement_compute" id="menu_procurement_compute" parent="menu_stock_sched" groups="base.group_no_one"/>
        <menuitem action="procurement.action_compute_schedulers" id="menu_stock_proc_schedulers" parent="menu_stock_sched" sequence="20" groups="stock.group_stock_manager"/>
        <menuitem action="procurement.procurement_exceptions" id="menu_stock_procurement_action" parent="menu_stock_sched" sequence="50" groups="stock.group_stock_manager"/>
        <menuitem id="menu_stock_procurement" name="Automatic Procurements" parent="stock.menu_stock_configuration" sequence="5"/>
        <menuitem action="action_orderpoint_form" id="menu_stock_order_points" parent="stock.menu_stock_configuration" sequence="10"/>
        <menuitem id="stock.next_id_61" name="Warehouse" sequence="15" parent="base.menu_reporting" groups="group_stock_manager"/>
        <menuitem id="menu_quants" name="Quants" parent="menu_traceability" sequence="20" action="quantsact" groups="base.group_no_one"/>
        <menuitem id="menu_procurement_rules" name="Procurement Rules" parent="stock.menu_stock_configuration" action="procrules" groups="base.group_no_one"/>
        <menuitem id="menu_pickingtype" name="Types of Operation" parent="stock.menu_stock_configuration" action="action_picking_type_list"/>


        <record model="ir.actions.act_window" id="product_open_orderpoint">
            <field name="context">{'default_product_id': active_id, 'search_default_product_id': active_id}</field>
            <field name="name">Reordering Rules</field>
            <field name="res_model">stock.warehouse.orderpoint</field>
        </record>
        
        <record model="ir.actions.act_window" id="product_open_quants">
            <field name="context">{'search_default_internal_loc': 1, 'search_default_product_id': active_id, 'search_default_locationgroup':1}</field>
            <field name="name">Current Stock</field>
            <field name="res_model">stock.quant</field>
        </record>
        
        <record model="ir.ui.view" id="view_quant_package_form">
            <field name="name">stock.quant.package.form</field>
            <field name="model">stock.quant.package</field>
            <field eval="10" name="priority"/>
            <field name="arch" type="xml">
                <form string="Package">
                    <sheet>
                        <div class="oe_right oe_button_box">
                            <button name="unpack" string="Unpack" type="object"/>
                        </div>
                        <div class="oe_title">
                            <label for="name" string="Package Reference" class="oe_edit_only"/>
                            <h1><field name="name" class="oe_inline"/></h1>
                        </div>
                        <group>
                            <group>
                               <field name="ul_id"/>
                               <field name="packaging_id"/>
                               <field name='company_id' groups="base.group_multi_company"/>
                               <field name='owner_id' groups="stock.group_tracking_owner"/>
                            </group>
                            <group>
                            <field name="location_id"/>
                            <field name="parent_id"/>
                            </group>
                        </group>
                        <notebook>
                            <page string="Content">
                                <separator string="Bulk Content" />
                                <field name="quant_ids">
                                    <tree string="Quants">
                                        <field name="product_id"/>
                                        <field name="qty"/>
                                        <field name="location_id"/>
                                        <field name="in_date"/>
                                    </tree>
                                </field>

                                <div class="oe_right oe_button_box" style="margin-top: 10px">
                                    <button name="get_content_package" type="object" string="View Contained Packages content" icon="gtk-execute" attrs="{'invisible': [('children_ids','=',[])]}"/>
                                </div>
                                <separator string="Contained Packages"/>
                                <field name="children_ids">
                                    <tree string="Contained Packages">
                                        <field name="complete_name"/>
                                        <field name="ul_id"/>
                                        <field name="packaging_id"/>
                                        <field name="location_id"/>
                                    </tree>
                                </field>
                            </page>
                        </notebook> 
                    </sheet>
                </form>
            </field>
        </record>
        
        
        <record model="ir.ui.view" id="view_quant_package_tree">
            <field name="name">stock.quant.package.tree</field>
            <field name="model">stock.quant.package</field>
            <field eval="10" name="priority"/>
            <field name="arch" type="xml">
                <tree string="Package">
                    <field name="complete_name"/>
                    <field name="ul_id"/>
                    <field name="packaging_id"/>
                    <field name="location_id"/>
                    <field name="company_id"/>
                </tree>
            </field>
        </record>
        <record id="quant_package_search_view" model="ir.ui.view">
            <field name="name">stock.quant.package.search</field>
            <field name="model">stock.quant.package</field>
            <field eval="10" name="priority"/>
            <field name="arch" type="xml">
                <search string="Package">
                    <field name="name" string="Package Name"/>
                    <field name="location_id"/>
                    <field name="ul_id"/>
                    <field name="packaging_id"/>
                    <group  expand='0' string='Group by...'>
                       <filter string='Location' icon="terp-stock_symbol-selection" domain="[]" context="{'group_by' : 'location_id'}"/>
                       <filter string='Packaging' icon="terp-stock_symbol-selection" domain="[]" context="{'group_by' : 'packaging_id'}"/>
                       <filter string='Company' icon="terp-go-home" domain="[]" context="{'group_by' : 'company_id'}" groups="base.group_multi_company"/>
                   </group>
                </search>
            </field>
        </record>
        <record model="ir.actions.act_window" id="action_package_view">
            <field name="context">{}</field>
            <field name="name">Packages</field>
            <field name="res_model">stock.quant.package</field>
            <field name="help" type="html">
                <p>Packages are usually created by pack operations made on transfers and can contains several different products. You can then reuse a package to move its whole content somewhere else, or to pack it into another bigger package. A package can also be unpacked, allowing the disposal of its former content as single units again.
                </p>
            </field>
        </record>
        <menuitem id="menu_package" name="Packages" parent="menu_stock_product" action="action_package_view" groups="stock.group_tracking_lot"/>
        
        
        <!--Routes-->
        <record id="stock_location_route_tree" model="ir.ui.view">
            <field name="name">stock.location.route.tree</field>
            <field name="model">stock.location.route</field>
            <field name="arch" type="xml">
                <tree string="Routes">
                    <field name="sequence" widget="handle" />
                    <field name="name"/>
                </tree>
            </field>
        </record>

        <record id="stock_location_route_form_view" model="ir.ui.view">
            <field name="name">stock.location.route.form</field>
            <field name="model">stock.location.route</field>
            <field eval="7" name="priority" />
            <field name="arch" type="xml">
                <form string="Route">
                    <sheet>
                        <div class="oe_title">
                            <label for="name" class="oe_edit_only"/>
                            <h1><field name="name"/></h1>
                        </div>
                    <group>
                        <group>
                            <field name="company_id" groups="base.group_multi_company" widget="selection"/>
                            <field name="active" groups="stock.group_adv_location" />
                        </group>
                        <group>
                            <field name="sequence" string="Sequence" groups="base.group_no_one"/>
                        </group>
                    </group>
                    <separator string="Applicable On"/>
                    <p class="oe_grey">Select the places where this route can be selected</p>
                    <group>
                        <group>
                            <field name="product_categ_selectable" string="Product Categories"/>
                            <field name="product_selectable" string="Products"/>
                        </group>
                        <group>
                            <field name="warehouse_selectable" string="Warehouses"/>
                        </group>
                    </group>
                    <group string="Push Rules" colspan="4" >
                        <field name="push_ids" colspan="4" nolabel="1"/>
                    </group>
                    <group string="Pull Rules" colspan="4" >
                        <field name="pull_ids" colspan="4" nolabel="1"/>
                    </group>
                    </sheet>
                </form>
            </field>
        </record>
        
        <record id="action_routes_form" model="ir.actions.act_window">
            <field name="name">Routes</field>
            <field name="res_model">stock.location.route</field>
            <field name="type">ir.actions.act_window</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="view_id" ref="stock_location_route_tree" />
            <field name="help" type="html">
                <p class="oe_view_nocontent_create">
                    Click to add a route.
              </p>
                <p>You can define here the main routes that run through
                    your warehouses and that define the flows of your products. These
                    routes can be assigned to a product, a product category or be fixed
                    on procurement or sales order. </p>
            </field>
        </record>
        
        <menuitem action="action_routes_form" id="menu_stock_routes"
            parent="stock.menu_stock_configuration" sequence="11" />

        <record id="do_view_pickings" model="ir.actions.act_window">
            <field name="name">Pickings for Groups</field>
            <field name="res_model">stock.picking</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
        <field name="domain">[('group_id','=',active_id)]</field>
        </record>
        <record id="procurement_group_form_view_herited" model="ir.ui.view">
            <field name="name">procurement.group.form.herited</field>
            <field name="model">procurement.group</field>
            <field name="inherit_id" ref="procurement.procurement_group_form_view"/>
            <field name="arch" type="xml">
                <xpath expr="//div[@name='button_box']" position="inside">
                    <button name="%(do_view_pickings)d" string="Pickings" type="action"/>
                </xpath>
            </field>
        </record>
        
    </data>
</openerp>
