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