[MERGE] forward port of branch 7.0 up to de07c64
[odoo/odoo.git] / addons / lunch / lunch_view.xml
index d8ee3f6..c5fa52a 100644 (file)
@@ -1,39 +1,30 @@
 <?xml version="1.0"?>
 <openerp>
     <data>
-        <!--Menu and Title-->
-        <menuitem id='menu_lunch' name='Lunch' />
-        <menuitem name="Lunch Menu" parent="menu_lunch" id="menu_lunch_title" sequence="50" />
+        <!-- Top menu item -->
+        <menuitem id='menu_lunch' name='Lunch' sequence="100" groups="group_lunch_user"/>
+        <menuitem name="Lunch" parent="menu_lunch" id="menu_lunch_title" sequence="50" />
         <menuitem name="Administrate Orders" parent="menu_lunch" id="menu_lunch_admin" sequence="51" groups="group_lunch_manager"/>
         <menuitem name="Administrate Cash Moves" parent="menu_lunch" id="menu_lunch_cash" sequence="52" groups="group_lunch_manager"/>
         <menuitem name="Configuration" parent="menu_lunch" id="menu_lunch_config" sequence="53" groups="group_lunch_manager"/>
-        
-         <!--View Search to group by Supplier and time-->
-        <record model="ir.ui.view" id="supplier_group_by_month_search_view">
+
+         <!--View Search to group/filter by Supplier and time-->
+        <record model="ir.ui.view" id="lunch_order_line_search_view">
             <field name="name">Search</field>
             <field name="model">lunch.order.line</field>
-            <field name="type">search</field>
             <field name="arch" type="xml">
                 <search string="Search">
-                    <filter name="group_by_supplier" string="By Supplier" context="{'group_by':'supplier'}"/>
-                    <filter name="not_confirmed" string="Not Confirmed" domain="[('state','!=',('confirmed'))]"/>
-                    <filter name="comfirmed" string="Confirmed" domain="[('state','=','confirmed')]"/>
+                    <field name="name" filter_domain="['|', ('name', 'ilike', self), ('note', 'ilike', self)]"/>
+                    <filter name="not_confirmed" string="Not Received" domain="[('state','!=',('confirmed'))]"/>
+                    <filter name="comfirmed" string="Received" domain="[('state','=','confirmed')]"/>
                     <filter name="cancelled" string="Cancelled" domain="[('state','=','cancelled')]"/>
-                    <filter name="group_by_date" string="By Date" context="{'group_by':'date'}"/>
-                </search>
-            </field>
-        </record>
-
-        <record id="view_lunch_order_filter" model="ir.ui.view">
-            <field name="name">lunch order list</field>
-            <field name="model">lunch.order.line</field>
-            <field name="arch" type="xml">
-                <search string="Search Lunch Order">
-                    <filter name="group_by_supplier" string="By Supplier" context="{'group_by':'supplier'}"/>
-                    <filter name="not_confirmed" string="Not Confirmed" domain="[('state','!=',('confirmed'))]"/>
-                    <filter name="comfirmed" string="Confirmed" domain="[('state','=','confirmed')]"/>
-                    <filter name="cancelled" string="Cancelled" domain="[('state','=','cancelled')]"/>
-                    <filter name="today" string="Today" domain="[('date','=',time.strftime('%%m-%%d-%%Y'))]"/>
+                    <separator/>
+                    <filter name="today" string="Today" domain="[('date','=',time.strftime('%%Y-%%m-%%d'))]"/>
+                    <field name="user_id"/>
+                    <group expand="0" string="Group By...">
+                        <filter name="group_by_supplier" string="By Supplier" context="{'group_by':'supplier'}"/>
+                        <filter name="group_by_date" string="Order Month" context="{'group_by':'date'}" help="Supplier Order by Month"/>
+                    </group>
                 </search>
             </field>
         </record>
         <record id="view_lunch_employee_payment_filter" model="ir.ui.view">
             <field name='name'>lunch employee payment</field>
             <field name='model'>lunch.cashmove</field>
