[FIX] QWeb2: Array-like character access in String is not supported in IE<8
[odoo/odoo.git] / addons / stock_planning / stock_planning_view.xml
index 451a2ac..3cbee4d 100644 (file)
@@ -1,83 +1,71 @@
 <?xml version="1.0" encoding="utf-8"?>
 <openerp>
-<data>
+    <data>
         <menuitem id="menu_stock_period_main"
-                  name="Stock and Sales Periods"
-                  parent="base.menu_base_config"/>
+                  name="Stock Periods"
+                  parent="stock.menu_stock_configuration" sequence="20"/>
 
-<!-- Creating periods section -->
+        <!-- Periods tree and form section -->
 
-    <record id="view_stock_period_createlines_form" model="ir.ui.view">
-            <field name="name">stock.period.createlines.form</field>
-            <field name="model">stock.period.createlines</field>
+        <record id="view_stock_period_form" model="ir.ui.view">
+            <field name="name">stock.period.form</field>
+            <field name="model">stock.period</field>
             <field name="type">form</field>
             <field name="arch" type="xml">
-                <form string="Stock and Sales Periods">
-                    <separator colspan="4" string="Create periods for Stock and Sales Planning"/>
+                <form string="Stock Periods">
+                    <field name="name" colspan="2"/>
+                    <newline/>
                     <field name="date_start"/>
                     <field name="date_stop"/>
-                    <separator colspan="4" string=""/>
-                    <group col="3" colspan="4">
-                        <button name="create_period" string="Create Daily Periods" type="object"/>
-                        <button name="create_period_weekly" string="Create Weekly Periods" type="object"/>
-                        <button name="create_period_monthly" string="Create Monthly Periods" type="object"/>
+                    <separator string="State" colspan="4"/>
+                    <group col="4" colspan="4">
+                        <field name="state" select="1" readonly="1"/>
+                        <button name="button_open" string="Open" icon="gtk-ok" states="draft" type="object"/>
+                        <button name="button_close" string="Close" icon="gtk-stop" states="open" type="object"/>
                     </group>
                 </form>
             </field>
         </record>
 
-        <record id="action_stock_period_createlines_form" model="ir.actions.act_window">
-            <field name="name">Stock and Sales Planning Periods</field>
-            <field name="res_model">stock.period.createlines</field>
-            <field name="view_type">form</field>
-            <field name="view_mode">form</field>
-            <field name="view_id" ref="view_stock_period_createlines_form"/>
-            <field name="target">new</field>
-        </record>
-
-        <menuitem id="menu_stock_period_creatlines"
-                  name="Create Stock and Sales Periods"
-                  parent="menu_stock_period_main"
-                  action="action_stock_period_createlines_form"
-                  sequence = "5"/>
-
-<!-- Periods tree and form section -->
-
-        <record id="view_stock_period_form" model="ir.ui.view">
-            <field name="name">stock.period.form</field>
+        <record id="view_stock_period_tree" model="ir.ui.view">
+            <field name="name">stock.period.tree</field>
             <field name="model">stock.period</field>
-            <field name="type">form</field>
+            <field name="type">tree</field>
             <field name="arch" type="xml">
-                <form string="Stock and Sales Periods">
+                <tree string="Stock and Sales Period" editable="bottom" colors="gray:state == 'close';black:state in ('draft','open')">
                     <field name="name"/>
                     <field name="date_start"/>
-                    <field name="state" select="1"/>
                     <field name="date_stop"/>
-                </form>
+                    <field name="state" select="1"/>
+                </tree>
             </field>
         </record>
 
-        <record id="view_stock_period_tree" model="ir.ui.view">
-            <field name="name">stock.period.tree</field>
+        <record id="view_stock_period_search" model="ir.ui.view">
+            <field name="name">stock.period.search</field>
             <field name="model">stock.period</field>
-            <field name="type">tree</field>
+            <field name="type">search</field>
             <field name="arch" type="xml">
-                <tree string="Stock and Sales Period" editable="bottom">
+                <search string="Stock Periods">
+                    <filter string="Current" domain="[('state','in',['draft','open'])]" icon="terp-check" help="Current Periods"/>
+                    <filter string="Closed" domain="[('state','=','close')]" icon="gtk-stop" help="Closed Periods"/>
+                    <separator orientation="vertical"/>
                     <field name="name"/>
                     <field name="date_start"/>
                     <field name="date_stop"/>
-                    <field name="state" select="1"/>
-                </tree>
+                </search>
             </field>
         </record>
 
         <record id="action_stock_period_form" model="ir.actions.act_window">
