[IMP]sale: improve priority og quotation tree view
[odoo/odoo.git] / addons / sale / sale_view.xml
1 <?xml version="1.0" encoding="utf-8"?>
2 <openerp>
3     <data>
4
5         <!-- Top menu item -->
6         <!--
7             This menu item's purpose is to overwrite another one defined in
8             the base module in order to set new groups.
9         -->
10         <menuitem name="Sales"
11             id="base.menu_base_partner"
12             groups="base.group_sale_salesman,base.group_sale_manager"/>
13
14         <menuitem id="base.menu_product" name="Products" parent="base.menu_base_partner" sequence="9"/>
15
16
17         <record id="view_shop_form" model="ir.ui.view">
18             <field name="name">sale.shop</field>
19             <field name="model">sale.shop</field>
20             <field name="arch" type="xml">
21                 <form string="Sales Shop" version="7.0">
22                     <label for="name" class="oe_edit_only"/>
23                     <h1><field name="name"/></h1>
24                     <group name="shop">
25                         <group>
26                             <field name="payment_default_id"/>
27                             <field domain="[('type','=','sale')]" name="pricelist_id" groups="product.group_sale_pricelist"/>
28                         </group>
29                         <group>
30                             <field name="project_id" groups="analytic.group_analytic_accounting"/>
31                             <field name="company_id" widget="selection" groups="base.group_multi_company"/>
32                         </group>
33                     </group>
34                 </form>
35            </field>
36         </record>
37         
38         <record id="view_shop_tree" model="ir.ui.view">
39             <field name="name">sale.shop</field>
40             <field name="model">sale.shop</field>
41             <field name="arch" type="xml">
42                 <tree string="Sales Shop">
43                     <field name="name"/>
44                     <field name="pricelist_id" groups="product.group_sale_pricelist"/>
45                     <field name="project_id" groups="analytic.group_analytic_accounting"/>
46                 </tree>
47             </field>
48         </record>
49
50         <record id="action_shop_form" model="ir.actions.act_window">
51             <field name="name">Shop</field>
52             <field name="type">ir.actions.act_window</field>
53             <field name="res_model">sale.shop</field>
54             <field name="view_type">form</field>
55             <field name="view_mode">tree,form</field>
56             <field name="view_id" ref="view_shop_tree"/>
57             <field name="help" type="html">
58               <p class="oe_view_nocontent_create">
59                 Click to define a new sale shop.
60               </p><p>
61                 Each quotation or sale order must be linked to a shop. The
62                 shop also defines the warehouse from which the products will be
63                 delivered for each particular sales.
64               </p>
65             </field>
66         </record>
67
68
69         <!-- Sale order Read/Unread actions -->
70         <record id="actions_server_sale_order_unread" model="ir.actions.server">
71             <field name="name">Mark unread</field>
72             <field name="condition">True</field>
73             <field name="type">ir.actions.server</field>
74             <field name="model_id" ref="model_sale_order"/>
75             <field name="state">code</field>
76             <field name="code">self.message_check_and_set_unread(cr, uid, context.get('active_ids'), context=context)</field>
77         </record>
78         <record id="action_sale_order_unread" model="ir.values">
79             <field name="name">action_sale_order_unread</field>
80             <field name="action_id" ref="actions_server_sale_order_unread"/>
81             <field name="value" eval="'ir.actions.server,' + str(ref('actions_server_sale_order_unread'))" />
82             <field name="key">action</field>
83             <field name="model_id" ref="model_sale_order" />
84             <field name="model">sale.order</field>
85             <field name="key2">client_action_multi</field>
86         </record>
87
88         <record id="actions_server_sale_order_read" model="ir.actions.server">
89             <field name="name">Mark read</field>
90             <field name="condition">True</field>
91             <field name="type">ir.actions.server</field>
92             <field name="model_id" ref="model_sale_order"/>
93             <field name="state">code</field>
94             <field name="code">self.message_check_and_set_read(cr, uid, context.get('active_ids'), context=context)</field>
95         </record>
96         <record id="action_sale_order_read" model="ir.values">
97             <field name="name">action_sale_order_read</field>
98             <field name="action_id" ref="actions_server_sale_order_read"/>
99             <field name="value" eval="'ir.actions.server,' + str(ref('actions_server_sale_order_read'))" />
100             <field name="key">action</field>
101             <field name="model_id" ref="model_sale_order" />
102             <field name="model">sale.order</field>
103             <field name="key2">client_action_multi</field>
104         </record>
105
106         <record id="view_sale_order_calendar" model="ir.ui.view">
107             <field name="name">sale.order.calendar</field>
108             <field name="model">sale.order</field>
109             <field name="arch" type="xml">
110                 <calendar string="Sales Orders" color="state" date_start="date_order">
111                     <field name="partner_id"/>
112                     <field name="amount_total"/>
113                 </calendar>
114             </field>
115         </record>
116         <record model="ir.ui.view" id="view_sale_order_graph">
117             <field name="name">sale.order.graph</field>
118             <field name="model">sale.order</field>
119             <field name="arch" type="xml">
120                 <graph string="Sales Orders" type="bar">
121                     <field name="partner_id"/>
122                     <field name="amount_total" operator="+"/>
123                 </graph>
124             </field>
125         </record>
126
127         <record id="view_order_tree" model="ir.ui.view">
128             <field name="name">sale.order.tree</field>
129             <field name="model">sale.order</field>
130             <field name="priority">2</field>
131             <field name="arch" type="xml">
132                 <tree string="Sales Orders" fonts="bold:message_unread==True" colors="grey:state=='cancel';blue:state in ('waiting_date','manual');red:state in ('invoice_except','shipping_except')">
133                     <field name="message_unread" invisible="1"/>
134                     <field name="name" string="Order number"/>
135                     <field name="date_order"/>
136                     <field name="partner_id"/>
137                     <field name="user_id"/>
138                     <field name="amount_total" sum="Total Tax Included"/>
139                     <field name="state"/>
140                 </tree>
141             </field>
142         </record>
143
144         <record id="view_quotation_tree" model="ir.ui.view">
145             <field name="name">sale.order.tree</field>
146             <field name="model">sale.order</field>
147             <field name="priority">4</field>
148             <field name="arch" type="xml">
149                 <tree string="Quotation" fonts="bold:message_unread==True" colors="grey:state=='cancel';blue:state in ('waiting_date','manual');red:state in ('invoice_except','shipping_except')">
150                     <field name="message_unread" invisible="1"/>
151                     <field name="name" string="Quotation Number"/>
152                     <field name="date_order"/>
153                     <field name="partner_id"/>
154                     <field name="user_id"/>
155                     <field name="amount_total" sum="Total Tax Included"/>
156                     <field name="state"/>
157                 </tree>
158             </field>
159         </record>
160
161         <record id="view_order_form" model="ir.ui.view">
162             <field name="name">sale.order.form</field>
163             <field name="model">sale.order</field>
164             <field name="arch" type="xml">
165                 <form string="Sales Order" version="7.0">
166                     <header>
167                         <span groups="base.group_user">
168                             <button name="invoice_recreate" states="invoice_except" string="Recreate Invoice"/>
169                             <button name="invoice_corrected" states="invoice_except" string="Ignore Exception"/>
170                             <button name="action_quotation_send" string="Send by Mail" type="object" states="draft" class="oe_highlight"/>
171                             <button name="action_quotation_send" string="Send by Mail" type="object" states="sent"/>
172                             <button name="print_quotation" string="Print" type="object" states="draft" class="oe_highlight"/>
173                             <button name="print_quotation" string="Print" type="object" states="sent"/>
174                             <button name="action_button_confirm" states="draft" string="Confirm" type="object"/>
175                             <button name="action_button_confirm" states="sent" string="Confirm" class="oe_highlight" type="object"/>
176                             <button name="action_view_invoice" string="View Invoice" type="object" class="oe_highlight"
177                               attrs="{'invisible': [('invoice_exists', '=', False)]}"/>
178                             <button name="%(action_view_sale_advance_payment_inv)d" string="Create Invoice"
179                                 type="action" states="manual" class="oe_highlight"/>
180                             <button name="cancel" states="draft,sent" string="Cancel"/>
181                             <button name="action_cancel" states="manual,progress" string="Cancel" type="object"/>
182                             <button name="invoice_cancel" states="invoice_except" string="Cancel"/>
183                         </span>
184                         <field name="state" widget="statusbar" statusbar_visible="draft,sent,invoiced,done" statusbar_colors='{"invoice_except":"red","waiting_date":"blue"}'/>
185                 </header>
186                 <sheet>
187                     <h1>
188                         <label string="Quotation " attrs="{'invisible': [('state','not in',('draft','sent'))]}"/>
189                         <label string="Sale Order " attrs="{'invisible': [('state','in',('draft','sent'))]}"/>
190                         <field name="name" class="oe_inline" readonly="1"/>
191                     </h1>
192                     <group>
193                         <group>
194                             <field name="partner_id" on_change="onchange_partner_id(partner_id)" domain="[('customer','=',True)]" context="{'search_default_customer':1}"/>
195                             <field name="partner_invoice_id" groups="sale.group_delivery_invoice_address"/>
196                             <field name="partner_shipping_id" groups="sale.group_delivery_invoice_address"/>
197                             <field name="project_id" context="{'partner_id':partner_id, 'pricelist_id':pricelist_id, 'default_name':name}" groups="sale.group_analytic_accounting" domain="[('type','in',['view','normal','contract'])]"/>
198                         </group>
199                         <group>
200                             <field name="date_order"/>
201                             <field name="shop_id" groups="base.group_no_one" on_change="onchange_shop_id(shop_id, context)" widget="selection"/>
202                             <field name="client_order_ref"/>
203                             <field domain="[('type','=','sale')]" name="pricelist_id" groups="product.group_sale_pricelist" on_change="onchange_pricelist_id(pricelist_id,order_line)"/>
204                         </group>
205                     </group>
206                     <notebook>
207                         <page string="Order Lines">
208                             <field name="order_line">
209                                 <form string="Sales Order Lines" version="7.0">
210                                     <header>
211                                         <button name="%(action_view_sale_order_line_make_invoice)d" states="confirmed" string="Invoice" type="action" icon="terp-document-new"/>
212                                         <field name="state" widget="statusbar" statusbar_visible="draft,confirmed,done" statusbar_colors='{"exception":"red","cancel":"red"}'/>
213                                     </header>
214                                     <group>
215                                         <group>
216                                             <field name="state" invisible="1" />
217                                             <field name="product_id"
218                                                 context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'shop':parent.shop_id, 'uom':product_uom}"
219                                                 groups="base.group_user"
220                                                 on_change="product_id_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, product_uos_qty, product_uos, name, parent.partner_id, False, True, parent.date_order, False, parent.fiscal_position, False, context)"/>
221                                             <label for="product_uom_qty"/>
222                                             <div>
223                                                 <field
224                                                     context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'shop':parent.shop_id, 'uom':product_uom}"
225                                                     name="product_uom_qty" class="oe_inline"
226                                                     on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, False, parent.date_order, False, parent.fiscal_position, True, context)"/>
227                                                 <field name="product_uom" groups="product.group_uom" class="oe_inline oe_no_button"
228
229                                                     on_change="product_uom_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, False, parent.date_order, context)"/>
230                                             </div>
231                                             <label for="product_uos_qty" groups="product.group_uos"/>
232                                             <div groups="product.group_uos">
233                                                 <field name="product_uos_qty" class="oe_inline"/>
234                                                 <field name="product_uos" options='{"no_open": true}' class="oe_inline"/>
235                                             </div>
236                                             <field name="price_unit"/>
237                                             <label for="discount" groups="sale.group_discount_per_so_line"/>
238                                             <div groups="sale.group_discount_per_so_line">
239                                                 <field name="discount" class="oe_inline"/> %%
240                                             </div>
241                                         </group>
242                                         <group>
243                                             <field name="tax_id" widget="many2many_tags" domain="[('parent_id','=',False),('type_tax_use','&lt;&gt;','purchase')]"/>
244                                             <field name="th_weight"/>
245
246                                             <!-- we should put a config wizard for these two fields -->
247                                             <field name="address_allotment_id"/>
248                                         </group>
249                                     </group>
250                                     <label for="name"/>
251                                     <field name="name"/>
252                                     <div groups="base.group_no_one">
253                                         <label for="invoice_lines"/>
254                                         <field name="invoice_lines"/>
255                                     </div>
256                                 </form>
257                                 <tree string="Sales Order Lines" editable="bottom">
258                                     <field name="sequence" widget="handle"/>
259                                     <field name="state" invisible="1"/>
260                                     <field name="th_weight" invisible="1"/>
261                                     <field name="product_id"
262                                         context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'shop':parent.shop_id, 'uom':product_uom}"
263                                         groups="base.group_user" 
264                                         on_change="product_id_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, product_uos_qty, product_uos, name, parent.partner_id, False, True, parent.date_order, False, parent.fiscal_position, False, context)"/>
265                                     <field name="name"/>
266                                     <field name="product_uom_qty"
267                                         context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'shop':parent.shop_id, 'uom':product_uom}"
268                                         on_change="product_id_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, product_uos_qty, product_uos, name, parent.partner_id, False, False, parent.date_order, False, parent.fiscal_position, True, context)"/>
269                                     <field name="product_uom"
270                                         on_change="product_uom_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, product_uos_qty, product_uos, name, parent.partner_id, False, False, parent.date_order, context)"
271                                         groups="product.group_uom" options='{"no_open": true}'/>
272                                     <field name="product_uos_qty" groups="product.group_uos" invisible="1"/>
273                                     <field name="product_uos" string="UoS" groups="product.group_uos" invisible="1"/>
274                                     <field name="tax_id" widget="many2many_tags" domain="[('parent_id','=',False),('type_tax_use','&lt;&gt;','purchase')]"/>
275                                     <field name="price_unit"/>
276                                     <field name="discount" groups="sale.group_discount_per_so_line"/>
277                                     <field name="price_subtotal"/>
278                                 </tree>
279                             </field>
280                             <group class="oe_subtotal_footer oe_right" colspan="2" name="sale_total">
281                                 <field name="amount_untaxed"/>
282                                 <field name="amount_tax"/>
283                                 <div class="oe_subtotal_footer_separator oe_inline">
284                                     <label for="amount_total" />
285                                     <button name="button_dummy"
286                                         states="draft" string="(update)" type="object" class="oe_edit_only oe_link"/>
287                                 </div>
288                                 <field name="amount_total" nolabel="1" class="oe_subtotal_footer_separator"/>
289                             </group>
290                             <group name="sale_margin_grp">
291                             </group>
292                             <div class="oe_clear"/>
293                             <label for="note"/><br/>
294                             <field name="note" class="oe_inline"/>
295                         </page>
296                         <page string="Other Information" groups="base.group_user">
297                             <group>
298                                 <group name="sales_person" groups="base.group_user">
299                                     <field name="user_id"/>
300                                     <field groups="base.group_no_one" name="origin"/>
301                                 </group>
302                                 <group name="sale_pay">
303                                     <field name="payment_term" widget="selection"/>
304                                     <field name="fiscal_position" widget="selection"/>
305                                     <field name="company_id" widget="selection" groups="base.group_multi_company"/>
306                                 </group>
307                                 <group>
308                                     <field name="invoiced"/>
309                                     <field name="invoice_exists" invisible="1"/>
310                                 </group>
311                             </group>
312                         </page>
313                         <page string="History">
314                             <separator string="Invoices"/>
315                             <field name="invoice_ids" context="{'form_view_ref':'account.invoice_form'}">
316                                 <tree string="Invoices" colors="blue:state == 'draft';black:state in ('proforma','proforma2','open');gray:state == 'cancel'">
317                                     <field name="date_invoice"/>
318                                     <field name="number"/>
319                                     <field name="partner_id" string="Customer"/>
320                                     <field name="user_id"/>
321                                     <field name="date_due"/>
322                                     <field name="amount_total"/>
323                                     <field name="state"/>
324                                 </tree>
325                             </field>
326                         </page>
327                     </notebook>
328                 </sheet>
329                 <div class="oe_chatter">
330                     <field name="message_ids" widget="mail_thread"/>
331                     <field name="message_follower_ids" widget="mail_followers"/>
332                 </div>
333                 </form>
334             </field>
335         </record>
336
337         <!-- inherited view to make the order lines list in the form non-editable
338              for the members of some usability groups -->
339         <record id="view_order_form_editable_list" model="ir.ui.view">
340             <field name="name">sale.order.form.editable.list</field>
341             <field name="model">sale.order</field>
342             <field name="inherit_id" ref="sale.view_order_form"/>
343             <field name="groups_id" eval="[(6, 0, [ref('product.group_uos'), ref('product.group_stock_packaging'), ref('sale.group_mrp_properties')])]"/>
344             <field name="arch" type="xml">
345                 <xpath expr="//field[@name='order_line']/tree" position="attributes">
346                     <attribute name="editable"/>
347                 </xpath>
348             </field>
349         </record>
350
351         <record id="view_sales_order_filter" model="ir.ui.view">
352             <field name="name">sale.order.list.select</field>
353             <field name="model">sale.order</field>
354             <field name="arch" type="xml">
355                 <search string="Search Sales Order">
356                     <field name="name" string="Sales Order" filter_domain="['|',('name','ilike',self),('client_order_ref','ilike',self)]"/>
357                     <filter icon="terp-mail-message-new" string="Inbox" help="Unread messages" name="message_unread" domain="[('message_unread','=',True)]"/>
358                     <separator/>
359                     <filter icon="terp-document-new" string="Quotations" name="draft" domain="[('state','in',('draft','sent'))]" help="Sales Order that haven't yet been confirmed"/>
360                     <filter icon="terp-check" string="Sales" name="sales" domain="[('state','in',('manual','progress'))]"/>
361                     <filter icon="terp-dolar_ok!" string="To Invoice" domain="[('state','=','manual')]" help="Sales Order ready to be invoiced"/>
362                     <filter icon="terp-dolar_ok!" string="Done" domain="[('state','=','done')]" help="Sales Order done"/>
363                     <separator/>
364                     <filter string="My Sale Orders" domain="[('user_id','=',uid)]" help="My Sale Orders" icon="terp-personal" name="my_sale_orders_filter"/>
365                     <field name="partner_id"/>
366                     <field name="user_id"/>
367                     <group expand="0" string="Group By...">
368                         <filter string="Customer" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
369                         <filter string="Salesperson" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
370                         <filter string="Status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
371                         <filter string="Order Date" icon="terp-go-month" domain="[]" context="{'group_by':'date_order'}"/>
372                     </group>
373                </search>
374             </field>
375         </record>
376
377         <record id="action_order_form" model="ir.actions.act_window">
378             <field name="name">Sale Orders</field>
379             <field name="type">ir.actions.act_window</field>
380             <field name="res_model">sale.order</field>
381             <field name="view_type">form</field>
382             <field name="view_mode">tree,form,calendar,graph</field>
383             <field name="search_view_id" ref="view_sales_order_filter"/>
384             <field name="context">{'show_address': 1}</field>
385             <field name="domain">[('state','not in',('draft','sent','cancel'))]</field>
386             <field name="help" type="html">
387               <p class="oe_view_nocontent_create">
388                 Click to create a quotation that can be converted into a sale
389                 order.
390               </p><p>
391                 OpenERP will help you efficiently handle the complete sales flow:
392                 quotation, sale order, delivery, invoicing and payment.
393               </p>
394             </field>
395         </record>
396         <menuitem action="action_order_form" id="menu_sale_order" parent="base.menu_sales" sequence="5" groups="base.group_sale_salesman,base.group_sale_manager"/>
397
398         <record id="action_order_tree2" model="ir.actions.act_window">
399             <field name="name">Sales in Exception</field>
400             <field name="type">ir.actions.act_window</field>
401             <field name="res_model">sale.order</field>
402             <field name="view_type">form</field>
403             <field name="view_mode">tree,form,calendar,graph</field>
404             <field name="domain">[('state','in',('shipping_except','invoice_except'))]</field>
405             <field name="filter" eval="True"/>
406             <field name="search_view_id" ref="view_sales_order_filter"/>
407         </record>
408
409         <record id="action_order_tree4" model="ir.actions.act_window">
410             <field name="name">Sales Order in Progress</field>
411             <field name="type">ir.actions.act_window</field>
412             <field name="res_model">sale.order</field>
413             <field name="view_type">form</field>
414             <field name="view_mode">tree,form,calendar,graph</field>
415             <field name="domain">[('state','in',('progress','waiting_date','manual'))]</field>
416             <field name="search_view_id" ref="view_sales_order_filter"/>
417         </record>
418
419
420         <record id="action_order_tree5" model="ir.actions.act_window">
421             <field name="name">Quotations</field>
422             <field name="type">ir.actions.act_window</field>
423             <field name="res_model">sale.order</field>
424             <field name="view_type">form</field>
425             <field name="view_id" ref="view_quotation_tree"/>
426             <field name="view_mode">tree,form,calendar,graph</field>
427             <field name="context">{'show_address': 1}</field>
428             <field name="domain">[('state','in',('draft','sent','cancel'))]</field>
429             <field name="search_view_id" ref="view_sales_order_filter"/>
430             <field name="help" type="html">
431               <p class="oe_view_nocontent_create">
432                 Click to create a quotation, the first step of a new sale.
433               </p><p>
434                 OpenERP will help you handle efficiently the complete sale flow:
435                 from the quotation to the sale order, the
436                 delivery, the invoicing and the payment collection.
437               </p><p>
438                 The social feature helps you organize discussions on each sale
439                 order, and allow your customers to keep track of the evolution
440                 of the sale order.
441               </p>
442             </field>
443         </record>
444
445         <menuitem id="menu_sale_quotations"
446         action="action_order_tree5" parent="base.menu_sales"
447         sequence="4"/>
448
449         <record id="action_order_tree" model="ir.actions.act_window">
450             <field name="name">Old Quotations</field>
451             <field name="type">ir.actions.act_window</field>
452             <field name="res_model">sale.order</field>
453             <field name="view_type">form</field>
454             <field name="view_mode">tree,form,calendar,graph</field>
455             <field name="domain">[('state','=','draft'),('date_order','&lt;',time.strftime('%Y-%m-%d %H:%M:%S'))]</field>
456             <field name="filter" eval="True"/>
457             <field name="search_view_id" ref="view_sales_order_filter"/>
458         </record>
459
460         <record id="view_order_line_graph" model="ir.ui.view">
461             <field name="name">sale.order.line.graph</field>
462             <field name="model">sale.order.line</field>
463             <field name="arch" type="xml">
464                 <graph string="Sales Order Lines">
465                     <field name="product_id"/>
466                     <field name="price_subtotal" operator="+"/>
467                 </graph>
468             </field>
469         </record>
470
471         <record id="view_order_line_tree" model="ir.ui.view">
472             <field name="name">sale.order.line.tree</field>
473             <field name="model">sale.order.line</field>
474             <field name="arch" type="xml">
475                 <tree string="Sales Order Lines">
476                     <field name="order_id"/>
477                     <field name="order_partner_id"/>
478                     <field name="name"/>
479                     <field name="product_uom_qty" string="Qty"/>
480                     <field name="product_uom" string="Unit of Measure" groups="product.group_uom"/>
481                     <field name="salesman_id"/>
482                     <field name="price_subtotal" sum="Total"/>
483                     <field name="state"/>
484                     <field name="invoiced"/>
485                 </tree>
486             </field>
487         </record>
488         <record id="view_order_line_form2" model="ir.ui.view">
489             <field name="name">sale.order.line.form2</field>
490             <field name="model">sale.order.line</field>
491             <field name="arch" type="xml">
492                 <form string="Sales Order Lines" version="7.0">
493                     <header>
494                         <span groups="base.group_user">
495                             <button name="button_cancel" string="Cancel" type="object" states="confirmed,exception"/>
496                             <button name="%(action_view_sale_order_line_make_invoice)d" string="Create Invoice" type="action" attrs="{'invisible': ['|',('invoiced', '=', 1), ('state', 'not in', ('confirmed', 'draft'))]}" class="oe_highlight"/>
497                             <button name="button_done" string="Done" type="object"  attrs="{'invisible': ['|',('invoiced', '=', 0), ('state', 'not in', ('confirmed', 'exception'))]}" class="oe_highlight"/>
498                         </span>
499                         <field name="state" widget="statusbar" statusbar_visible="draft,confirmed,done" statusbar_colors='{"exception":"red","cancel":"red"}'/>
500                     </header>
501                     <sheet>
502                     <label for="order_id" class="oe_edit_only"/>
503                     <h1><field name="order_id"/></h1>
504                     <label for="order_partner_id" class="oe_edit_only"/>
505                     <h2><field name="order_partner_id"/></h2>
506                     <group>
507                         <group>
508                             <field name="product_id" readonly="1"/>
509                             <label for="product_uom_qty"/>
510                             <div>
511                                 <field name="product_uom_qty" readonly="1" class="oe_inline"/>
512                                 <field name="product_uom" groups="product.group_uom" class="oe_inline"/>
513                             </div>
514                         </group>
515                         <group>
516                             <field name="price_unit"/>
517                             <field name="discount" groups="sale.group_discount_per_so_line"/>
518                             <field name="price_subtotal"/>
519                             <field name="invoiced"/>
520                             <field name="company_id" groups="base.group_multi_company" readonly="1"/>
521                         </group>
522                     </group>
523                     <label for="name"/>
524                     <field name="name"/>
525                     </sheet>
526                 </form>
527             </field>
528         </record>
529
530         <record id="view_sales_order_line_filter" model="ir.ui.view">
531             <field name="name">sale.order.line.select</field>
532             <field name="model">sale.order.line</field>
533             <field name="arch" type="xml">
534                 <search string="Search Sales Order">
535                     <filter icon="terp-dolar_ok!" string="To Invoice" domain="[('invoiced','&lt;&gt;', 1),('state','=','done')]"  help="Sale Order Lines ready to be invoiced"/>
536                     <separator/>
537                     <filter string="My Sales Order Lines" icon="terp-personnal" domain="[('salesman_id','=',uid)]" help="Sales Order Lines related to a Sales Order of mine"/>
538                     <field name="order_id"/>
539                     <field name="order_partner_id"/>
540                     <field name="product_id"/>
541                     <field name="salesman_id"/>
542                     <group expand="0" string="Group By...">
543                         <filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>
544                         <filter string="Order" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'order_id'}"/>
545                         <filter string="Salesperson" icon="terp-personal" domain="[]" context="{'group_by':'salesman_id'}"/>
546                         <filter string="Status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
547                     </group>
548                 </search>
549             </field>
550         </record>
551
552         <record id="view_sales_order_uninvoiced_line_filter" model="ir.ui.view">
553             <field name="name">sale.order.uninvoiced.line</field>
554             <field name="model">sale.order.line</field>
555             <field name="arch" type="xml">
556                 <search string="Search Uninvoiced Lines">
557                     <filter icon="terp-gtk-go-back-rtl" string="To Do" domain="[('state','=','confirmed')]" name="sale order" help="Confirmed sale order lines, not yet delivered"/>
558                     <filter icon="terp-dialog-close" string="Done" domain="[('state','=','done')]" name="sale_order_done" help="Sale order lines done"/>
559                     <filter icon="terp-accessories-archiver" string="Shipped" domain="[('state','=','done')]" name="unshipped" help="Sale Order Lines that are in 'done' state"/>
560                     <separator/>
561                     <filter icon="terp-dolar_ok!" string="Uninvoiced" name="uninvoiced" domain="[('invoiced','&lt;&gt;', 1),('state','&lt;&gt;','draft'),('state','&lt;&gt;','cancel')]" help="Sale Order Lines that are confirmed, done or in exception state and haven't yet been invoiced"/>
562                     <separator/>
563                     <filter string="My Sales Order Lines" icon="terp-personal" domain="[('salesman_id','=',uid)]" help="My Sales Order Lines"/>
564                     <field name="order_id"/>
565                     <field name="order_partner_id"/>
566                     <field name="product_id"/>
567                     <field name="salesman_id"/>
568                     <group expand="0" string="Group By...">
569                         <filter string="Order" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'order_id'}" help="Order reference"/>
570                         <filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>
571                         <filter string="Status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
572                     </group>
573                 </search>
574             </field>
575         </record>
576
577         <record id="action_order_line_tree2" model="ir.actions.act_window">
578             <field name="name">Order Lines to Invoice</field>
579             <field name="type">ir.actions.act_window</field>
580             <field name="res_model">sale.order.line</field>
581             <field name="view_type">form</field>
582             <field name="view_mode">tree,form,graph</field>
583             <field name="search_view_id" ref="view_sales_order_uninvoiced_line_filter"/>
584             <field name="context">{"search_default_uninvoiced":1}</field>
585             <field name="filter" eval="True"/>
586             <field name="help" type="html">
587               <p>
588                 Here is a list of each sales order line to be invoiced. You can
589                 invoice sales orders partially, by lines of sales order. You do
590                 not need this list if you invoice from the delivery orders or
591                 if you invoice sales totally.
592               </p>
593             </field>
594         </record>
595
596         <record id="action_order_line_tree3" model="ir.actions.act_window">
597             <field name="name">Uninvoiced and Delivered Lines</field>
598             <field name="type">ir.actions.act_window</field>
599             <field name="res_model">sale.order.line</field>
600             <field name="view_type">form</field>
601             <field name="view_mode">tree,form,graph</field>
602             <field name="domain">[('invoiced','&lt;&gt;', 1),('state','=','done')]</field>
603             <field name="filter" eval="True"/>
604         </record>
605
606         <act_window
607             context="{'search_default_product_id': active_id, 'default_product_id': active_id}"
608             id="action_order_line_product_tree"
609             name="Sales Order Lines"
610             res_model="sale.order.line"
611             src_model="product.product"
612             groups="base.group_sale_salesman"/>
613
614         <menuitem id="base.menu_invoiced" name="Invoicing" parent="base.menu_base_partner" sequence="5"/>
615         <menuitem id="menu_invoicing_sales_order_lines" parent="base.menu_invoiced" action="action_order_line_tree2" sequence="10" groups="sale.group_invoice_so_lines"/>
616
617     </data>
618 </openerp>