[FIX]crm: crm lead/opp merge, when opp has stage with state cancel, then it is less...
[odoo/odoo.git] / addons / procurement / procurement_view.xml
index 37a0b2c..7471114 100644 (file)
@@ -9,25 +9,22 @@
         <record id="procurement_tree_view" model="ir.ui.view">
             <field name="name">procurement.order.tree</field>
             <field name="model">procurement.order</field>
-            <field name="type">tree</field>
             <field name="arch" type="xml">
                 <tree string="Procurement Lines" colors="red:date_planned&lt;current_date and state == 'exception';black:state=='running';darkgreen:state=='confirmed';gray:state in ['done','cancel'];blue:state == 'ready'">
                     <field name="date_planned" widget="date"/>
                     <field name="origin"/>
                     <field name="product_id"/>
                     <field name="product_qty"/>
-                    <field name="product_uom" string="UOM"/>
+                    <field name="product_uom" string="Unit of Measure"/>
                     <field name="procure_method"/>
                     <field name="state"/>
                     <field name="message"/>
-                    <field name="name" invisible="1"/>
                 </tree>
             </field>
         </record>
          <record id="procurement_tree_view_board" model="ir.ui.view">
             <field name="name">procurement.order.tree.board</field>
             <field name="model">procurement.order</field>
-            <field name="type">tree</field>
             <field eval="20" name="priority"/>
             <field name="arch" type="xml">
                 <tree string="Procurement Lines" colors="red:date_planned&lt;current_date and state == 'exception';black:state=='running';darkgreen:state=='confirmed';gray:state in ['done','cancel'];blue:state == 'ready'">
@@ -35,7 +32,7 @@
                     <field name="origin"/>
                     <field name="product_id"/>
                     <field name="product_qty"/>
-                    <field name="product_uom" string="UOM"/>
+                    <field name="product_uom" string="Unit of Measure"/>
                     <field name="state" invisible = "1"/>
                     <field name="message"/>
                 </tree>
         <record id="procurement_form_view" model="ir.ui.view">
             <field name="name">procurement.order.form</field>
             <field name="model">procurement.order</field>
-            <field name="type">form</field>
             <field name="arch" type="xml">
-                <form string="Procurement">
-                    <group col="2" colspan="2">
-                        <separator colspan="2" string="References"/>
-                        <field name="name" string="Procurement Reason"/>
-                        <field name="origin"/>
-                        <field name="company_id" groups="base.group_multi_company" widget="selection"/>
-                    </group>
-                    <group col="2" colspan="2">
-                        <separator colspan="2" string="Planification"/>
-                        <field name="date_planned"/>
-                        <field name="procure_method"/>
-                        <field name="priority"/>
-                    </group>
-                    <notebook colspan="4">
-                    <page string="Procurement Details">
-                        <separator colspan="4" string="Product &amp; Location"/>
+                <form string="Procurement" version="7.0">
+                    <header>
+                        <button name="button_confirm" states="draft" string="Confirm" class="oe_highlight"/>
+                        <button name="button_check" states="confirmed" string="Run Procurement" class="oe_highlight"/>
+                        <button name="button_restart" states="exception" string="Retry" class="oe_highlight"/>
+                        <button name="button_cancel" states="draft,exception,waiting" string="Cancel Procurement"/>
+                        <field name="state" readonly="1" widget="statusbar" statusbar_visible="draft,confirmed" />
+                    </header>
+                    <sheet>
+                    <label for="product_id" class="oe_edit_only"/>
+                    <h1>
                         <field name="product_id" on_change="onchange_product_id(product_id)"/>
-                        <field name="location_id" domain="[('usage','=','internal')]"/>
-                        <field name="product_qty"/>
-                        <field name="product_uom"/>
-
-                        <field name="product_uos_qty" groups="product.group_uos"/>
-                        <field name="product_uos"  groups="product.group_uos"/>
-
-                        <separator colspan="4" string="Status"/>
-                        <field colspan="4" name="message" readonly="1"/>
-                        <field name="state" readonly="1"/>
-                        <group col="7" colspan="2">
-                            <button name="button_cancel" states="draft,exception,waiting" string="Cancel" icon="gtk-cancel"/>
-                            <button name="button_confirm" states="draft" string="Confirm" icon="gtk-apply"/>
-                            <button name="button_restart" states="exception" string="Retry" icon="gtk-convert"/>
-                            <button name="button_check" states="confirmed" string="Run Procurement" icon="gtk-media-play"/>
+                    </h1>
+                    <label for="product_qty" class="oe_edit_only"/>
+                    <h2>
+                        <div>
+                            <field name="product_qty" class="oe_inline"/>
+                            <field name="product_uom" class="oe_inline" groups="product.group_uom"/>
+                        </div>
+                    </h2>
+                    <field name="name" placeholder="External note..."/>
+                    <group>
+                        <group>
+                            <field name="date_planned"/>
+                            <field name="procure_method"/>
+                            <field name="priority"/>
+                        </group>
+                        <group>
+                            <field name="company_id" groups="base.group_multi_company" widget="selection"/>
+                            <field name="origin" class="oe_inline" placeholder="e.g. SO005"/>
+                            <field name="message"/>
                         </group>