-            <field name="name">Stock and Sales Periods</field>
+            <field name="name">Stock Periods</field>
             <field name="res_model">stock.period</field>
             <field name="view_type">form</field>
             <field name="view_mode">tree,form</field>
-        </record>
+            <field name="search_view_id" ref="view_stock_period_search"/>
+            <field name="help">Stock periods are used for stock planning. Stock periods are independent of account periods. You can use wizard for creating periods and review them here.</field>
 
+        </record>
 
         <menuitem
             id="menu_stock_period"
             action="action_stock_period_form"
             sequence = "10"/>
 
-<!--   Create Forecast section   -->
-
-        <record id="view_stock_sale_forecast_createlines_form" model="ir.ui.view">
-            <field name="name">stock.sale.forecast.createlines</field>
-            <field name="model">stock.sale.forecast.createlines</field>
-            <field name="type">form</field>
-            <field name="arch" type="xml">
-                <form string="Stock and Sales Forecasts">
-                    <field name="company_id" groups="base.group_multi_company" widget="selection"/>
-                    <newline/>
-                    <field name="period_id1" widget="selection"/>
-                    <newline/>
-                    <field name="warehouse_id1" domain = "[('company_id','=',company_id)] "/>
-                    <newline/>
-                    <field name="product_categ_id1" widget="selection"/>
-                    <newline/>
-                    <field name="copy_forecast"/>
-                    <separator colspan ="4" string="Forecast lines creation"/>
-                    <label  colspan ="4" string="Creates forecast lines for selected warehouse and period. Doesn't duplicate existing lines created by you."/>
-                    <group colspan="4">
-                        <button icon="gtk-cancel" special="cancel" string="Cancel"/>
-                        <button icon="gtk-execute" name="create_forecast" string="Create Forecasts" type="object" />
-                    </group>
-                </form>
-            </field>
-        </record>
-
-        <record id="action_stock_sale_forecast_createlines_form" model="ir.actions.act_window">
-            <field name="name">Create Stock and Sales Forecasts</field>
-            <field name="res_model">stock.sale.forecast.createlines</field>
-            <field name="view_type">form</field>
-            <field name="view_mode">form</field>
-            <field name="view_id" ref="view_stock_sale_forecast_createlines_form"/>
-            <field name="target">new</field>
-        </record>
-
-        <menuitem id="menu_stock_sale_forecast" name="Stock and Sales Forecasts" parent="base.menu_base_partner"/>
-
-        <menuitem id="menu_stock_sale_forecast_createlines" name="Create Stock and Sales Forecasts" parent="menu_stock_sale_forecast" action="action_stock_sale_forecast_createlines_form" sequence = "5"/>
-
         <record id="view_stock_sale_forecast_form" model="ir.ui.view">
             <field name="name">stock.sale.forecast.form</field>
             <field name="model">stock.sale.forecast</field>
             <field name="arch" type="xml">
                 <form string="Stock and Sales Forecast">
                     <group colspan = "4" col = "4">
-                       <group colspan = "2" col="2" >
+                        <group colspan = "2" col="2" >
                             <field name="company_id" select="1"
                                         groups="base.group_multi_company"
                                         widget="selection"
                                         on_change="onchange_company(company_id)"/>
-                            <field name="warehouse_id" select="1" domain = "[('company_id','=',company_id)] "/>
-                            <field name="period_id" select="1" />
-                            <field name="product_id" select="1" on_change="product_id_change(product_id)" />
-                           <field name="product_uom_categ"  invisible = "True"/>
-                           <field name="product_uos_categ"  invisible = "True"/>
+                            <field name="warehouse_id" domain = "[('company_id','=',company_id)] "/>
+                            <field name="period_id" />
+                            <field name="product_id" on_change="product_id_change(product_id)" />
+                            <field name="product_uom_categ"  invisible = "True"/>
+                            <field name="product_uos_categ"  invisible = "True"/>
                             <field name="product_uom"
                                          domain = "[('category_id','in',[product_uom_categ,product_uos_categ])]"
-                                         on_change = "onchange_uom(product_uom, product_qty, active_uom)"/>
+                                         on_change = "onchange_uom(product_uom, product_qty, active_uom, product_id)"/>
                             <field name="active_uom" invisible = "True" />
-                        </group>
-                        <group colspan = "2" col="2" >
+                        </group>
+                        <group colspan = "2" col="2" >
                             <field name="user_id"/>
-                            <field name="product_amt" on_change="product_amt_change( product_amt, product_uom)" />
+                            <field name="product_amt" on_change="product_amt_change(product_amt, product_uom, product_id)" />
                             <field name="product_qty"  />
                             <field name="state"/>
