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                     <field name="company_id" invisible="1"/>
322                 </tree>
323             </field>
324         </record>
325        
326         <record model="ir.ui.view" id="orders_form_view">
327             <field name="name">Lunch Order</field>
328             <field name="model">lunch.order</field>
329             <field name="arch" type="xml">
330                 <form string='Orders Form' version='7.0' class="oe_lunch">
331                     <header>
332                         <field name='state' widget='statusbar' statusbar_visible='new,confirmed'/>
333                     </header>
334                     <sheet>
335                         <group>
336                             <group>
337                                 <field name='user_id'/>
338                                 <field name="company_id" invisible="1"/>
339                                 <field name='currency_id' invisible='1'/>
340                             </group>
341                             <group> 
342                                 <field name='date'/>
343                             </group>
344                         </group>
345                         <field name='alerts' attrs="{'invisible': [('state','!=','new')]}" class="oe_inline oe_lunch_alert"/> 
346                         <div name="preferences">
347                         </div>
348                         <separator string='Your order'/>
349                         <field name='order_line_ids' nolabel='1' on_change='onchange_price(order_line_ids)'>
350                             <tree string='List' editable='bottom'>
351                                 <field name='product_id' on_change='onchange_price(product_id)'/>
352                                 <field name='note' />
353                                 <field name='price' />
354                                 <field name='supplier' invisible="1"/>
355                                 <field name="state" invisible="1"/>
356                             </tree>
357                         </field> 
358                         <group class='oe_subtotal_footer oe_right'>
359                             <field name='total'/> <!-- widget='monetary' options="{'currency_field': 'currency_id'}"/>-->
360                         </group>
361                         <br/><br/>
362                     </sheet>
363                 </form>
364             </field>
365         </record>
366
367         <!--View for Products-->
368         <record model="ir.ui.view" id="products_tree_view">
369             <field name="name">Products Tree</field>
370             <field name="model">lunch.product</field>
371             <field name="type">tree</field>
372             <field name="arch" type="xml">
373                 <tree string="Products Tree">
374                     <field name="name"/>
375                     <field name="category_id"/>
376                     <field name="supplier"/>
377                     <field name="description"/>
378                     <field name="price"/>
379                 </tree>
380             </field>
381         </record>
382
383         <record model="ir.ui.view" id="products_form_view">
384             <field name="name">Products Form</field>
385             <field name="model">lunch.product</field>
386             <field name="type">form</field>
387             <field name="arch" type="xml">
388                 <form string="Products Form" version="7.0">
389                     <header>
390                     </header>
391                     <sheet>
392                         <group>
393                             <field name='name'/>
394                             <field name='category_id'/>
395                             <field name='supplier'/>
396                             <field name='price'/>
397                         </group>
398                         <label for='description'/>
399                         <field name='description'/>
400                     </sheet>
401                 </form>
402             </field>
403         </record>
404
405         <!--view for cashmove-->
406         <record model="ir.ui.view" id="casmove_tree_view">
407             <field name="name">cashmove tree</field>
408             <field name="model">lunch.cashmove</field>
409             <field name="type">tree</field>
410             <field name="arch" type="xml">
411                 <tree string="cashmove tree">
412                     <field name="date"/>
413                     <field name="user_id"/>
414                     <field name="description"/>
415                     <field name="amount" sum="Total"/>
416                 </tree>
417             </field>
418         </record>
419
420         <record model="ir.ui.view" id="casmove_form_view">
421             <field name="name">cashmove form</field>
422             <field name="model">lunch.cashmove</field>
423             <field name="type">form</field>
424             <field name="arch" type="xml">
425                 <form string="cashmove form" version="7.0">
426                     <sheet>
427                         <group>
428                             <field name="user_id"/>
429                             <field name="date"/>
430                             <field name="amount"/>
431                         </group>
432                         <label for='description'/>
433                         <field name="description"/>
434                     </sheet>
435                 </form>
436             </field>
437         </record>
438
439         <!--view for alerts-->
440         <record model="ir.ui.view" id="alert_tree_view">
441             <field name="name">alert tree</field>
442             <field name="model">lunch.alert</field>
443             <field name="type">tree</field>
444             <field name="arch" type="xml">
445                 <tree string="alert tree">
446                     <field name="message"/>
447                     <field name="day"/>
448                     <field name='active_from' widget='float_time'/>
449                     <field name='active_to' widget='float_time'/>
450                 </tree>
451             </field>
452         </record>
453
454         <record model="ir.ui.view" id="alert_form_view">
455             <field name="name">alert form</field>
456             <field name="model">lunch.alert</field>
457             <field name="type">form</field>
458             <field name="arch" type="xml">
459                 <form string="alert tree" version="7.0">
460                     <sheet>
461                         <group string="Schedule Date">
462                             <group>
463                                 <field name="day"/>
464                                 <field name="specific" attrs="{'invisible': [('day','!=','specific')], 'required':[('day','=','specific')]}"/>
465                             </group>
466                         </group>
467                         <group attrs="{'invisible': [('day','!=','week')]}">
468                             <group>
469                                 <field name="monday"/>
470                                 <field name="tuesday"/>
471                                 <field name="wednesday"/>
472                                 <field name="thursday"/>
473                             </group>
474                             <group>
475                                 <field name="friday"/>
476                                 <field name="saturday"/>
477                                 <field name="sunday"/>
478                             </group>
479                         </group>
480                         <group string="Schedule Hour">
481                             <field name='active_from' widget='float_time'/>
482                             <field name='active_to' widget='float_time'/>
483                         </group>
484                         <group string='Message'>
485                             <field name='message' nolabel='1' placeholder="Write the message you want to display during the defined period..."/>
486                         </group>
487
488                 </sheet>
489                 </form>
490             </field>
491         </record>
492
493     </data>
494 </openerp>