-                    </page>
-                    <page string="Extra Information">
-                        <separator colspan="4" string="Details"/>
-                        <field name="move_id"/>
-                        <field name="date_close"/>
-                        <field name="close_move"/>
-                    </page>
-                    <page string="Notes">
-                        <separator colspan="4" string="Note" />
-                        <field name="note" colspan="4" nolabel="1"/>
-                    </page>
+                    </group>
+                    <notebook>
+                        <page string="Extra Information">
+                            <group>
+                                <label for="product_uos_qty" groups="product.group_uos"/>
+                                <div groups="product.group_uos">
+                                    <field name="product_uos_qty" class="oe_inline"/>
+                                    <field name="product_uos" class="oe_inline"/>
+                                </div>
+                                <field name="location_id" domain="[('usage','=','internal')]"/>
+                            </group>
+                            <group>
+                                <field name="move_id"/>
+                                <field name="date_close"/>
+                                <field name="close_move"/>
+                            </group>
+                            <field name="note" placeholder="Internal note..."/>
+                        </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_procurement_filter" model="ir.ui.view">
             <field name="name">procurement.order.select</field>
             <field name="model">procurement.order</field>
-            <field name="type">search</field>
             <field name="arch" type="xml">
                 <search string="Search Procurement">
-                    <group>
-                       <filter icon="terp-emblem-important" string="Exceptions" name="exceptions" domain="[('state','=','exception')]" help="Procurement Exceptions"/>
-                       <filter icon="terp-emblem-important" string="To Fix" name="perm_exceptions" domain="[('state','=','exception'),('message', '!=', '')]" help="Permanent Procurement Exceptions"/>
-                       <filter icon="terp-emblem-important" string="Temporary" name="temp_exceptions" domain="[('state','=','exception'),('message', '=', '')]" help="Temporary Procurement Exceptions"/>
-                       <separator orientation="vertical"/>
-                       <filter icon="terp-gnome-cpu-frequency-applet+" string="Late"
-                           domain="['&amp;', ('date_planned','&lt;', current_date), ('state', 'in', ('draft', 'confirmed'))]"
-                           help="Procurement started late" />
-                       <separator orientation="vertical"/>
-                       <field name="origin"/>
-                       <field name="product_id" />
-                       <field name="date_planned"/>
-                       <field name="state" />
-                    </group>
-                    <newline/>
+                    <field name="origin" string="Procurement"/>
+                    <field name="date_planned"/>
+                    <filter icon="terp-emblem-important" string="Exceptions" name="exceptions" domain="[('state','=','exception')]" help="Procurement Exceptions"/>
+                    <separator/>
+                    <filter icon="terp-emblem-important" string="To Fix" name="perm_exceptions" domain="[('state','=','exception'),('message', '!=', '')]" help="Permanent Procurement Exceptions"/>
+                    <filter icon="terp-emblem-important" string="Temporary" name="temp_exceptions" domain="[('state','=','exception'),('message', '=', '')]" help="Temporary Procurement Exceptions"/>
+                    <separator/>
+                    <filter icon="terp-gnome-cpu-frequency-applet+" string="Late" domain="['&amp;', ('date_planned','&lt;', current_date), ('state', 'in', ('draft', 'confirmed'))]" help="Procurement started late" />
+                    <field name="product_id" />
+                    <field name="state" />
                     <group expand="0" string="Group By">
                         <filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>
                         <filter string="Reason" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'name'}"/>
                         <filter string="Scheduled Date" icon="terp-go-month" domain="[]" context="{'group_by':'date_planned'}"/>
-                        <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
+                        <filter string="Status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
                     </group>
                 </search>
             </field>
             <field name="view_id" eval="False"/>
             <field name="search_view_id" ref="view_procurement_filter"/>
             <field name="context">{'search_default_current':1}</field>