-                            <button name="action_validate" string="Validate" states="draft" type="object" colspan = "2"/>
-                       </group>
+                            <label string = ""/>
+                            <button name="action_validate" icon="gtk-apply" string="Approve" states="draft" type="object" colspan = "1"/>
+
+                        </group>
                     </group>
                     <separator colspan ="4" string="Sales history"/>
                     <group colspan = "4" col = "5">
                         <label string = "Per User :"/>
                         <label string = "Per Department :"/>
                         <label string = "Per Warehouse :"/>
-                        <label string = "Per Company :"/>
+                        <label string = ""/>
                         <label string = "Periods :"/>
                         <field name="analyzed_user_id" nolabel = "1" domain = "[('company_id','=',company_id)] "/>
-                        <field name="analyzed_dept_id" nolabel = "1" domain = "[('company_id','=',company_id)] " />
+                        <field name="analyzed_team_id" nolabel = "1" />
                         <field name="analyzed_warehouse_id" nolabel = "1" domain = "[('company_id','=',company_id)] " />
                         <group colspan = "1" col = "2">
                             <field name = "analyze_company"/>
                         <button name="calculate_sales_history" icon="gtk-execute"
                                 string="Calculate Sales History" type="object" colspan = "1" states="draft" />
                     </group>
-
                 </form>
             </field>
         </record>
             <field name="model">stock.sale.forecast</field>
             <field name="type">tree</field>
             <field name="arch" type="xml">
-                <tree string="Stock and Sales Forecasts" editable="bottom">
-                    <field name="warehouse_id" select="1"/>
-                    <field name="user_id"/>
-                    <field name="period_id" select="1"/>
+                <tree string="Sales Forecasts" colors="gray:state=='validated';black:state=='draft'">
+                    <field name="period_id"/>
                     <field name="product_id" on_change="product_id_change(product_id)" />
                     <field name="product_qty"/>
                     <field name="product_uom" />
+                    <field name="warehouse_id"/>
+                    <field name="company_id"/>
+                    <field name="state"/>
                 </tree>
             </field>
         </record>
             </field>
         </record>
 
+        <!-- Forecast section -->
+
+        <menuitem id="menu_stock_sale_forecast" name="Sales Forecasts"
+                parent="base.menu_base_partner" sequence="6" groups="base.group_extended"/>
 
-       <record id="view_stock_sale_forecast_filter" model="ir.ui.view">
+        <record id="view_stock_sale_forecast_filter" model="ir.ui.view">
             <field name="name">stock.sale.forecast.list.select</field>
             <field name="model">stock.sale.forecast</field>
             <field name="type">search</field>
             <field name="arch" type="xml">
-                <search string="Search Stock and Sales Forecast">
-                 <group col='10' colspan='4'>
-                    <filter icon="terp-purchase" string="Validated" domain="[('state','=','validated')]" separator="1"/>
-                    <field name="company_id" select="1" widget="selection"/>
-                    <field name="warehouse_id" select="1" widget="selection"/>
-                    <field name="period_id" select="1" widget="selection"/>
-                    <field name="product_id" select="1" widget="selection"/>
-                    <field name="create_uid" select="1" widget="selection"/>
-                </group>
+                <search string="Search  Sales Forecast">
+                    <filter icon="terp-camera_test" string="Validated" domain="[('state','=','validated')]" />
+                    <field name="company_id"/>
+                    <field name="warehouse_id" />
+                    <field name="period_id" />
+                    <field name="product_id"/>
+                    <field name="create_uid"/>
+                    <newline/>
+                    <group expand="0" string="Group By...">
+                        <filter string="Company" icon="terp-go-home" domain="[]" context="{'group_by':'company_id'}"/>
+                        <filter string="Warehouse " icon="terp-go-home" domain="[]" context="{'group_by':'warehouse_id'}"/>
+                        <filter string="Product" icon="terp-accessories-archiver" domain="[]"  context="{'group_by':'product_id'}"/>
+                       <separator orientation="vertical"/>
+                       <filter string='Default UOM' icon="terp-mrp" domain="[]" context="{'group_by' : 'product_uom'}" />
+                    </group>
               </search>
             </field>
         </record>
 
 
         <record id="action_view_stock_sale_forecast_form" model="ir.actions.act_window">
-            <field name="name">Stock and Sales Forecast</field>
+            <field name="name">Sales Forecast</field>
             <field name="res_model">stock.sale.forecast</field>
             <field name="view_type">form</field>
             <field name="view_mode">tree,form,graph</field>
             <field name="context">{"search_default_create_uid":uid}</field>
