[MERGE] forward port of branch 7.0 up to de07c64
[odoo/odoo.git] / addons / lunch / lunch_view.xml
index 2a09e55..c5fa52a 100644 (file)
@@ -1,42 +1,30 @@
 <?xml version="1.0"?>
 <openerp>
     <data>
-        <!--Menu and Title-->
-        <menuitem id='menu_lunch' name='Lunch' sequence="300"/>
+        <!-- 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">
-                    <field name="note"/>
-                    <filter name="group_by_supplier" string="By Supplier" context="{'group_by':'supplier'}"/>
+                    <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">
-                    <field name="note"/>
-                    <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="user_id"/>
                     <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">
-                    <field name="user_id"/>
                     <field name="description"/>
-                    <filter name='group_by_user' string="By Employee" context="{'group_by':'user_id'}"/>
+                    <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>
@@ -87,7 +78,6 @@
         <record model="ir.ui.view" id="alert_search_view">
             <field name="name">Search</field>
             <field name="model">lunch.alert</field>
-            <field name="type">search</field>
             <field name="arch" type="xml">
                 <search string="Search">
                     <field name="message"/>
             </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 Order</field>
+            <field name="name">New Order</field>
             <field name="res_model">lunch.order</field>
             <field name="view_mode">form</field>
         </record>
-        <menuitem name="Your Order" 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>
             </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.<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 encoded by the manager.
+                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 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 meal is ordered <br/>
-                - Click on the <img src="../../../web/static/src/img/icons/gtk-apply.png"/> to announce that the meal is received <br/>
-                - Click on the <img src="../../../web/static/src/img/icons/gtk-cancel.png"/> to announce that the meal isn't available
+                - 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 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 meal is ordered <br/>
-                - Click on the <img src="../../../web/static/src/img/icons/gtk-apply.png"/> to announce that the meal is received <br/>
-                - Click on the <img src="../../../web/static/src/img/icons/gtk-cancel.png"/> red X to announce that the meal isn't available
+                - 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 new payment. 
             <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' payment.
+                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">
                 Click to create a product for lunch. 
             </p>
               <p>
-                A product is defined by its name, category, price and supplier (the supplier must be a lunch supplier).
+                A product is defined by its name, category, price and supplier.
               </p>
             </field>
         </record>
         <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">
                     <sheet>
         <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'/> 
         <record model="ir.ui.view" id="orders_tree_view">
             <field name="name">Orders Tree View</field>
             <field name="model">lunch.order</field>
-            <field name="type">tree</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"/>
                     <sheet>
                         <group>
                             <group>
-                                <field name='user_id'/>
+                                <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>
         <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"/>
         <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>
             </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">
-                    <sheet>
-                        <group>
-                            <field name="user_id"/>
-                            <field name="date"/>
-                            <field name="amount"/>
-                        </group>
-                        <label for='description'/>
-                        <field name="description"/>
-                    </sheet>
-                </form>
-            </field>
-        </record>
-
         <!--view for alerts-->
         <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'/>
                 </tree>
         <record model="ir.ui.view" id="alert_form_view">
             <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">
                     <sheet>
                         <group string="Schedule Date">
                             <group>
-                                <field name="day"/>
-                                <field name="specific" attrs="{'invisible': [('day','!=','specific')], 'required':[('day','=','specific')]}"/>
+                                <field name="alter_type"/>
+                                <field name="specific_day" attrs="{'invisible': [('alter_type','!=','specific')], 'required':[('alter_type','=','specific')]}"/>
                             </group>
                         </group>
-                        <group attrs="{'invisible': [('day','!=','week')]}">
+                        <group attrs="{'invisible': [('alter_type','!=','week')]}">
                             <group>
                                 <field name="monday"/>
                                 <field name="tuesday"/>