-            <field name='type'>search</field>
             <field name='arch' type='xml'>
                 <search string="lunch employee payment">
+                    <field name="description"/>
+                    <field name="user_id"/>
                     <filter name='is_payment' string="Payment" domain="[('state','=','payment')]"/>
-                    <filter name='is_mine' string="My Account" domain="[('user_id','=',uid)]"/>
+                    <separator/>
+                    <filter name='is_mine_group' string="My Account grouped" domain="[('user_id','=',uid)]" context="{'group_by':'user_id'}"/>
+                    <filter name="group_by_user" string="By User" context="{'group_by':'user_id'}"/>
                 </search>
             </field>
         </record>
         <record id="view_lunch_cashmove_filter" model="ir.ui.view">
             <field name='name'>lunch cashmove</field>
             <field name='model'>lunch.cashmove</field>
-            <field name='type'>search</field>
             <field name='arch' type='xml'>
                 <search string="lunch cashmove">
-                    <filter name='group_by_user' string="By Employee" context="{'group_by':'user_id'}"/>
+                    <field name="description"/>
+                    <field name="user_id"/>
+                    <group expand="0" string="Group By...">
+                        <filter name='group_by_user' string="By Employee" context="{'group_by':'user_id'}"/>
+                    </group>
                 </search>
             </field>
         </record>
         <record id="view_search_my_order" model="ir.ui.view">
             <field name='name'>lunch orders</field>
             <field name='model'>lunch.order</field>
-            <field name='type'>search</field>
             <field name='arch' type='xml'>
                 <search string="lunch orders">
+                    <field name="user_id"/>
+                    <field name="date"/>
+                    <field name="order_line_ids"/>
                     <filter name='is_mine' string="My Orders" domain="[('user_id','=',uid)]"/>
+                    <filter name='by_users' string="Users" context="{'group_by':'user_id'}"/>
                 </search>
             </field>
         </record>
 
+
+        <record model="ir.ui.view" id="alert_search_view">
+            <field name="name">Search</field>
+            <field name="model">lunch.alert</field>
+            <field name="arch" type="xml">
+                <search string="Search">
+                    <field name="message"/>
+                </search>
+            </field>
+        </record>
+
+        <!--view for cashmove-->
+        <record model="ir.ui.view" id="casmove_tree_view">
+            <field name="name">cashmove tree</field>
+            <field name="model">lunch.cashmove</field>
+            <field name="arch" type="xml">
+                <tree string="cashmove tree">
+                    <field name="date"/>
+                    <field name="user_id"/>
+                    <field name="description"/>
+                    <field name="amount" sum="Total"/>
+                </tree>
+            </field>
+        </record>
+
+        <record model="ir.ui.view" id="casmove_form_view">
+            <field name="name">cashmove form</field>
+            <field name="model">lunch.cashmove</field>
+            <field name="arch" type="xml">
+                <form string="cashmove form" version="7.0">
+                    <sheet>
+                        <group>
+                            <field name="user_id"
+                                   context="{'default_groups_ref': ['base.group_user', 'lunch.group_lunch_user']}"/>
+                            <field name="date"/>
+                            <field name="amount"/>
+                        </group>
+                        <label for='description'/>
+                        <field name="description"/>
+                    </sheet>
+                </form>
+            </field>
+        </record>
+
+
         <!--Action for Your Orders-->
         <record model="ir.actions.act_window" id="action_lunch_order_form">
-            <field name="name">Your Orders</field>
+            <field name="name">New Order</field>
             <field name="res_model">lunch.order</field>
             <field name="view_mode">form</field>
         </record>
-        <menuitem name="Your Orders" parent="menu_lunch_title" id="menu_lunch_order_form" action="action_lunch_order_form" sequence="1"/>
+        <menuitem name="New Order" parent="menu_lunch_title" id="menu_lunch_order_form" action="action_lunch_order_form" sequence="1"/>
 
         <record model="ir.actions.act_window" id="action_lunch_order_tree">
             <field name="name">Your Orders</field>
                 Click to create a lunch order. 
             </p>
             <p>
