[IMP] lunch search view improved to search on user too
[odoo/odoo.git] / addons / lunch / lunch_view.xml
1 <?xml version="1.0"?>
2 <openerp>
3     <data>
4         <!-- Top menu item -->
5         <menuitem id='menu_lunch' name='Lunch' sequence="100" groups="group_lunch_user"/>
6         <menuitem name="Lunch" parent="menu_lunch" id="menu_lunch_title" sequence="50" />
7         <menuitem name="Administrate Orders" parent="menu_lunch" id="menu_lunch_admin" sequence="51" groups="group_lunch_manager"/>
8         <menuitem name="Administrate Cash Moves" parent="menu_lunch" id="menu_lunch_cash" sequence="52" groups="group_lunch_manager"/>
9         <menuitem name="Configuration" parent="menu_lunch" id="menu_lunch_config" sequence="53" groups="group_lunch_manager"/>
10         
11          <!--View Search to group/filter by Supplier and time-->
12         <record model="ir.ui.view" id="lunch_order_line_search_view">
13             <field name="name">Search</field>
14             <field name="model">lunch.order.line</field>
15             <field name="arch" type="xml">
16                 <search string="Search">
17                     <field name="name" filter_domain="['|', ('name', 'ilike', self), ('note', 'ilike', self)]"/>
18                     <filter name="not_confirmed" string="Not Received" domain="[('state','!=',('confirmed'))]"/>
19                     <filter name="comfirmed" string="Received" domain="[('state','=','confirmed')]"/>
20                     <filter name="cancelled" string="Cancelled" domain="[('state','=','cancelled')]"/>
21                     <separator/>
22                     <filter name="today" string="Today" domain="[('date','=',time.strftime('%%Y-%%m-%%d'))]"/>
23                     <field name="user_id"/>
24                     <group expand="0" string="Group By...">
25                         <filter name="group_by_supplier" string="By Supplier" context="{'group_by':'supplier'}"/>
26                         <filter name="group_by_date" string="By Date" context="{'group_by':'date'}"/>
27                     </group>
28                 </search>
29             </field>
30         </record>
31
32         <!--View Search to group by employee and input/output (cashmoves)-->
33         <record id="view_lunch_employee_payment_filter" model="ir.ui.view">
34             <field name='name'>lunch employee payment</field>
35             <field name='model'>lunch.cashmove</field>
36             <field name='arch' type='xml'>
37                 <search string="lunch employee payment">
38                     <field name="description"/>
39                     <field name="user_id"/>
40                     <filter name='is_payment' string="Payment" domain="[('state','=','payment')]"/>
41                     <separator/>
42                     <filter name='is_mine' string="My Account" domain="[('user_id','=',uid)]"/>
43                 </search>
44             </field>
45         </record>
46
47         <record id="view_lunch_cashmove_filter" model="ir.ui.view">
48             <field name='name'>lunch cashmove</field>
49             <field name='model'>lunch.cashmove</field>
50             <field name='arch' type='xml'>
51                 <search string="lunch cashmove">
52                     <field name="description"/>
53                     <field name="user_id"/>
54                     <group expand="0" string="Group By...">
55                         <filter name='group_by_user' string="By Employee" context="{'group_by':'user_id'}"/>
56                     </group>
57                 </search>
58             </field>
59         </record>
60
61         <!--View search for order-->
62         <record id="view_search_my_order" model="ir.ui.view">
63             <field name='name'>lunch orders</field>
64             <field name='model'>lunch.order</field>
65             <field name='arch' type='xml'>
66                 <search string="lunch orders">
67                     <field name="user_id"/>
68                     <field name="date"/>
69                     <field name="order_line_ids"/>
70                     <filter name='is_mine' string="My Orders" domain="[('user_id','=',uid)]"/>
71                 </search>
72             </field>
73         </record>
74
75
76         <record model="ir.ui.view" id="alert_search_view">
77             <field name="name">Search</field>
78             <field name="model">lunch.alert</field>
79             <field name="arch" type="xml">
80                 <search string="Search">
81                     <field name="message"/>
82                 </search>
83             </field>
84         </record>
85
86         <!--Action for Your Orders-->
87         <record model="ir.actions.act_window" id="action_lunch_order_form">
88             <field name="name">New Order</field>
89             <field name="res_model">lunch.order</field>
90             <field name="view_mode">form</field>
91         </record>
92         <menuitem name="New Order" parent="menu_lunch_title" id="menu_lunch_order_form" action="action_lunch_order_form" sequence="1"/>
93
94         <record model="ir.actions.act_window" id="action_lunch_order_tree">
95             <field name="name">Your Orders</field>
96             <field name="res_model">lunch.order</field>
97             <field name="view_mode">tree,form</field>
98             <field name="search_view_id" ref="view_search_my_order"/>
99             <field name="context">{"search_default_is_mine":1}</field>
100             <field name="help" type="html">
101             <p class="oe_view_nocontent_create">
102                 Click to create a lunch order. 
103             </p>
104             <p>
105                 A lunch order is defined by its user, date and order lines.
106                 Each order line corresponds to a product, an additional note and a price.
107                 Before selecting your order lines, don't forget to read the warnings displayed in the reddish area.
108             </p>
109             </field>
110         </record>
111         <menuitem name="Previous Orders" parent="menu_lunch_title" id="menu_lunch_order_tree" action="action_lunch_order_tree" sequence="2"/>
112
113         <!--Action for Lunch cashmoves-->
114         <record model="ir.actions.act_window" id="action_lunch_cashmove_form">
115             <field name="name">Your Account</field>
116             <field name="res_model">lunch.cashmove</field>
117             <field name="view_mode">tree</field>
118             <field name="search_view_id" ref="view_lunch_employee_payment_filter"/>
119             <field name="context">{"search_default_is_mine":1}</field>
120             <field name="help" type="html">
121               <p>
122                 Here you can see your cash moves.<br/>A cash moves can be either an expense or a payment.
123                 An expense is automatically created when an order is received while a payment is a reimbursement to the company encoded by the manager.
124               </p>
125             </field>
126         </record>
127         <menuitem name="Your Lunch Account" parent="menu_lunch_title" id="menu_lunch_cashmove_form" action="action_lunch_cashmove_form" sequence="3"/>
128
129         <!--Action for Administrate Orders group by supplier-->
130         <record model="ir.actions.act_window" id="action_lunch_order_by_supplier_form">
131             <field name="name">Orders by Supplier</field>
132             <field name="res_model">lunch.order.line</field>
133             <field name="view_mode">tree</field>
134             <field name="search_view_id" ref="lunch_order_line_search_view"/>
135             <field name="context">{"search_default_group_by_supplier":1, "search_default_today":1}</field>
136             <field name="help" type="html">
137               <p>
138                 Here you can see today's orders grouped by suppliers.
139               </p>
140               <p>
141                 - Click on the <img src="../../../web/static/src/img/icons/terp-call-start.png"/> to announce that the order is ordered <br/>
142                 - Click on the <img src="../../../web/static/src/img/icons/gtk-apply.png"/> to announce that the order is received <br/>
143                 - Click on the <img src="../../../web/static/src/img/icons/gtk-cancel.png"/> to announce that the order isn't available
144               </p>
145             </field>
146         </record>
147         <menuitem name="Today's Orders by Supplier" parent="menu_lunch_admin" id="menu_lunch_order_by_supplier_form" action="action_lunch_order_by_supplier_form" />
148
149         <!--Action for control Supplier-->
150         <record model="ir.actions.act_window" id="action_lunch_control_suppliers">
151             <field name="name">Control Suppliers</field>
152             <field name="res_model">lunch.order.line</field>
153             <field name="view_mode">tree</field>
154             <field name="search_view_id" ref="lunch_order_line_search_view"/> 
155             <field name="context">{"search_default_group_by_date":1, "search_default_group_by_supplier":1}</field>
156             <field name="help" type="html">
157               <p>
158                 Here you can see every orders grouped by suppliers and by date.
159               </p>
160               <p>
161                 - Click on the <img src="../../../web/static/src/img/icons/terp-call-start.png"/> to announce that the order is ordered <br/>
162                 - Click on the <img src="../../../web/static/src/img/icons/gtk-apply.png"/> to announce that the order is received <br/>
163                 - Click on the <img src="../../../web/static/src/img/icons/gtk-cancel.png"/> red X to announce that the order isn't available
164               </p>
165             </field>
166         </record>
167         <menuitem name="Orders by Supplier" parent="menu_lunch_admin" id="menu_lunch_control_suppliers" action="action_lunch_control_suppliers" />
168
169         <!--Action for Control Accounts-->
170         <record model="ir.actions.act_window" id="action_lunch_control_accounts">
171             <field name="name">Control Accounts</field>
172             <field name="res_model">lunch.cashmove</field>
173             <field name="view_mode">tree,form</field>
174             <field name="search_view_id" ref="view_lunch_cashmove_filter"/>
175             <field name="context">{"search_default_group_by_user":1}</field>
176             <field name="help" type="html">
177                 <p class="oe_view_nocontent_create">
178                 Click to create a new payment. 
179             </p>
180               <p>
181                 A cashmove can either be an expense or a payment.<br/>
182                 An expense is automatically created at the order receipt.<br/>
183                 A payment represents the employee reimbursement to the company.
184               </p>
185             </field>
186         </record>
187         <menuitem name="Control Accounts" parent="menu_lunch_cash" id="menu_lunch_control_accounts" action="action_lunch_control_accounts" />
188
189
190         <!--Action for Payment cashmove-->
191         <record model="ir.actions.act_window" id="action_lunch_cashmove">
192             <field name="name">Register Cash Moves</field>
193             <field name="res_model">lunch.cashmove</field>
194             <field name="view_mode">tree,form</field>
195             <field name="search_view_id" ref="view_lunch_employee_payment_filter"/>
196             <field name="context">{"search_default_is_payment":1}</field>
197             <field name="help" type="html">
198                 <p class="oe_view_nocontent_create">
199                 Click to create a payment. 
200             </p>
201               <p>
202                 Here you can see the employees' payment. A payment is a cash move from the employee to the company.
203               </p>
204             </field>
205         </record>
206         <menuitem name="Employee's Payment" parent="menu_lunch_cash" id="menu_lunch_cashmove" action="action_lunch_cashmove" />
207
208         <!--Action for Products-->
209         <record model="ir.actions.act_window" id="action_lunch_products">
210             <field name="name">Products</field>
211             <field name="res_model">lunch.product</field>
212             <field name="view_mode">tree,form</field>
213             <field name="help" type="html">
214                 <p class="oe_view_nocontent_create">
215                 Click to create a product for lunch. 
216             </p>
217               <p>
218                 A product is defined by its name, category, price and supplier.
219               </p>
220             </field>
221         </record>
222         <menuitem name="Products" parent="menu_lunch_config" id="menu_lunch_products" action="action_lunch_products" />
223
224         <!--Action for Product categories-->
225         <record model="ir.actions.act_window" id="action_lunch_product_categories">
226             <field name="name">Product Categories</field>
227             <field name="res_model">lunch.product.category</field>
228             <field name="view_mode">tree,form</field>
229             <field name="help" type="html">
230                 <p class="oe_view_nocontent_create">
231                 Click to create a lunch category. 
232             </p>
233               <p>
234                 Here you can find every lunch categories for products.
235               </p>
236             </field>
237         </record>
238
239         <record model="ir.ui.view" id="product_category_form_view">
240             <field name="name">Product category Form</field>
241             <field name="model">lunch.product.category</field>
242             <field name="arch" type="xml">
243                 <form string="Products Form" version="7.0">
244                     <sheet>
245                     <group>
246                         <field name='name' string="Product Category: "/>
247                     </group>
248                     </sheet>
249                 </form>
250             </field>
251         </record>
252
253         <menuitem name="Product Categories" parent="menu_lunch_config" id="menu_lunch_product_categories" action="action_lunch_product_categories" />
254
255         <!--Action for Alert-->
256         <record model="ir.actions.act_window" id="action_lunch_alert">
257             <field name="name">Alerts</field>
258             <field name="res_model">lunch.alert</field>
259             <field name="view_mode">tree,form</field>
260             <field name="search_view_id" ref="alert_search_view"/>
261             <field name="help" type="html">
262                 <p class="oe_view_nocontent_create">
263                 Click to create a lunch alert. 
264             </p>
265               <p>
266                 Alerts are used to warn employee from possible issues concerning the lunch orders.
267                 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.
268             </p>
269             <p>
270                 Example: <br/>
271                 - Recurency: Everyday<br/>
272                 - Time interval: from 00h00 am to 11h59 pm<br/>
273                 - Message: "You must order before 10h30 am"
274               </p>
275             </field>
276         </record>
277         <menuitem name="Alerts" parent="menu_lunch_config" id="menu_lunch_alert" action="action_lunch_alert" />
278
279         <!--View for Order lines-->
280         <record model="ir.ui.view" id="orders_order_lines_tree_view">
281             <field name="name">Order lines Tree</field>
282             <field name="model">lunch.order.line</field>
283             <field name="arch" type="xml">
284                 <tree string="Order lines Tree"> 
285                     <field name='date'/>
286                     <field name='user_id'/>
287                     <field name='supplier' invisible='1'/> 
288                     <field name='product_id'/>                             
289                     <field name='note'/>
290                     <field name='state'/>
291                     <field name='price' sum="Total"/>
292                     <button name="order" string="Order" type="object" icon="terp-call-start" attrs="{'invisible': ['|',('state','=','confirmed'),('state','=','ordered')]}"/>
293                     <button name="confirm" string="Confirm" type="object" icon="gtk-apply" attrs="{'invisible': [('state','!=','ordered')]}"/>
294                     <button name="cancel" string="Cancel" type="object" icon="gtk-cancel" attrs="{'invisible': [('state','=','cancelled')]}"/>
295                 </tree>
296             </field>
297         </record>
298
299         <!--View for Your orders-->
300         <record model="ir.ui.view" id="orders_tree_view">
301             <field name="name">Orders Tree View</field>
302             <field name="model">lunch.order</field>
303             <field name="arch" type="xml">
304                 <tree string="Orders Tree">
305                     <field name="date"/>
306                     <field name="order_line_ids"/>
307                     <field name="state" />
308                     <field name="total" sum="Total"/>
309                 </tree>
310             </field>
311         </record>
312        
313         <record model="ir.ui.view" id="orders_form_view">
314             <field name="name">Lunch Order</field>
315             <field name="model">lunch.order</field>
316             <field name="arch" type="xml">
317                 <form string='Orders Form' version='7.0' class="oe_lunch">
318                     <header>
319                         <field name='state' widget='statusbar' statusbar_visible='new,confirmed'/>
320                     </header>
321                     <sheet>
322                         <group>
323                             <group>
324                                 <field name='user_id'/>
325                             </group>
326                             <group> 
327                                 <field name='date'/>
328                             </group>
329                         </group>
330                         <field name='alerts' attrs="{'invisible': ['|',('state','!=','new'),('alerts','=',False)]}" class="oe_inline oe_lunch_alert"/> 
331                         <div name="preferences">
332                         </div>
333                         <separator string='Select your order'/>
334                         <field name='order_line_ids' nolabel='1' on_change='onchange_price(order_line_ids)'>
335                             <tree string='List' editable='bottom'>
336                                 <field name='product_id' on_change='onchange_price(product_id)'/>
337                                 <field name='note' />
338                                 <field name='price' on_change='onchange_price(product_id)'/>
339                                 <field name='supplier' invisible="1"/>
340                                 <field name="state" invisible="1"/>
341                             </tree>
342                         </field> 
343                         <group class='oe_subtotal_footer oe_right'>
344                             <field name='total'/> 
345                         </group>
346                         <br/><br/>
347                     </sheet>
348                 </form>
349             </field>
350         </record>
351
352         <!--View for Products-->
353         <record model="ir.ui.view" id="products_tree_view">
354             <field name="name">Products Tree</field>
355             <field name="model">lunch.product</field>
356             <field name="arch" type="xml">
357                 <tree string="Products Tree">
358                     <field name="name"/>
359                     <field name="category_id"/>
360                     <field name="supplier"/>
361                     <field name="description"/>
362                     <field name="price"/>
363                 </tree>
364             </field>
365         </record>
366
367         <record model="ir.ui.view" id="products_form_view">
368             <field name="name">Products Form</field>
369             <field name="model">lunch.product</field>
370             <field name="arch" type="xml">
371                 <form string="Products Form" version="7.0">
372                     <header>
373                     </header>
374                     <sheet>
375                         <group>
376                             <field name='name'/>
377                             <field name='category_id'/>
378                             <field name='supplier'/>
379                             <field name='price'/>
380                         </group>
381                         <label for='description'/>
382                         <field name='description'/>
383                     </sheet>
384                 </form>
385             </field>
386         </record>
387
388         <!--view for cashmove-->
389         <record model="ir.ui.view" id="casmove_tree_view">
390             <field name="name">cashmove tree</field>
391             <field name="model">lunch.cashmove</field>
392             <field name="arch" type="xml">
393                 <tree string="cashmove tree">
394                     <field name="date"/>
395                     <field name="user_id"/>
396                     <field name="description"/>
397                     <field name="amount" sum="Total"/>
398                 </tree>
399             </field>
400         </record>
401
402         <record model="ir.ui.view" id="casmove_form_view">
403             <field name="name">cashmove form</field>
404             <field name="model">lunch.cashmove</field>
405             <field name="arch" type="xml">
406                 <form string="cashmove form" version="7.0">
407                     <sheet>
408                         <group>
409                             <field name="user_id"/>
410                             <field name="date"/>
411                             <field name="amount"/>
412                         </group>
413                         <label for='description'/>
414                         <field name="description"/>
415                     </sheet>
416                 </form>
417             </field>
418         </record>
419
420         <!--view for alerts-->
421         <record model="ir.ui.view" id="alert_tree_view">
422             <field name="name">alert tree</field>
423             <field name="model">lunch.alert</field>
424             <field name="arch" type="xml">
425                 <tree string="alert tree">
426                     <field name="message"/>
427                     <field name="alter_type"/>
428                     <field name='active_from' widget='float_time'/>
429                     <field name='active_to' widget='float_time'/>
430                 </tree>
431             </field>
432         </record>
433
434         <record model="ir.ui.view" id="alert_form_view">
435             <field name="name">alert form</field>
436             <field name="model">lunch.alert</field>
437             <field name="arch" type="xml">
438                 <form string="alert tree" version="7.0">
439                     <sheet>
440                         <group string="Schedule Date">
441                             <group>
442                                 <field name="alter_type"/>
443                                 <field name="specific_day" attrs="{'invisible': [('alter_type','!=','specific')], 'required':[('alter_type','=','specific')]}"/>
444                             </group>
445                         </group>
446                         <group attrs="{'invisible': [('alter_type','!=','week')]}">
447                             <group>
448                                 <field name="monday"/>
449                                 <field name="tuesday"/>
450                                 <field name="wednesday"/>
451                                 <field name="thursday"/>
452                             </group>
453                             <group>
454                                 <field name="friday"/>
455                                 <field name="saturday"/>
456                                 <field name="sunday"/>
457                             </group>
458                         </group>
459                         <group string="Schedule Hour">
460                             <field name='active_from' widget='float_time'/>
461                             <field name='active_to' widget='float_time'/>
462                         </group>
463                         <group string='Message'>
464                             <field name='message' nolabel='1' placeholder="Write the message you want to display during the defined period..."/>
465                         </group>
466
467                 </sheet>
468                 </form>
469             </field>
470         </record>
471
472     </data>
473 </openerp>