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