-                Use lunch order if you need to order any food for your lunch.
-              </p>
+                A lunch order is defined by its user, date and order lines.
+                Each order line corresponds to a product, an additional note and a price.
+                Before selecting your order lines, don't forget to read the warnings displayed in the reddish area.
+            </p>
             </field>
         </record>
         <menuitem name="Previous Orders" parent="menu_lunch_title" id="menu_lunch_order_tree" action="action_lunch_order_tree" sequence="2"/>
+               
+        <record model="ir.ui.view" id="casmove_tree">
+            <field name="name">cashmove tree</field>
+            <field name="model">lunch.cashmove</field>
+            <field name="arch" type="xml">
+                <tree string="cashmove tree" version="7.0" create='false'>
+                    <field name="date"/>
+                    <field name="user_id"/>
+                    <field name="description"/>
+                    <field name="amount" sum="Total"/>
+                </tree>
+            </field>
+        </record>
 
         <!--Action for Lunch cashmoves-->
         <record model="ir.actions.act_window" id="action_lunch_cashmove_form">
             <field name="res_model">lunch.cashmove</field>
             <field name="view_mode">tree</field>
             <field name="search_view_id" ref="view_lunch_employee_payment_filter"/>
-            <field name="context">{"search_default_is_mine":1}</field>
+            <field name="context">{"search_default_is_mine_group":1}</field>
+            <field name="view_id" ref="casmove_tree"/>
             <field name="help" type="html">
               <p>
-                Here you can see your cash moves. There are your orders and refund.
+                Here you can see your cash moves.<br/>A cash moves can be either an expense or a payment.
+                An expense is automatically created when an order is received while a payment is a reimbursement to the company encoded by the manager.
               </p>
             </field>
         </record>
             <field name="name">Orders by Supplier</field>
             <field name="res_model">lunch.order.line</field>
             <field name="view_mode">tree</field>
-            <field name="search_view_id" ref="view_lunch_order_filter"/>
+            <field name="search_view_id" ref="lunch_order_line_search_view"/>
             <field name="context">{"search_default_group_by_supplier":1, "search_default_today":1}</field>
             <field name="help" type="html">
               <p>
-                Here you can see the orders of the day grouped by suppliers.
+                Here you can see today's orders grouped by suppliers.
+              </p>
+              <p>
+                - Click on the <img src="../../../web/static/src/img/icons/terp-call-start.png"/> to announce that the order is ordered <br/>
+                - Click on the <img src="../../../web/static/src/img/icons/gtk-apply.png"/> to announce that the order is received <br/>
+                - Click on the <img src="../../../web/static/src/img/icons/gtk-cancel.png"/> to announce that the order isn't available
               </p>
             </field>
         </record>
             <field name="name">Control Suppliers</field>
             <field name="res_model">lunch.order.line</field>
             <field name="view_mode">tree</field>
-            <field name="search_view_id" ref="supplier_group_by_month_search_view"/> 
+            <field name="search_view_id" ref="lunch_order_line_search_view"/> 
             <field name="context">{"search_default_group_by_date":1, "search_default_group_by_supplier":1}</field>
             <field name="help" type="html">
               <p>
-                Here you can see the orders of the month grouped by suppliers.
+                Here you can see every orders grouped by suppliers and by date.
+              </p>
+              <p>
+                - Click on the <img src="../../../web/static/src/img/icons/terp-call-start.png"/> to announce that the order is ordered <br/>
+                - Click on the <img src="../../../web/static/src/img/icons/gtk-apply.png"/> to announce that the order is received <br/>
+                - Click on the <img src="../../../web/static/src/img/icons/gtk-cancel.png"/> red X to announce that the order isn't available
               </p>
             </field>
         </record>
             <field name="view_mode">tree,form</field>
             <field name="search_view_id" ref="view_lunch_cashmove_filter"/>
             <field name="context">{"search_default_group_by_user":1}</field>