-            <field name="help">A procurement order is used to record a need for a specific product at a specific location. A procurement order is usually created automatically from sales orders, a Pull Logistics rule or Minimum Stock Rules. When the procurement order is confirmed, it automatically creates the necessary operations to fullfil the need: purchase order proposition, manufacturing order, etc.</field>
+            <field name="help" type="html">
+              <p class="oe_view_nocontent_create">
+                Click to create a procurement order. 
+              </p><p>
+                A procurement order is used to record a need for a specific
+                product at a specific location.  Procurement orders are usually
+                created automatically from sales orders, pull logistic rules or
+                minimum stock rules.
+              </p><p>
+                When the procurement order is confirmed, it automatically
+                creates the necessary operations to fullfil the need: purchase
+                order proposition, manufacturing order, etc.
+              </p>
+            </field>
         </record>
 
         <record id="procurement_exceptions" model="ir.actions.act_window">
             <field name="view_mode">tree,form</field>
             <field name="context">{'search_default_perm_exceptions':1}</field>
             <field name="search_view_id" ref="view_procurement_filter"/>
-            <field name="help">Procurement Orders represent the need for a certain quantity of products, at a given time, in a given location. Sales Orders are one typical source of Procurement Orders (but these are distinct documents). Depending on the procurement parameters and the product configuration, the procurement engine will attempt to satisfy the need by reserving products from stock, ordering products from a supplier, or passing a manufacturing order, etc. A Procurement Exception occurs when the system cannot find a way to fulfill a procurement. Some exceptions will resolve themselves automatically, but others require manual intervention (those are identified by a specific error message).</field>
+            <field name="help" type="html">
+                <p>
+                Procurement Orders represent the need for a certain quantity of products, at a given time, in a given location. Sales Orders are one typical source of Procurement Orders (but these are distinct documents). Depending on the procurement parameters and the product configuration, the procurement engine will attempt to satisfy the need by reserving products from stock, ordering products from a supplier, or passing a manufacturing order, etc. A Procurement Exception occurs when the system cannot find a way to fulfill a procurement. Some exceptions will resolve themselves automatically, but others require manual intervention (those are identified by a specific error message).
+                </p>
+            </field>
         </record>
 
         <record id="procurement_action5" model="ir.actions.act_window">
         <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="type">tree</field>
             <field name="arch" type="xml">
-                <tree string="Minimum Stock Rules">
+                <tree string="Reordering Rules">
                     <field name="name"/>
-                    <field name="warehouse_id"/>
-                    <field name="location_id"/>
+                    <field name="warehouse_id" groups="stock.group_locations"/>
+                    <field name="location_id" groups="stock.group_locations"/>
                     <field name="product_id"/>
-                    <field name="product_uom"/>
+                    <field name="product_uom" groups="product.group_uom"/>
                     <field name="product_min_qty"/>
                     <field name="product_max_qty"/>
                 </tree>
         <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="type">search</field>
             <field name="arch" type="xml">
-                <search string="Minimum Stock Rules Search">
-                    <group>
-                        <field name="name"/>
-                        <field name="warehouse_id" widget="selection"/>
-                        <field name="location_id"/>
-                        <field name="company_id" widget="selection" groups="base.group_multi_company"/>
-                        <field name="product_id"/>
-                    </group>
-                    <newline/>
+                <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'}"/>
         <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="type">form</field>
             <field name="arch" type="xml">
-                <form string="Minimum Stock Rules">
-                    <group col="2" colspan="2">
-                        <separator string="General Information" colspan="2" />
-                        <field name="name" />
-                        <field name="product_id" on_change="onchange_product_id(product_id)"/>
-                        <field name="product_uom"/>
-                    </group>
-                    <group col="2" colspan="2">
-                        <separator string="Locations" colspan="2" />
-                        <field name="warehouse_id" on_change="onchange_warehouse_id(warehouse_id)" widget="selection"/>
-                        <field name="location_id"/>
-                        <field name="company_id" groups="base.group_multi_company" widget="selection"/>
-                    </group>
-                    <group col="2" colspan="2">
-                        <separator string="Quantity Rules" colspan="2" />
-                        <field name="product_min_qty"/>
-                        <field name="product_max_qty"/>
-                        <field name="qty_multiple"/>
-                    </group>
-                    <group col="2" colspan="2">
-                        <separator string="Misc" colspan="2" />
-                        <field name="procurement_id" readonly="1"/>
-                        <field name="active" />
-                    </group>
-                    <group col="4" colspan="4">
-                        <separator string="Procurement Orders to Process" colspan="4" />
-                        <field name="procurement_draft_ids" colspan="4" nolabel="1"/>
-                    </group>
+                <form string="Reordering Rules" version="7.0">
+                    <sheet>
+                        <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="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="procurement_id" readonly="1"/>
+                                <field name="active" />
+                            </group>
+                        </group>
+                        <group string="Procurement Orders to Process">
+                            <field name="procurement_draft_ids" nolabel="1"/>
+                        </group>
+                    </sheet>
                 </form>
             </field>
         </record>
 
         <record id="action_orderpoint_form" model="ir.actions.act_window">
-            <field name="name">Minimum Stock Rules</field>
+            <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>
         </record>
 
         <act_window