-            <field name="search_view_id" ref="view_stock_sale_forecast_filter"/>
+            <field name="help">This quantity sales forecast is an indication for Stock Planner to make procurement manually or to complement automatic procurement. You can use manual procurement with this forecast when some periods are exceptional for usual minimum stock rules.</field>
         </record>
 
         <menuitem id="menu_stock_sale_forecast_all"
-                  name="Stock and Sales Forecasts"
+                  name="Sales Forecasts"
                   parent="menu_stock_sale_forecast"
                   action="action_view_stock_sale_forecast_form"/>
 
-<!-- Create Planning section -->
-
-        <menuitem id="menu_stock_planning_main" name="Stock Planning" parent="stock.menu_stock_root"/>
-
-       <record id="view_stock_planning_createlines_form" model="ir.ui.view">
-            <field name="name">stock.planning.createlines.form</field>
-            <field name="model">stock.planning.createlines</field>
-            <field name="type">form</field>
-            <field name="arch" type="xml">
-                <form string="Stock Planning">
-                   <field name="company_id" widget= "selection" on_change="onchange_company(company_id)" groups="base.group_multi_company"/>
-                    <newline/>
-                    <field name="period_id2" widget="selection"/>
-                    <newline/>
-                    <field name="warehouse_id2" domain = "[('company_id','=',company_id)] "/>
-                    <newline/>
-                    <field name="forecasted_products"/>
-                    <newline/>
-                    <field name="product_categ_id2" attrs="{'required':[('forecasted_products','=',0)]}" widget="selection"/>
-                    <separator colspan ="4" string="Stock planning lines creation"/>
-                    <label  colspan ="4" string="Creates planning lines for selected period and warehouse. Doesn't duplicate existing lines created by you."/>
-                    <group colspan="4">
-                        <button icon="gtk-cancel" special="cancel" string="Cancel"/>
-                        <button icon="gtk-ok" name="create_planning" string="Create Stock Planning" type="object"/>
-                    </group>
-                </form>
-            </field>
-        </record>
-
-        <record id="action_stock_planning_createlines_form" model="ir.actions.act_window">
-            <field name="name">Create Stock Planning Lines</field>
-            <field name="res_model">stock.planning.createlines</field>
-            <field name="view_type">form</field>
-            <field name="view_mode">form</field>
-            <field name="view_id" ref="view_stock_planning_createlines_form"/>
-            <field name="target">new</field>
-        </record>
-
-        <menuitem
-            id="menu_stock_planning_createlines"
-            parent="menu_stock_planning_main"
-            action="action_stock_planning_createlines_form" sequence = "5"/>
+        <!-- Planning section -->
 
-<!-- Planning section -->
+        <menuitem id="menu_stock_planning_manual" name="Master Procurement Schedule" parent="procurement.menu_stock_sched" sequence="10"/>
 
         <record id="view_stock_planning_form" model="ir.ui.view">
             <field name="name">stock.planning.form</field>
                     <group colspan="4" col="7">
                         <group colspan ="3" col="2">
                             <separator colspan ="2" string = "General Info"/>
-
                             <field name="company_id" select = "1" widget= "selection"
                                          on_change="onchange_company(company_id)" groups="base.group_multi_company"/>
-                            <field name="warehouse_id" select="1" domain = "[('company_id','=',company_id)] " />
-                            <field name="period_id" select="1"  />
+                            <field name="warehouse_id" domain = "[('company_id','=',company_id)] " />
+                            <field name="period_id" />
                             <field name="product_id" on_change="product_id_change(product_id)"  />
-                           <field name="product_uom_categ"  invisible = "True"/>
-                           <field name="product_uos_categ"  invisible = "True"/>
+                            <field name="product_uom_categ"  invisible = "True"/>
+                            <field name="product_uos_categ"  invisible = "True"/>
                             <field name="product_uom"
                                          domain = "[('category_id','in',[product_uom_categ,product_uos_categ])]"
-                                         on_change = "onchange_uom(product_uom)"/>
-<!--                            <field name="state"/>    -->
+                                         on_change = "onchange_uom(product_uom, product_id, active_uom, planned_outgoing, to_procure)"/>
+                            <field name="active_uom" invisible = "True" />
                             <separator colspan ="2" string = "Forecasts"/>
                             <field name="warehouse_forecast"/>
                             <field name="company_forecast"/>
                             <field name="confirmed_forecasts_only"/>
-
-
                         </group>
                         <group colspan ="2" col="2">
                             <separator colspan ="2" string = "Current Period Situation"/>
                             <field name="to_procure"/>
                             <field name="incoming"/>
                             <field name="incoming_left"/>