+            <field name="view_id" ref="casmove_tree_view"/>
             <field name="help" type="html">
                 <p class="oe_view_nocontent_create">
-                Click to create a transaction. 
+                Click to create a new payment. 
             </p>
               <p>
-                The different cash moves are used to see the orders but also the
-                employees' refunds.
+                A cashmove can either be an expense or a payment.<br/>
+                An expense is automatically created at the order receipt.<br/>
+                A payment represents the employee reimbursement to the company.
               </p>
             </field>
         </record>
             <field name="view_mode">tree,form</field>
             <field name="search_view_id" ref="view_lunch_employee_payment_filter"/>
             <field name="context">{"search_default_is_payment":1}</field>
+            <field name="view_id" ref="casmove_tree_view"/>
             <field name="help" type="html">
                 <p class="oe_view_nocontent_create">
                 Click to create a payment. 
             </p>
               <p>
-                Here you can see the employees' refund.
+                Here you can see the employees' payment. A payment is a cash move from the employee to the company.
               </p>
             </field>
         </record>
-        <menuitem name="Employee's Payment" parent="menu_lunch_cash" id="menu_lunch_cashmove" action="action_lunch_cashmove" />
+        <menuitem name="Employee Payments" parent="menu_lunch_cash" id="menu_lunch_cashmove" action="action_lunch_cashmove" />
 
         <!--Action for Products-->
         <record model="ir.actions.act_window" id="action_lunch_products">
         <record model="ir.ui.view" id="product_category_form_view">
             <field name="name">Product category Form</field>
             <field name="model">lunch.product.category</field>
-            <field name="type">form</field>
             <field name="arch" type="xml">
                 <form string="Products Form" version="7.0">
-                    <header>
-                    </header>
                     <sheet>
-                        <group>
+                    <group>
                         <field name='name' string="Product Category: "/>
                     </group>
                     </sheet>
             <field name="name">Alerts</field>
             <field name="res_model">lunch.alert</field>
             <field name="view_mode">tree,form</field>
+            <field name="search_view_id" ref="alert_search_view"/>
             <field name="help" type="html">
                 <p class="oe_view_nocontent_create">
                 Click to create a lunch alert. 
             </p>
               <p>
-                Alerts are used to warn employee and user from possible issues about the lunch.
+                Alerts are used to warn employee from possible issues concerning the lunch orders.
+                To create a lunch alert you have to define its recurrency, the time interval during which the alert should be executed and the message to display.
+            </p>
+            <p>
+                Example: <br/>
+                - Recurency: Everyday<br/>
+                - Time interval: from 00h00 am to 11h59 pm<br/>
+                - Message: "You must order before 10h30 am"
               </p>
             </field>
         </record>
         <record model="ir.ui.view" id="orders_order_lines_tree_view">
             <field name="name">Order lines Tree</field>
             <field name="model">lunch.order.line</field>
-            <field name="type">tree</field>
             <field name="arch" type="xml">
-                <tree string="Order lines Tree"> 
+                <tree string="Order lines Tree" create="false" edit="false">
                     <field name='date'/>
                     <field name='user_id'/>
                     <field name='supplier' invisible='1'/> 
                     <field name='note'/>
                     <field name='state'/>
                     <field name='price' sum="Total"/>
-                    <button name="confirm" string="Confirm" type="object" icon="gtk-apply" attrs="{'invisible': [('state','=','confirmed')]}"/>
+                    <button name="order" string="Order" type="object" icon="terp-call-start" attrs="{'invisible': ['|',('state','=','confirmed'),('state','=','ordered')]}"/>
+                    <button name="confirm" string="Confirm" type="object" icon="gtk-apply" attrs="{'invisible': [('state','!=','ordered')]}"/>
                     <button name="cancel" string="Cancel" type="object" icon="gtk-cancel" attrs="{'invisible': [('state','=','cancelled')]}"/>
                 </tree>
             </field>
 
         <!--View for Your orders-->
         <record model="ir.ui.view" id="orders_tree_view">
