<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <menuitem groups="base.group_extended" id="prod_config_main" name="Product" parent="base.menu_base_config" sequence="9"/>

        <record id="product_search_form_view" model="ir.ui.view">
            <field name="name">product.search.form</field>
            <field name="model">product.product</field>
            <field name="type">search</field>
            <field name="arch" type="xml">
                <search string="Product">
                   <filter string="Services" icon="terp-accessories-archiver" domain="[('type','=','service')]"/>
		   <filter icon="terp-accessories-archiver" string="Consumable"
                        domain="[('type','=', 'consumable')]"/>                   
                   <filter string="Stockable" icon="terp-accessories-archiver" domain="['|',('type','=','product'),('type','=','consu')]"/>
                   <separator orientation="vertical"/>
                   <filter string="To Sell" icon="terp-accessories-archiver-minus" domain="[('sale_ok','=',1)]"/>
                   <filter string="To Purchase" icon="terp-accessories-archiver+" domain="[('purchase_ok', '=', 1)]" />
                   <separator orientation="vertical"/>
                   <field name="default_code"/>
                   <field name="name"/>
                   <field name="categ_id" widget="selection" operator="child_of"/>
                   <newline/>
                   <group expand="0" string="Extended Filters..." groups="base.group_extended">
                       <field name="pricelist_id" widget="selection" context="{'pricelist': self}" />
                   </group>
                   <newline/>
                   <group  expand='0' string='Group by...' groups="base.group_extended">
                       <filter string='Category' icon="terp-stock_symbol-selection" domain="[]" context="{'group_by' : 'categ_id'}" />
                       <separator orientation="vertical"/>
                       <filter string='Default UOM' icon="terp-mrp" domain="[]" context="{'group_by' : 'uom_id'}" />
                       <separator orientation="vertical"/>
                       <filter string='Type' icon="terp-stock_symbol-selection" domain="[]" context="{'group_by' : 'type'}" />
                   </group>
                   
                </search>
            </field>
        </record>

        <record id="product_product_tree_view" model="ir.ui.view">
            <field name="name">product.product.tree</field>
            <field name="model">product.product</field>
            <field name="type">tree</field>
            <field eval="7" name="priority"/>
            <field name="arch" type="xml">
                <tree colors="red:virtual_available&lt;0;blue:virtual_available&gt;=0 and state in ('draft', 'end', 'obsolete');black:virtual_available&gt;=0 and state not in ('draft', 'end', 'obsolete')" string="Products">
                    <field name="default_code"/>
                    <field name="name"/>
                    <field name="categ_id" invisible="1"/>
                    <field name="variants" groups="product.group_product_variant"/>
                    <field name="uom_id" string="UoM"/>
                    <field name="type"/>
                    <field name="qty_available"/>
                    <field name="virtual_available"/>
                    <field name="lst_price"/>
                    <field name="standard_price"/>
                    <field name="price" invisible="not context.get('pricelist',False)"/>
                    <field name="state"/>
                </tree>
            </field>
        </record>
        <record id="product_normal_form_view" model="ir.ui.view">
            <field name="name">product.normal.form</field>
            <field name="model">product.product</field>
            <field name="type">form</field>
            <field eval="7" name="priority"/>
            <field name="arch" type="xml">
                <form string="Product">
                   <group colspan="4" col="6">
                    <group colspan="4" col="2">
                        <separator string="Name" colspan="2"/>
                        <field name="name"/>
                        <field groups="product.group_product_variant" name="variants" />
                    </group>
                    <group colspan="1" col="2">
                        <separator string="Codes" colspan="2"/>
                        <field name="default_code"/>
                        <field name="ean13" groups="base.group_extended"/>
                    </group>
                    <group colspan="1" col="2">
                        <separator string="Characteristics" colspan="2"/>
                        <field name="sale_ok"/>
                        <field name="purchase_ok"/>
                    </group>
                   </group>

                    <notebook colspan="4">
                        <page string="Information">
                            <group colspan="2" col="2">
                                <separator string="Procurement" colspan="2"/>
                                <field name="type"/>
                                <field name="procure_method"/>
                                <field name="supply_method"/>
                            </group>

                            <group colspan="2" col="2" groups="base.group_extended">
                                <separator string="Weigths" colspan="2"/>
                                <field digits="(14, 3)" name="volume" attrs="{'readonly':[('type','=','service')]}"/>
                                <field digits="(14, 3)" name="weight" attrs="{'readonly':[('type','=','service')]}"/>
                                <field digits="(14, 3)" name="weight_net" attrs="{'readonly':[('type','=','service')]}"/>
                            </group>

                            <group colspan="2" col="2" name="status">
                                <separator string="Status" colspan="2"/>
                                <field name="categ_id" select="1"/>
                                <field name="state"/>
                                <field groups="base.group_extended" name="product_manager"/>
                            </group>

                            <group colspan="2" col="2" name="uom">
                                <separator string="Unit of Measure" colspan="2"/>
                                <field name="uom_id" on_change="onchange_uom(uom_id,uom_po_id)" widget="selection"/>
                                <field name="uom_po_id" widget="selection"/>
                            </group>

                            <group colspan="2" col="2" name="uos" groups="product.group_uos">
                                <separator string="Second UoM" colspan="2"/>
                                <field name="uos_id"/>
                                <field name="uos_coeff"/>
                                <field name="mes_type"/>
                            </group>

                        </page>
                        <page string="Procurement &amp; Locations">
                            <group colspan="2" col="2" name="delay">
                                <separator string="Delays" colspan="2"/>
                                <field name="sale_delay" attrs="{'readonly':[('sale_ok','=',0)]}"/>
                                <field name="produce_delay"/>
                                <field name="warranty"/>
                            </group>
                            <group colspan="2" col="2" name="store">
                                <separator string="Storage Localisation" colspan="2"/>
                                <field name="loc_rack" attrs="{'readonly':[('type','=','service')]}" />
                                <field name="loc_row" attrs="{'readonly':[('type','=','service')]}"/>
                                <field name="loc_case" attrs="{'readonly':[('type','=','service')]}"/>
                            </group>

                            <group colspan="2" col="2" name="misc" groups="base.group_extended">
                                <separator string="Miscellaneous" colspan="2"/>
                                <field name="active"/>
                                <field name="company_id" groups="base.group_multi_company" widget="selection"/>
                            </group>

                        </page>
                        <page string="Prices &amp; Suppliers">
                            <separator string="Base Prices" colspan="4"/>
                            <field name="standard_price" attrs="{'readonly':[('cost_method','=','average')]}"/>
                            <field name="list_price"/>
                            <newline/>
                            <field name="price_margin" groups="base.group_extended"/>
                            <field name="price_extra" groups="base.group_extended"/>
                            <newline/>
                            <field groups="base.group_extended" name="cost_method"/>
                            <newline/>
                            <field groups="base.group_extended" name="seller_id"/>
                            <newline/>
                            <field colspan="4" name="seller_ids" nolabel="1"/>
                        </page>
                        <page string="Descriptions">
                            <separator string="Description"/>
                            <field colspan="4" name="description" nolabel="1"/>
                            <separator string="Sale Description"/>
                            <field colspan="4" name="description_sale" nolabel="1"/>
                            <separator string="Purchase Description"/>
                            <field colspan="4" name="description_purchase" nolabel="1"/>
                        </page>
                        <page groups="base.group_extended" string="Packaging">
                            <field colspan="4" name="packaging" nolabel="1">
                                <form string="Packaging">
                                    <field name="ean"/>
                                    <field name="sequence" invisible="1"/>
                                    <newline/>
                                    <field name="qty"/>
                                    <field name="ul"/>
                                    <field name="weight_ul"/>
                                    <separator colspan="4" string="Palletization"/>
                                    <field name="ul_qty"/>
                                    <field name="rows"/>
                                    <field name="weight"/>
                                    <separator colspan="4" string="Pallet Dimension"/>
                                    <field name="height"/>
                                    <field name="width"/>
                                    <field name="length"/>
                                    <separator colspan="4" string="Description"/>
                                    <field colspan="4" name="name" nolabel="1"/>
                                </form>
                            </field>
                        </page>
                    </notebook>
                </form>
            </field>
        </record>
        <record id="product_normal_action" model="ir.actions.act_window">
            <field name="name">Products</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">product.product</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="product_product_tree_view"/>
            <field name="search_view_id" ref="product_search_form_view"/>
            <field name="help">In OpenERP, a product is something you can buy and sell. It can be a raw material, a stockable product, a consumable or a service. The product form contains a detailed information on the products like procurement logistic, sales price, product category, suppliers, etc.</field>
        </record>
        <menuitem icon="terp-partner" id="base.menu_base_partner" name="Sales" sequence="0" groups="base.group_system,group_product_manager"/>

        <menuitem id="base.menu_product" name="Products" parent="base.menu_base_partner" sequence="9" groups="group_product_manager,base.group_sale_salesman,base.group_system"/>
        <menuitem action="product.product_normal_action" id="product.menu_products" parent="base.menu_product" sequence="1" groups="base.group_sale_salesman,base.group_sale_manager,base.group_system,group_product_manager"/>

        <record id="product_normal_action_puchased" model="ir.actions.act_window">
            <field name="name">Products</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">product.product</field>
            <field name="view_type">form</field>
            <field name="domain">[('purchase_ok','=',1)]</field>
            <field name="view_id" ref="product_product_tree_view"/>
            <field name="search_view_id" ref="product_search_form_view"/>
        </record>

        <record id="product_category_form_view" model="ir.ui.view">
            <field name="name">product.category.form</field>
            <field name="model">product.category</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Product Categories">
                    <field name="name" select="1"/>
                    <field name="parent_id"/>
                    <field name="sequence" invisible="1"/>
                    <field name="type"/>
                    <newline/>
                </form>
            </field>
        </record>
        <record id="product_category_list_view" model="ir.ui.view">
            <field name="name">product.category.list</field>
            <field name="model">product.category</field>
            <field name="type">tree</field>
            <field name="priority">1</field>
            <field name="arch" type="xml">
                <tree string="Product Categories">
                    <field name="complete_name"/>
                </tree>
            </field>
        </record>
        <record id="product_category_tree_view" model="ir.ui.view">
            <field name="name">product.category.tree</field>
            <field name="model">product.category</field>
            <field name="type">tree</field>
            <field name="field_parent">child_id</field>
            <field name="arch" type="xml">
                <tree toolbar="True" string="Product Categories">
                    <field name="name"/>
                </tree>
            </field>
        </record>
        <record id="product_category_action" model="ir.actions.act_window">
            <field name="name">Products by Category</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">product.category</field>
            <field name="domain">[('parent_id','=',False)]</field>
            <field name="view_type">tree</field>
            <field name="view_id" ref="product_category_tree_view"/>
            <field name="help">Products category opens a tree structure view of your products by category.</field>
        </record>
        <menuitem
            action="product_category_action"
            id="product.menu_products_category"
            parent="base.menu_product"
            sequence="0"/>
        <record id="product_category_action_form" model="ir.actions.act_window">
            <field name="name">Products Categories</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">product.category</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="product_category_list_view"/>
        </record>
        <menuitem action="product_category_action_form"
            groups="base.group_extended"
            id="menu_product_category_action_form"
            parent="prod_config_main" sequence="2"/>


        <record id="product_normal_action_tree" model="ir.actions.act_window">
            <field name="name">Products</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">product.product</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="domain">[('categ_id','child_of',[active_id])]</field>
            <field name="context">{'categ_id':active_id}</field>
        </record>
        <record id="ir_product_category_open" model="ir.values">
            <field eval="'tree_but_open'" name="key2"/>
            <field eval="'product.category'" name="model"/>
            <field name="name">Products by Categories</field>
            <field eval="'ir.actions.act_window,%d'%product_normal_action_tree" name="value"/>
            <field eval="True" name="object"/>
        </record>


        <!-- Unit of Measure -->

        <record id="product_uom_tree_view" model="ir.ui.view">
            <field name="name">product.uom.tree</field>
            <field name="model">product.uom</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Units of Measure">
                    <field name="name"/>
                    <field name="category_id"/>
                    <field name="uom_type"/>
                    <field name="factor"/>
                    <field name="rounding"/>
                </tree>
            </field>
        </record>

        <record id="product_uom_form_view" model="ir.ui.view">
            <field name="name">product.uom.form</field>
            <field name="model">product.uom</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Units of Measure">
                    <group col="6" colspan="4">
                        <group col="2"  colspan="2">
                            <separator string="Unit of Measure Properties" colspan="4"/>
                            <field name="name" select="1"/>
                            <field name="category_id" select="1" widget="selection"/>
                            <field name="active"/>
                        </group>
                        <group col="4"  colspan="4">
                            <separator string="Ratio &amp; Precision" colspan="4"/>
                            <group colspan="2" col="2">
                                 <field name="uom_type" on_change="onchange_type(uom_type)"/>
                                 <field name="rounding"/>
                            </group>
                            <group colspan="2" col="2">
                                  <group col="2" colspan="2" attrs="{'invisible':[('uom_type','!=','smaller')]}">
                                        <field name="factor"/>
                                        <label colspan="2" string="  e.g: 1 * (reference unit) = ratio * (this unit)"/>
                                   </group>
                                   <group col="2" colspan="2" attrs="{'invisible':[('uom_type','!=','bigger')]}">
                                        <field name="factor_inv"/>
                                        <label colspan="2"  string="  e.g: 1 * (this unit) = ratio * (reference unit)"/>
                                   </group>
                            </group>
                        </group>
                    </group>
                </form>
            </field>
        </record>
        <record id="product_uom_form_action" model="ir.actions.act_window">
            <field name="name">Units of Measure</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">product.uom</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="product_uom_tree_view"/>
        </record>
        <menuitem id="next_id_16" name="Units of Measure" parent="prod_config_main" sequence="65"/>
        <menuitem action="product_uom_form_action" id="menu_product_uom_form_action" parent="next_id_16"/>

        <record id="product_uom_categ_form_view" model="ir.ui.view">
            <field name="name">product.uom.categ.form</field>
            <field name="model">product.uom.categ</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Units of Measure categories">
                    <field colspan="4" name="name" select="1"/>
                </form>
            </field>
        </record>
        <record id="product_uom_categ_form_action" model="ir.actions.act_window">
            <field name="name">Units of Measure Categories</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">product.uom.categ</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
        </record>
        <menuitem action="product_uom_categ_form_action" id="menu_product_uom_categ_form_action" parent="product.next_id_16" sequence="5"/>

        <record id="product_ul_form_view" model="ir.ui.view">
            <field name="name">product.ul.form.view</field>
            <field name="model">product.ul</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Packaging">
                    <field name="name" select="1" />
                    <field name="type" select="1" />
                </form>
            </field>
        </record>
        <record id="product_ul_tree" model="ir.ui.view">
            <field name="name">product.ul.tree</field>
            <field name="model">product.ul</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Packaging">
                    <field name="name" select="1"/>
                    <field name="type" select="1"/>
                </tree>
            </field>
        </record>
        <record id="product_ul_form_action" model="ir.actions.act_window">
            <field name="name">Packaging</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">product.ul</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
        </record>
        <menuitem
            action="product_ul_form_action" groups="base.group_extended" id="menu_product_ul_form_action" parent="prod_config_main" sequence="3"/>

        <record id="product_packaging_tree_view" model="ir.ui.view">
            <field name="name">product.packaging.tree.view</field>
            <field name="model">product.packaging</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Packaging">
                    <field name="sequence" invisible="1"/>
                    <field name="ean"/>
                    <field name="qty"/>
                    <field name="ul"/>
                </tree>
            </field>
        </record>

        <record id="product_packaging_form_view" model="ir.ui.view">
            <field name="name">product.packaging.form.view</field>
            <field name="model">product.packaging</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Packaging">
                    <field name="product_id" select="1"/>
                    <newline/>
                    <field name="ean" select="1"/>
                    <field name="sequence" invisible="1"/>
                    <newline/>
                    <field name="qty" select="1"/>
                    <field name="ul"/>
                    <field name="weight_ul"/>
                    <separator colspan="4" string="Palletization"/>
                    <field name="ul_qty"/>
                    <field name="rows"/>
                    <field name="weight"/>
                    <separator colspan="4" string="Pallet Dimension"/>
                    <field name="height"/>
                    <field name="width"/>
                    <field name="length"/>
                    <separator colspan="4" string="Other Info"/>
                    <field colspan="4" name="name" select="1"/>
                </form>
            </field>
        </record>

        <record id="product_supplierinfo_form_view" model="ir.ui.view">
            <field name="name">product.supplierinfo.form.view</field>
            <field name="model">product.supplierinfo</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Supplier Information">
                    <field name="name"/>
                    <field name="sequence"/>
                    <field name="product_name" groups="base.group_extended"/>
                    <field name="product_code" groups="base.group_extended"/>
                    <field name="min_qty"/>
                    <field name="product_uom" widget="selection"/>
                    <field name="qty"/>
                    <field name="delay"/>
                    <field name="company_id" groups="base.group_multi_company" widget="selection"/>
                    <field colspan="4" groups="base.group_extended" name="pricelist_ids" nolabel="1" widget="one2many_list">
                        <tree editable="bottom" string="Pricelist">
                            <field name="min_quantity"/>
                            <field name="price"/>
                        </tree>
                        <form>
                            <field name="min_quantity"/>
                            <field name="price"/>
                        </form>
                    </field>
                </form>
            </field>
        </record>
        <record id="product_supplierinfo_tree_view" model="ir.ui.view">
            <field name="name">product.supplierinfo.tree.view</field>
            <field name="model">product.supplierinfo</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Supplier Information">
                    <field name="sequence" string="Seq"/>
                    <field name="name"/>
                    <field name="delay"/>
                    <field name="qty"/>
                    <field name="company_id" groups="base.group_multi_company" widget="selection"/>
                </tree>
            </field>
        </record>

        <record id="product_variant_form_view" model="ir.ui.view">
            <field name="name">product.variant.form</field>
            <field name="model">product.product</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Product Variant">
                     <field name="product_tmpl_id" select="1"/>
                    <field name="active" select="1"/>
                    <field name="variants" select="1"/>
                    <field name="default_code" select="1"/>
                    <field name="price_margin" select="1"/>
                    <field name="price_extra" select="1"/>
                </form>
            </field>
        </record>

        <record id="product_variant_tree_view" model="ir.ui.view">
            <field name="name">product.variant.tree</field>
            <field name="model">product.product</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Product Variant">
                    <field name="product_tmpl_id"/>
                    <field name="active"/>
                    <field name="variants"/>
                    <field name="default_code"/>
                    <field name="price_margin"/>
                    <field name="price_extra"/>
                </tree>
            </field>
        </record>

        <record id="product_template_tree_view" model="ir.ui.view">
            <field name="name">product.template.product.tree</field>
            <field name="model">product.template</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Product Template">
                    <field name="name"/>
                    <field name="categ_id"/>
                    <field name="type"/>
                    <field name="state"/>
                </tree>
            </field>
        </record>

        <record id="product_template_form_view" model="ir.ui.view">
            <field name="name">product.template.product.form</field>
            <field name="model">product.template</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Product Template">
                    <group colspan="2" col="4">
                        <separator string="Product Description" colspan="4"/>
                        <field name="name" select="1"/>
                    </group>
                    <group colspan="2" col="2">
                        <separator string="Product Type" colspan="2"/>
                        <field name="sale_ok"/>
                        <field name="purchase_ok"/>
                    </group>
                    <notebook colspan="4">
                        <page string="Information">
                            <group colspan="2" col="2">
                                <separator string="Procurement" colspan="2"/>
                                <field name="type"/>
                                <field name="procure_method"/>
                                <field name="supply_method"/>
                            </group>

                            <group colspan="2" col="2" groups="base.group_extended">
                                <separator string="Weigths" colspan="2"/>
                                <field digits="(14, 3)" name="volume" attrs="{'readonly':[('type','=','service')]}"/>
                                <field digits="(14, 3)" name="weight" attrs="{'readonly':[('type','=','service')]}"/>
                                <field digits="(14, 3)" name="weight_net" attrs="{'readonly':[('type','=','service')]}"/>
                            </group>

                            <group colspan="2" col="2" name="status">
                                <separator string="Status" colspan="2"/>
                                <field name="categ_id" select="1"/>
                                <field name="state"/>
                                <field groups="base.group_extended" name="product_manager"/>
                            </group>

                            <group colspan="2" col="2" name="uom">
                                <separator string="UOM" colspan="2"/>
                                <field name="uom_id" on_change="onchange_uom(uom_id,uom_po_id)"/>
                                <field name="uom_po_id"/>
                            </group>

                            <group colspan="2" col="2" name="uos" groups="product.group_uos">
                                <separator string="Second UoM" colspan="2"/>
                                <field name="uos_id"/>
                                <field name="uos_coeff"/>
                                <field name="mes_type"/>
                            </group>

                        </page>
                        <page string="Procurement &amp; Locations" groups="base.group_extended">
                            <group colspan="2" col="2" name="delay">
                                <separator string="Delays" colspan="2"/>
                                <field name="sale_delay" attrs="{'readonly':[('sale_ok','=',0)]}"/>
                                <field name="produce_delay"/>
                                <field name="warranty"/>
                            </group>
                            <group colspan="2" col="2" name="store">
                                <separator string="Storage Localisation" colspan="2"/>
                                <field name="loc_rack"/>
                                <field name="loc_row"/>
                                <field name="loc_case"/>
                            </group>
                            <group colspan="2" col="2" name="misc">
                                <separator string="Miscelleanous" colspan="2"/>
                            </group>

                        </page>
                        <page string="Prices &amp; Suppliers">
                            <separator string="Base Prices" colspan="4"/>
                            <field name="standard_price" attrs="{'readonly':[('cost_method','=','average')]}"/>
                            <field name="list_price"/>
                            <field groups="base.group_extended" name="cost_method"/>
                            <newline/>
                            <field colspan="4" name="seller_ids" nolabel="1"/>
                        </page>
                        <page string="Descriptions">
                            <separator string="Description"/>
                            <field colspan="4" name="description" nolabel="1"/>
                            <separator string="Sale Description"/>
                            <field colspan="4" name="description_sale" nolabel="1"/>
                            <separator string="Purchase Description"/>
                            <field colspan="4" name="description_purchase" nolabel="1"/>
                        </page>
                    </notebook>
                </form>
            </field>
        </record>

        <record id="product_template_action_tree" model="ir.actions.act_window">
            <field name="name">Product Templates</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">product.template</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="product_template_tree_view"/>
        </record>
    </data>
</openerp>