-                            <button name="calculate_planning" string="Calculate Planning" type="object" colspan="2"/>
+                            <button name="calculate_planning" string="Calculate Planning" type="object" icon="gtk-execute" colspan="2"/>
                             <field name="stock_only"/>
                         </group>
                         <group colspan ="2" col="2">
                             <field name="outgoing_before"/>
                             <field name="incoming_before"/>
                             <field name="stock_simulation"/>
-                            <button name="procure_incomming_left" string="Procure Incoming Left" type="object" colspan="2"/>
+                            <button name="procure_incomming_left" icon="gtk-convert" string="Procure Incoming Left" type="object" colspan="2"/>
                             <field name="procure_to_stock"/>
                             <separator colspan ="2" string = "Internal Supply"/>
-                           <button name="internal_supply" string="Supply from Another Warehouse" type="object" colspan="2"/>
+                            <button name="internal_supply" string="Supply from Another Warehouse" icon="gtk-convert"  type="object" colspan="2"/>
                             <field name="supply_warehouse_id" domain = "[('company_id','=',company_id)] "/>
                             <field name="stock_supply_location"/>
                         </group>
                     </group>
-                    <separator colspan ="4" string = "Requisition history"/>
+                    <separator colspan ="4" string = "Procurement history"/>
                     <field name = "history" colspan = "2" nolabel = "1"/>
                 </form>
             </field>
             <field name="type">search</field>
             <field name="arch" type="xml">
                 <search string="Search Stock Planning">
-                 <group col='10' colspan='4'>
-<!--  Doesn't work !       <filter icon="terp-purchase" string="Current" domain="[('line_time','=','Future')]" separator="1"/>  -->
-                    <filter icon="terp-purchase" string="No Requisition" domain="[('history','=',False)]" separator="1"/>
-                    <field name="company_id" select="1" widget="selection"/>
-                    <field name="warehouse_id" select="1" widget="selection"/>
-                    <field name="period_id" select="1" widget="selection"/>
-                    <field name="product_id" select="1" widget="selection"/>
-                 </group>
+                    <filter icon="terp-purchase" string="No Requisition" domain="[('history','=',False)]" />
+                    <field name="company_id" widget="selection"/>
+                    <field name="warehouse_id" widget="selection"/>
+                    <field name="period_id" widget="selection"/>
+                    <field name="product_id"/>
+                    <newline/>
+                    <group expand="0" string="Group By...">
+                        <filter string="Company" icon="terp-go-home" domain="[]" context="{'group_by':'company_id'}"/>
+                        <filter string="Warehouse " icon="terp-go-home" domain="[]" context="{'group_by':'warehouse_id'}"/>
+                        <filter string="Product" icon="terp-accessories-archiver" domain="[]"  context="{'group_by':'product_id'}"/>
+                       <separator orientation="vertical"/>
+                    </group>
               </search>
             </field>
         </record>
             <field name="type">tree</field>
             <field name="arch" type="xml">
                 <tree string="Master Procurement Schedule" colors ="blue:line_time=='Past';black:line_time=='Future'">
-                    <field name="warehouse_id" domain = "[('company_id','=',company_id)] " />
                     <field name="period_id"/>
+                    <field name="company_id" invisible="1"/>
                     <field name="product_id" on_change="product_id_change(product_id)" />
                     <field name="product_uom"/>
                     <field name="warehouse_forecast" string="Forecast"/>
                     <field name="planned_outgoing"/>
                     <field name="to_procure"/>
+                    <field name="line_time" invisible="1"/>
                     <field name="stock_simulation" string="Stock"/>   <!-- previously stock_start -->
+                    <field name="warehouse_id" domain = "[('company_id','=',company_id)] " />
                 </tree>
             </field>
         </record>
             <field name="type">ir.actions.act_window</field>
             <field name="view_type">form</field>
             <field name="view_mode">tree,form</field>
-            <field name="search_view_id" ref="view_stock_planning_filter"/>
+            <field name="help">The Master Procurement Schedule can be the main driver for warehouse replenishment, or can complement the automatic MRP scheduling (minimum stock rules, etc.).
+Each MPS line gives you a pre-computed overview of the incoming and outgoing quantities of a given product for a given Stock Period in a given Warehouse, based on the current and future stock levels,
+as well as the planned stock moves. The forecast quantities can be altered manually, and when satisfied with resulting (simulated) Stock quantity, you can trigger the procurement of what is missing to reach your desired quantities</field>
         </record>
 
         <menuitem
             id="menu_stock_planning"
-            parent="menu_stock_planning_main"
+            parent="menu_stock_planning_manual"
             action="action_view_stock_planning_form"/>
 
 </data>