-            <field name="name">Orders Tree</field>
+            <field name="name">Orders Tree View</field>
             <field name="model">lunch.order</field>
             <field name="arch" type="xml">
                 <tree string="Orders Tree">
                     <field name="date"/>
+                    <field name='user_id'/>
                     <field name="order_line_ids"/>
                     <field name="state" />
                     <field name="total" sum="Total"/>
-                    <field name="preferences" invisible="1"/>
-                    <field name="company_id" invisible="1"/>
                 </tree>
             </field>
         </record>
                     <sheet>
                         <group>
                             <group>
-                                <field name='user_id'/>
-                                <field name="company_id" invisible="1"/>
-                                <field name='currency_id' invisible='1'/>
+                                <field name='user_id'
+                                context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'lunch.group_lunch_user']}"/>
                             </group>
                             <group> 
                                 <field name='date'/>
                             </group>
                         </group>
-                        <field name='alerts' attrs="{'invisible': [('state','!=','new')]}" class="oe_inline oe_lunch_alert"/> 
+                        <field name='alerts' attrs="{'invisible': ['|',('state','!=','new'),('alerts','=',False)]}" class="oe_inline oe_lunch_alert"/> 
                         <div name="preferences">
                         </div>
-                        <separator string='Your order'/>
+                        <separator string='Select your order'/>
                         <field name='order_line_ids' nolabel='1' on_change='onchange_price(order_line_ids)'>
                             <tree string='List' editable='bottom'>
                                 <field name='product_id' on_change='onchange_price(product_id)'/>
                                 <field name='note' />
-                                <field name='price' />
+                                <field name='price' on_change='onchange_price(product_id)'/>
                                 <field name='supplier' invisible="1"/>
                                 <field name="state" invisible="1"/>
                             </tree>
                         </field> 
                         <group class='oe_subtotal_footer oe_right'>
-                            <field name='total'/> <!-- widget='monetary' options="{'currency_field': 'currency_id'}"/>-->
+                            <field name='total'/> 
                         </group>
                         <br/><br/>
                     </sheet>
         <record model="ir.ui.view" id="products_tree_view">
             <field name="name">Products Tree</field>
             <field name="model">lunch.product</field>
-            <field name="type">tree</field>
             <field name="arch" type="xml">
                 <tree string="Products Tree">
                     <field name="name"/>
                     <field name="supplier"/>
                     <field name="description"/>
                     <field name="price"/>
-                    <field name="active"/>
                 </tree>
             </field>
         </record>
         <record model="ir.ui.view" id="products_form_view">
             <field name="name">Products Form</field>
             <field name="model">lunch.product</field>
-            <field name="type">form</field>
             <field name="arch" type="xml">
                 <form string="Products Form" version="7.0">
                     <header>
                     </header>
                     <sheet>
-                        <group colspan="2" col="2">
+                        <group>
                             <field name='name'/>
                             <field name='category_id'/>
                             <field name='supplier'/>
                             <field name='price'/>
-                            <field name='active'/>
                         </group>
-                        <group colspan="2" col="2">
-                        </group>
-                        <group>
+                        <label for='description'/>
                         <field name='description'/>
-                    </group>
-                    </sheet>
-                </form>
-            </field>
-        </record>
-
-        <!--view for cashmove-->
-        <record model="ir.ui.view" id="casmove_tree_view">
-            <field name="name">cashmove tree</field>
-            <field name="model">lunch.cashmove</field>
-            <field name="type">tree</field>
-            <field name="arch" type="xml">
-                <tree string="cashmove tree">
-                    <field name="date"/>
-                    <field name="user_id"/>
-                    <field name="description"/>
-                    <field name="amount" sum="Total"/>
-                </tree>
-            </field>
-        </record>
-
-        <record model="ir.ui.view" id="casmove_form_view">
-            <field name="name">cashmove form</field>
-            <field name="model">lunch.cashmove</field>
-            <field name="type">form</field>
-            <field name="arch" type="xml">
-                <form string="cashmove form" version="7.0">
-                    <header>
-                    </header>
-                    <sheet>
-                        <group colspan="2" col="2">
-                            <field name="user_id"/>
-                            <field name="date"/>
-                            <field name="amount"/>
-                        </group>
-                         <group colspan="2" col="2">
-                        </group>
-                        <group>
-                            <field name="description"/>
-                        </group>
                     </sheet>
                 </form>
             </field>
         <record model="ir.ui.view" id="alert_tree_view">
             <field name="name">alert tree</field>
             <field name="model">lunch.alert</field>
