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