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