-            <field name="type">tree</field>
             <field name="arch" type="xml">
                 <tree string="alert tree">
                     <field name="message"/>
-                    <field name="day"/>
+                    <field name="alter_type"/>
                     <field name='active_from' widget='float_time'/>
                     <field name='active_to' widget='float_time'/>
-                    <field name="lunch_active"/>
                 </tree>
             </field>
         </record>
 
         <record model="ir.ui.view" id="alert_form_view">
-            <field name="name">alert tree</field>
+            <field name="name">alert form</field>
             <field name="model">lunch.alert</field>
-            <field name="type">form</field>
             <field name="arch" type="xml">
                 <form string="alert tree" version="7.0">
-                    <header>
-                    </header>
                     <sheet>
-                    <separator string="Schedule Date" colspan="4"/>
-                        <group col="2" colspan="2">
-                            <field name="day"/>
-                            <field name="specific" attrs="{'invisible': [('day','!=','specific')]}"/>
+                        <group string="Schedule Date">
+                            <group>
+                                <field name="alter_type"/>
+                                <field name="specific_day" attrs="{'invisible': [('alter_type','!=','specific')], 'required':[('alter_type','=','specific')]}"/>
+                            </group>
                         </group>
-                        <group col="2" colspan="2">
+                        <group attrs="{'invisible': [('alter_type','!=','week')]}">
+                            <group>
+                                <field name="monday"/>
+                                <field name="tuesday"/>
+                                <field name="wednesday"/>
+                                <field name="thursday"/>
+                            </group>
+                            <group>
+                                <field name="friday"/>
+                                <field name="saturday"/>
+                                <field name="sunday"/>
+                            </group>
                         </group>
-                        <group col="2" attrs="{'invisible': [('day','!=','week')]}">
-                            <field name="monday"/>
-                            <field name="tuesday"/>
-                            <field name="wednesday"/>
-                            <field name="thursday"/>
+                        <group string="Schedule Hour">
+                            <field name='active_from' widget='float_time'/>
+                            <field name='active_to' widget='float_time'/>
                         </group>
-                        <group col="2" attrs="{'invisible': [('day','!=','week')]}">
-                            <field name="friday"/>
-                            <field name="saturday"/>
-                            <field name="sunday"/>
+                        <group string='Message'>
+                            <field name='message' nolabel='1' placeholder="Write the message you want to display during the defined period..."/>
                         </group>
-                    <separator string="Schedule Hour" colspan="4"/>
-                    <group col="2" colspan="2">
-                        <field name='active_from' widget='float_time'/>
-                        <field name='active_to' widget='float_time'/>
-                    </group>
-                    <group col="2" colspan="2">
-                    </group>
-                    <separator string="Alert Informations" colspan="4"/>
-                     <group col="2" colspan="2">
-                        <field name='lunch_active'/>
-                        <field name='message' placeholder="Write the message you want to display during the defined period..."/>
-                    </group>
-                    <group col="2" colspan="2">
-                    </group>
+
                 </sheet>
                 </form>
             </field>
         </record>
 
-        <record model='ir.ui.view' id='partner_instructor_form_view'>
-            <field name='name'>partner.supplier.name.form</field>
-            <field name='model'>res.partner</field>
-            <field name='type'>form</field>
-            <field name='inherit_id' ref='base.view_partner_form' />
-            <field name='arch' type='xml'>
-                <field name='title' position='after'>
-                    <field name='supplier_lunch'/>
-                </field> 
-            </field>
-        </record>
     </data>
 </openerp>