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                     <filter name='is_mine' string="My Orders" domain="[('user_id','=',uid)]"/>
79                 </search>
80             </field>
81         </record>
82
83         <!--Action for Your Orders-->
84         <record model="ir.actions.act_window" id="action_lunch_order_form">
85             <field name="name">Your Orders</field>
86             <field name="res_model">lunch.order</field>
87             <field name="view_mode">form</field>
88         </record>
89         <menuitem name="Your Orders" parent="menu_lunch_title" id="menu_lunch_order_form" action="action_lunch_order_form" sequence="1"/>
90
91         <record model="ir.actions.act_window" id="action_lunch_order_tree">
92             <field name="name">Your Orders</field>
93             <field name="res_model">lunch.order</field>
94             <field name="view_mode">tree,form</field>
95             <field name="search_view_id" ref="view_search_my_order"/>
96             <field name="context">{"search_default_is_mine":1}</field>
97             <field name="help" type="html">
98             <p class="oe_view_nocontent_create">
99                 Click to create a lunch order. 
100             </p>
101             <p>
102                 Select your favorite meals for today's lunch.
103             </p>
104             </field>
105         </record>
106         <menuitem name="Previous Orders" parent="menu_lunch_title" id="menu_lunch_order_tree" action="action_lunch_order_tree" sequence="2"/>
107
108         <!--Action for Lunch cashmoves-->
109         <record model="ir.actions.act_window" id="action_lunch_cashmove_form">
110             <field name="name">Your Account</field>
111             <field name="res_model">lunch.cashmove</field>
112             <field name="view_mode">tree</field>
113             <field name="search_view_id" ref="view_lunch_employee_payment_filter"/>
114             <field name="context">{"search_default_is_mine":1}</field>
115             <field name="help" type="html">
116               <p>
117                 Here you can see your cash moves.<br/>A cash moves can be either an expense or a payment.
118               </p>
119             </field>
120         </record>
121         <menuitem name="Your Lunch Account" parent="menu_lunch_title" id="menu_lunch_cashmove_form" action="action_lunch_cashmove_form" sequence="3"/>
122
123         <!--Action for Administrate Orders group by supplier-->
124         <record model="ir.actions.act_window" id="action_lunch_order_by_supplier_form">
125             <field name="name">Orders by Supplier</field>
126             <field name="res_model">lunch.order.line</field>
127             <field name="view_mode">tree</field>
128             <field name="search_view_id" ref="view_lunch_order_filter"/>
129             <field name="context">{"search_default_group_by_supplier":1, "search_default_today":1}</field>
130             <field name="help" type="html">
131               <p>
132                 Here you can see today's orders grouped by suppliers.
133               </p>
134             </field>
135         </record>
136         <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" />
137
138         <!--Action for control Supplier-->
139         <record model="ir.actions.act_window" id="action_lunch_control_suppliers">
140             <field name="name">Control Suppliers</field>
141             <field name="res_model">lunch.order.line</field>
142             <field name="view_mode">tree</field>
143             <field name="search_view_id" ref="supplier_group_by_month_search_view"/> 
144             <field name="context">{"search_default_group_by_date":1, "search_default_group_by_supplier":1}</field>
145             <field name="help" type="html">
146               <p>
147                 Here you can see every orders grouped by suppliers and by date.
148               </p>
149             </field>
150         </record>
151         <menuitem name="Orders by Supplier" parent="menu_lunch_admin" id="menu_lunch_control_suppliers" action="action_lunch_control_suppliers" />
152
153         <!--Action for Control Accounts-->
154         <record model="ir.actions.act_window" id="action_lunch_control_accounts">
155             <field name="name">Control Accounts</field>
156             <field name="res_model">lunch.cashmove</field>
157             <field name="view_mode">tree,form</field>
158             <field name="search_view_id" ref="view_lunch_cashmove_filter"/>
159             <field name="context">{"search_default_group_by_user":1}</field>
160             <field name="help" type="html">
161                 <p class="oe_view_nocontent_create">
162                 Click to create a new payment. 
163             </p>
164               <p>
165                 A cashmove can either be an expense or a payment.<br/>
166                 An expense is automatically created at the order receipt.<br/>
167                 A payment represents the employee reimbursement to the company.
168               </p>
169             </field>
170         </record>
171         <menuitem name="Control Accounts" parent="menu_lunch_cash" id="menu_lunch_control_accounts" action="action_lunch_control_accounts" />
172
173
174         <!--Action for Payment cashmove-->
175         <record model="ir.actions.act_window" id="action_lunch_cashmove">
176             <field name="name">Register Cash Moves</field>
177             <field name="res_model">lunch.cashmove</field>
178             <field name="view_mode">tree,form</field>
179             <field name="search_view_id" ref="view_lunch_employee_payment_filter"/>
180             <field name="context">{"search_default_is_payment":1}</field>
181             <field name="help" type="html">
182                 <p class="oe_view_nocontent_create">
183                 Click to create a payment. 
184             </p>
185               <p>
186                 Here you can see the employees' payment.
187               </p>
188             </field>
189         </record>
190         <menuitem name="Employee's Payment" parent="menu_lunch_cash" id="menu_lunch_cashmove" action="action_lunch_cashmove" />
191
192         <!--Action for Products-->
193         <record model="ir.actions.act_window" id="action_lunch_products">
194             <field name="name">Products</field>
195             <field name="res_model">lunch.product</field>
196             <field name="view_mode">tree,form</field>
197             <field name="help" type="html">
198                 <p class="oe_view_nocontent_create">
199                 Click to create a product for lunch. 
200             </p>
201               <p>
202                 A product is defined by its name, category, price and supplier (the supplier must be a lunch supplier).
203               </p>
204             </field>
205         </record>
206         <menuitem name="Products" parent="menu_lunch_config" id="menu_lunch_products" action="action_lunch_products" />
207
208         <!--Action for Product categories-->
209         <record model="ir.actions.act_window" id="action_lunch_product_categories">
210             <field name="name">Product Categories</field>
211             <field name="res_model">lunch.product.category</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 lunch category. 
216             </p>
217               <p>
218                 Here you can find every lunch categories for products.
219               </p>
220             </field>
221         </record>
222
223         <record model="ir.ui.view" id="product_category_form_view">
224             <field name="name">Product category Form</field>
225             <field name="model">lunch.product.category</field>
226             <field name="type">form</field>
227             <field name="arch" type="xml">
228                 <form string="Products Form" version="7.0">
229                     <header>
230                     </header>
231                     <sheet>
232                         <group>
233                         <field name='name' string="Product Category: "/>
234                     </group>
235                     </sheet>
236                 </form>
237             </field>
238         </record>
239
240         <menuitem name="Product Categories" parent="menu_lunch_config" id="menu_lunch_product_categories" action="action_lunch_product_categories" />
241
242         <!--Action for Alert-->
243         <record model="ir.actions.act_window" id="action_lunch_alert">
244             <field name="name">Alerts</field>
245             <field name="res_model">lunch.alert</field>
246             <field name="view_mode">tree,form</field>
247             <field name="help" type="html">
248                 <p class="oe_view_nocontent_create">
249                 Click to create a lunch alert. 
250             </p>
251               <p>
252                 Alerts are used to warn employee from possible issues concerning the lunch orders.<br/>
253                 To create a lunch alert you have to define its recurrency (A specific day of the year, every week or every day), the time interval during which the alert should be executed and the message to display. 
254               </p>
255             </field>
256         </record>
257         <menuitem name="Alerts" parent="menu_lunch_config" id="menu_lunch_alert" action="action_lunch_alert" />
258
259         <!--View for Order lines-->
260         <record model="ir.ui.view" id="orders_order_lines_tree_view">
261             <field name="name">Order lines Tree</field>
262             <field name="model">lunch.order.line</field>
263             <field name="type">tree</field>
264             <field name="arch" type="xml">
265                 <tree string="Order lines Tree"> 
266                     <field name='date'/>
267                     <field name='user_id'/>
268                     <field name='supplier' invisible='1'/> 
269                     <field name='product_id'/>                             
270                     <field name='note'/>
271                     <field name='state'/>
272                     <field name='price' sum="Total"/>
273                     <button name="order" string="Order" type="object" icon="terp-call-start" attrs="{'invisible': ['|',('state','=','confirmed'),('state','=','ordered')]}"/>
274                     <button name="confirm" string="Confirm" type="object" icon="gtk-apply" attrs="{'invisible': [('state','!=','ordered')]}"/>
275                     <button name="cancel" string="Cancel" type="object" icon="gtk-cancel" attrs="{'invisible': [('state','=','cancelled')]}"/>
276                 </tree>
277             </field>
278         </record>
279
280         <!--View for Your orders-->
281         <record model="ir.ui.view" id="orders_tree_view">
282             <field name="name">Orders Tree</field>
283             <field name="model">lunch.order</field>
284             <field name="arch" type="xml">
285                 <tree string="Orders Tree">
286                     <field name="date"/>
287                     <field name="order_line_ids"/>
288                     <field name="state" />
289                     <field name="total" sum="Total"/>
290                     <field name="preferences" invisible="1"/>
291                     <field name="company_id" invisible="1"/>
292                 </tree>
293             </field>
294         </record>
295        
296         <record model="ir.ui.view" id="orders_form_view">
297             <field name="name">Lunch Order</field>
298             <field name="model">lunch.order</field>
299             <field name="arch" type="xml">
300                 <form string='Orders Form' version='7.0' class="oe_lunch">
301                     <header>
302                         <field name='state' widget='statusbar' statusbar_visible='new,confirmed'/>
303                     </header>
304                     <sheet>
305                         <group>
306                             <group>
307                                 <field name='user_id'/>
308                                 <field name="company_id" invisible="1"/>
309                                 <field name='currency_id' invisible='1'/>
310                             </group>
311                             <group> 
312                                 <field name='date'/>
313                             </group>
314                         </group>
315                         <field name='alerts' attrs="{'invisible': [('state','!=','new')]}" class="oe_inline oe_lunch_alert"/> 
316                         <div name="preferences">
317                         </div>
318                         <separator string='Your order'/>
319                         <field name='order_line_ids' nolabel='1' on_change='onchange_price(order_line_ids)'>
320                             <tree string='List' editable='bottom'>
321                                 <field name='product_id' on_change='onchange_price(product_id)'/>
322                                 <field name='note' />
323                                 <field name='price' />
324                                 <field name='supplier' invisible="1"/>
325                                 <field name="state" invisible="1"/>
326                             </tree>
327                         </field> 
328                         <group class='oe_subtotal_footer oe_right'>
329                             <field name='total'/> <!-- widget='monetary' options="{'currency_field': 'currency_id'}"/>-->
330                         </group>
331                         <br/><br/>
332                     </sheet>
333                 </form>
334             </field>
335         </record>
336
337         <!--View for Products-->
338         <record model="ir.ui.view" id="products_tree_view">
339             <field name="name">Products Tree</field>
340             <field name="model">lunch.product</field>
341             <field name="type">tree</field>
342             <field name="arch" type="xml">
343                 <tree string="Products Tree">
344                     <field name="name"/>
345                     <field name="category_id"/>
346                     <field name="supplier"/>
347                     <field name="description"/>
348                     <field name="price"/>
349                     <field name="active"/>
350                 </tree>
351             </field>
352         </record>
353
354         <record model="ir.ui.view" id="products_form_view">
355             <field name="name">Products Form</field>
356             <field name="model">lunch.product</field>
357             <field name="type">form</field>
358             <field name="arch" type="xml">
359                 <form string="Products Form" version="7.0">
360                     <header>
361                     </header>
362                     <sheet>
363                         <group colspan="2" col="2">
364                             <field name='name'/>
365                             <field name='category_id'/>
366                             <field name='supplier'/>
367                             <field name='price'/>
368                             <field name='active'/>
369                         </group>
370                         <group colspan="2" col="2">
371                         </group>
372                         <group>
373                         <field name='description'/>
374                     </group>
375                     </sheet>
376                 </form>
377             </field>
378         </record>
379
380         <!--view for cashmove-->
381         <record model="ir.ui.view" id="casmove_tree_view">
382             <field name="name">cashmove tree</field>
383             <field name="model">lunch.cashmove</field>
384             <field name="type">tree</field>
385             <field name="arch" type="xml">
386                 <tree string="cashmove tree">
387                     <field name="date"/>
388                     <field name="user_id"/>
389                     <field name="description"/>
390                     <field name="amount" sum="Total"/>
391                 </tree>
392             </field>
393         </record>
394
395         <record model="ir.ui.view" id="casmove_form_view">
396             <field name="name">cashmove form</field>
397             <field name="model">lunch.cashmove</field>
398             <field name="type">form</field>
399             <field name="arch" type="xml">
400                 <form string="cashmove form" version="7.0">
401                     <header>
402                     </header>
403                     <sheet>
404                         <group colspan="2" col="2">
405                             <field name="user_id"/>
406                             <field name="date"/>
407                             <field name="amount"/>
408                         </group>
409                          <group colspan="2" col="2">
410                         </group>
411                         <group>
412                             <field name="description"/>
413                         </group>
414                     </sheet>
415                 </form>
416             </field>
417         </record>
418
419         <!--view for alerts-->
420         <record model="ir.ui.view" id="alert_tree_view">
421             <field name="name">alert tree</field>
422             <field name="model">lunch.alert</field>
423             <field name="type">tree</field>
424             <field name="arch" type="xml">
425                 <tree string="alert tree">
426                     <field name="message"/>
427                     <field name="day"/>
428                     <field name='active_from' widget='float_time'/>
429                     <field name='active_to' widget='float_time'/>
430                     <field name="lunch_active"/>
431                 </tree>
432             </field>
433         </record>
434
435         <record model="ir.ui.view" id="alert_form_view">
436             <field name="name">alert tree</field>
437             <field name="model">lunch.alert</field>
438             <field name="type">form</field>
439             <field name="arch" type="xml">
440                 <form string="alert tree" version="7.0">
441                     <header>
442                     </header>
443                     <sheet>
444                     <separator string="Schedule Date" colspan="4"/>
445                         <group col="2" colspan="2">
446                             <field name="day"/>
447                             <field name="specific" attrs="{'invisible': [('day','!=','specific')]}"/>
448                         </group>
449                         <group col="2" colspan="2">
450                         </group>
451                         <group col="2" attrs="{'invisible': [('day','!=','week')]}">
452                             <field name="monday"/>
453                             <field name="tuesday"/>
454                             <field name="wednesday"/>
455                             <field name="thursday"/>
456                         </group>
457                         <group col="2" attrs="{'invisible': [('day','!=','week')]}">
458                             <field name="friday"/>
459                             <field name="saturday"/>
460                             <field name="sunday"/>
461                         </group>
462                     <separator string="Schedule Hour" colspan="4"/>
463                     <group col="2" colspan="2">
464                         <field name='active_from' widget='float_time'/>
465                         <field name='active_to' widget='float_time'/>
466                     </group>
467                     <group col="2" colspan="2">
468                     </group>
469                     <separator string="Alert Informations" colspan="4"/>
470                      <group col="2" colspan="2">
471                         <field name='lunch_active'/>
472                         <field name='message' placeholder="Write the message you want to display during the defined period..."/>
473                     </group>
474                     <group col="2" colspan="2">
475                     </group>
476                 </sheet>
477                 </form>
478             </field>
479         </record>
480
481         <record model='ir.ui.view' id='partner_instructor_form_view'>
482             <field name='name'>partner.supplier.name.form</field>
483             <field name='model'>res.partner</field>
484             <field name='type'>form</field>
485             <field name='inherit_id' ref='base.view_partner_form' />
486             <field name='arch' type='xml'>
487                 <field name='title' position='after'>
488                     <field name='supplier_lunch'/>
489                 </field> 
490             </field>
491         </record>
492     </data>
493 </openerp>