-        context="{'search_default_warehouse_id': active_id, 'default_warehouse_id': active_id}"
-        id="act_stock_warehouse_2_stock_warehouse_orderpoint"
-        name="Minimum Stock Rules"
-        res_model="stock.warehouse.orderpoint"
-        src_model="stock.warehouse"
-        groups="stock.group_stock_user"/>
+            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"/>
 
         <act_window
             context="{'product_uom': locals().has_key('uom_id') and uom_id, 'default_procurement_id': active_id}"
             id="act_procurement_2_stock_warehouse_orderpoint"
-            name="Minimum Stock Rules"
+            name="Reordering Rules"
             res_model="stock.warehouse.orderpoint"
             src_model="procurement.order"
             groups="stock.group_stock_user"/>
 
         <!-- 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"/>
+        <menuitem id="menu_stock_sched" name="Schedulers" parent="stock.menu_stock_root" sequence="4" groups="stock.group_stock_manager"/>
             <menuitem action="action_compute_schedulers" id="menu_stock_proc_schedulers" parent="menu_stock_sched" sequence="20" groups="stock.group_stock_manager"/>
             <menuitem action="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"/>
 
-        <record id="product_normal_form_view" model="ir.ui.view">
-            <field name="name">product.normal.form.orderpoint.inherit</field>
+
+        <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">Orderpoints</field>
+            <field name="res_model">stock.warehouse.orderpoint</field>
+        </record>
+
+        <record model="ir.ui.view" id="product_template_form_view_procurement">
+            <field name="name">product.template.procurement</field>
+            <field name="model">product.template</field>
+            <field name="inherit_id" ref="product.product_template_form_view"/>
+            <field name="arch" type="xml">
+                <xpath expr="//field[@name='type']" position="after">
+                    <field name="procure_method"/>
+                    <field name="supply_method"/>
+                </xpath>
+            </field>
+        </record>
+
+        <record id="product_search_form_view_procurment" model="ir.ui.view">
+            <field name="name">product.search.procurment.form</field>
+            <field name="model">product.product</field>
+            <field name="inherit_id" ref="product.product_search_form_view"/>
+            <field name="arch" type="xml">
+                <filter name="consumable" position="before">
+                   <filter string="Products" icon="terp-accessories-archiver" domain="[('type','=','product')]" help="Stockable products"/>
+                </filter>
+            </field>
+        </record>
+
+        <record model="ir.ui.view" id="product_form_view_procurement_button">
+            <field name="name">product.product.procurement</field>
             <field name="model">product.product</field>
-            <field name="type">form</field>
             <field name="inherit_id" ref="product.product_normal_form_view"/>
             <field name="arch" type="xml">
-                <group name="misc" position="after">
-                    <separator string="Minimum Stock Rules" colspan="4"/>
-                    <field name="orderpoint_ids" nolabel="1" colspan="4" context="{'default_product_id': active_id}"/>
-                </group>
+                <xpath expr="//div[@name='buttons']" position="inside">
+                    <button string="Request Procurement" name="%(act_make_procurement)d" type="action"/>
+                    <button string="Orderpoints" name="%(product_open_orderpoint)d" type="action"/>
+                </xpath>
+                <xpath expr="//field[@name='cost_method']" position="before">
+                    <field name="procure_method" groups="base.group_user"/>
+                    <field name="supply_method" groups="base.group_user"/> 
+                </xpath>
+                <xpath expr="//group[@name='general']" position="after" >
+                   <group name="procurement_help" class="oe_grey" col="1" groups="base.group_user">
+                       <p attrs="{'invisible': ['|','|',('type','&lt;&gt;','service'),('procure_method','&lt;&gt;','make_to_stock')]}">
+                           When you sell this service, nothing special will be triggered
+                           to deliver the customer, as you set the procurement method as
+                           'Make to Stock'.
+                       </p>
+                       <p attrs="{'invisible': ['|','|',('type','&lt;&gt;','product'),('procure_method','&lt;&gt;','make_to_stock')]}">
+                           When you sell this product, OpenERP will <b>use the available
+                           inventory</b> for the delivery order.
+                           <br/><br/>
+                           If there are not enough quantities available, the delivery order
+                           will wait for new products. To fulfill the inventory, you should
+                           create others rules like orderpoints.
+                       </p>
+                       <p attrs="{'invisible': ['|','|',('type','&lt;&gt;','consu'),('procure_method','&lt;&gt;','make_to_stock')]}">
+                           When you sell this product, a delivery order will be created.
+                           OpenERP will consider that the <b>required quantities are always
+                           available</b> as it's a consumable (as a result of this, the quantity
+                           on hand may become negative).
+                       </p>
+                   </group>
+                </xpath>
             </field>
         </record>