[IMP]: view + Search view improvement
[odoo/odoo.git] / addons / sale / sale_view.xml
1 <?xml version="1.0" encoding="utf-8"?>
2 <openerp>
3     <data>
4 <!--        <menuitem icon="terp-sale" id="menu_sale_root" name="Sales Management"-->
5 <!--            groups="group_sale_user"/>-->
6         <menuitem id="base.menu_sales" name="Sales" parent="base.menu_base_partner" sequence="1"/>
7
8         <menuitem id="base.menu_product" name="Products" parent="base.menu_base_partner" sequence="4"/>
9         <menuitem action="product.product_normal_action" id="product.menu_products" parent="base.menu_product" sequence="1"/>
10
11         <record id="view_shop_form" model="ir.ui.view">
12             <field name="name">sale.shop</field>
13             <field name="model">sale.shop</field>
14             <field name="type">form</field>
15             <field name="arch" type="xml">
16                 <form string="Sale Shop">
17                     <field name="name" select="1"/>
18                     <field name="warehouse_id" required="1" select="1" widget="selection"/>
19                     <separator colspan="4" string="Accounting"/>
20                     <field name="payment_default_id"/>
21                     <field domain="[('type','=','sale')]" name="pricelist_id" select="1"/>
22                     <field name="project_id" select="1"/>
23                 </form>
24             </field>
25         </record>
26         <record id="view_shop_tree" model="ir.ui.view">
27             <field name="name">sale.shop</field>
28             <field name="model">sale.shop</field>
29             <field name="type">tree</field>
30             <field name="arch" type="xml">
31                 <tree string="Sale Shop">
32                     <field name="name"/>
33                     <field name="pricelist_id"/>
34                     <field name="project_id"/>
35                     <field name="warehouse_id"/>
36                 </tree>
37             </field>
38         </record>
39
40         <record id="action_shop_form" model="ir.actions.act_window">
41             <field name="name">Shop</field>
42             <field name="type">ir.actions.act_window</field>
43             <field name="res_model">sale.shop</field>
44             <field name="view_type">form</field>
45             <field name="view_mode">tree,form</field>
46             <field name="view_id" ref="view_shop_tree"/>
47         </record>
48         <menuitem action="action_shop_form" id="menu_action_shop_form" parent="base.menu_base_config" sequence="60"/>
49
50         <record id="view_sale_order_calendar" model="ir.ui.view">
51             <field name="name">sale.order.calendar</field>
52             <field name="model">sale.order</field>
53             <field name="type">calendar</field>
54             <field name="arch" type="xml">
55                 <calendar string="Sales orders" color="state" date_start="date_order">
56                     <field name="partner_id"/>
57                     <field name="amount_total"/>
58                 </calendar>
59             </field>
60         </record>
61         <record model="ir.ui.view" id="view_sale_order_graph">
62             <field name="name">sale.order.graph</field>
63             <field name="model">sale.order</field>
64             <field name="type">graph</field>
65             <field name="arch" type="xml">
66                 <graph string="Sales orders" type="bar">
67                     <field name="partner_id"/>
68                     <field name="amount_total" operator="+"/>
69                 </graph>
70             </field>
71         </record>
72
73         <record id="view_order_tree" model="ir.ui.view">
74             <field name="name">sale.order.tree</field>
75             <field name="model">sale.order</field>
76             <field name="type">tree</field>
77             <field name="arch" type="xml">
78                 <tree string="Sales orders">
79                     <field name="date_order"/>
80                     <field name="name" string="Reference"/>
81                     <field name="partner_id"/>
82                     <field name="partner_shipping_id"/>
83                     <field name="picked_rate" widget="progressbar"/>
84                     <field name="invoiced_rate" widget="progressbar"/>
85                     <field name="amount_untaxed" sum="Total Untaxed amount"/>
86                     <field name="amount_total" sum="Total amount"/>
87                     <field name="state"/>
88                 </tree>
89             </field>
90         </record>
91
92         <record id="view_order_form" model="ir.ui.view">
93             <field name="name">sale.order.form</field>
94             <field name="model">sale.order</field>
95             <field name="type">form</field>
96             <field name="arch" type="xml">
97                 <form string="Sales order">
98                     <group col="6" colspan="4">
99                         <field name="name" select="1"/>
100                         <field name="client_order_ref" select="2"/>
101                         <field name="shipped" select="2"/>
102                         <field name="shop_id" on_change="onchange_shop_id(shop_id)" select="2" widget="selection"/>
103                         <field name="date_order" select="1"/>
104                         <field name="invoiced" select="2"/>
105                     </group>
106                     <notebook colspan="4">
107                         <page string="Sale Order">
108                             <field name="partner_id" on_change="onchange_partner_id(partner_id)" required="1" select="1"/>
109                             <field domain="[('partner_id','=',partner_id)]" name="partner_order_id"/>
110                             <field domain="[('partner_id','=',partner_id)]" name="partner_invoice_id"/>
111                             <field domain="[('partner_id','=',partner_id)]" name="partner_shipping_id"/>
112                             <field domain="[('type','=','sale')]" name="pricelist_id"/>
113                             <field name="project_id" select="2" context="{'partner_id':partner_id, 'contact_id':partner_order_id, 'pricelist_id':pricelist_id, 'default_name':name}"/>
114                             <newline/>
115                             <field colspan="4" mode="tree,form,graph" name="order_line" nolabel="1" widget="one2many_list">
116                                 <form string="Sale Order Lines">
117                                     <notebook>
118                                         <page string="Order Line">
119                                             <separator colspan="4" string="Automatic Declaration"/>
120                                             <field colspan="4"
121                                                 context="partner_id=parent.partner_id,quantity=product_uom_qty,pricelist=parent.pricelist_id,shop=parent.shop_id,uom=product_uom"
122                                                 name="product_id"
123                                                 on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], True, parent.date_order, product_packaging, parent.fiscal_position)"
124                                                 select="1"/>
125                                             <field
126                                                 context="partner_id=parent.partner_id,quantity=product_uom_qty,pricelist=parent.pricelist_id,shop=parent.shop_id,uom=product_uom"
127                                                 name="product_uom_qty"
128                                                 on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], False, parent.date_order, product_packaging, parent.fiscal_position, True)"
129                                                 select="1"/>
130                                             <field name="product_uom"
131                                                 on_change="product_uom_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], False, parent.date_order)"/>
132                                             <field
133                                                 name="product_packaging"
134                                                 context="partner_id=parent.partner_id,quantity=product_uom_qty,pricelist=parent.pricelist_id,shop=parent.shop_id,uom=product_uom"
135                                                 on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], False, parent.date_order, product_packaging, parent.fiscal_position)"
136                                                 domain="[('product_id','=',product_id)]"
137                                                 groups="base.group_extended"/>
138
139                                             <field name="company_id" groups="base.group_multi_company" widget="selection"/>
140                                             <separator colspan="4" string="Manual Description"/>
141                                             <field colspan="4" name="name" select="2"/>
142                                             <field name="price_unit" select="2"/>
143                                             <field name="discount"/>
144                                             <field name="type"/>
145                                             <field name="delay" select="2"/>
146                                             <newline/>
147                                             <field colspan="4" name="tax_id" domain="[('parent_id','=',False),('type_tax_use','&lt;&gt;','purchase')]"/>
148                                             <separator colspan="4" string="States"/>
149                                             <field name="state" select="2"/>
150                                             <group col="3" colspan="2">
151                                                 <field name="invoiced" select="2"/>
152                                                 <button colspan="1" name="%(wizard_sale_order_line_invoice)d" states="confirmed" string="Make Invoice" type="action" icon="gtk-print"/>
153                                             </group>
154                                         </page>
155                                         <page groups="base.group_extended" string="Extra Info">
156                                             <field groups="product.group_uos" name="product_uos_qty" on_change="uos_change(product_uos, product_uos_qty, product_id)"/>
157                                             <field groups="product.group_uos" name="product_uos"/>
158                                             <field name="th_weight"/>
159                                             <field name="address_allotment_id" select="2"/>
160                                             <separator colspan="4" string="Properties"/>
161                                             <field colspan="4" name="property_ids" nolabel="1"/>
162                                         </page>
163                                         <page string="Notes">
164                                             <field colspan="4" name="notes" nolabel="1"/>
165                                         </page>
166                                         <page string="History" groups="base.group_extended">
167                                             <separator colspan="4" string="Invoice Lines"/>
168                                             <field colspan="4" name="invoice_lines" nolabel="1"/>
169                                             <separator colspan="4" string="Stock Moves"/>
170                                             <field colspan="4" name="move_ids" nolabel="1" widget="many2many"/>
171                                         </page>
172                                     </notebook>
173                                 </form>
174                                 <tree string="Sales order lines">
175                                     <field colspan="4" name="name"/>
176                                     <field name="product_uom_qty" string="Qty"/>
177                                     <field name="product_uom" string="UoM"/>
178                                     <field name="discount"/>
179                                     <field name="price_unit"/>
180                                     <field name="price_net"/>
181                                     <field name="price_subtotal"/>
182                                 </tree>
183                             </field>
184                             <newline/>
185                             <group col="7" colspan="4">
186                                 <field name="amount_untaxed" sum="Untaxed amount"/>
187                                 <field name="amount_tax"/>
188                                 <field name="amount_total" sum="Total amount"/>
189                                 <button name="button_dummy" states="draft" string="Compute" type="object" icon="gtk-execute"/>
190                             </group>
191                             <group col="13" colspan="4">
192                                 <field name="state" select="2"/>
193                                 <button name="order_confirm" states="draft" string="Confirm Order" icon="gtk-apply"/>
194                                 <button name="invoice_recreate" states="invoice_except" string="Recreate Invoice" icon="gtk-print"/>
195                                 <button name="invoice_corrected" states="invoice_except" string="Invoice Corrected" icon="gtk-apply"/>
196                                 <button name="ship_recreate" states="shipping_except" string="Recreate Requisition" icon="gtk-ok"/>
197                                 <button name="ship_corrected" states="shipping_except" string="Requisition Corrected" icon="gtk-apply"/>
198                                 <button name="manual_invoice" states="manual" string="Create Invoice" icon="gtk-print"/>
199                                 <button name="ship_cancel" states="shipping_except" string="Cancel Order" icon="gtk-cancel"/>
200                                 <button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" icon="gtk-convert"/>
201                                 <button name="action_cancel" states="manual,progress" string="Cancel Order" type="object" icon="gtk-cancel"/>
202                                 <button name="cancel" states="draft" string="Cancel Order" icon="gtk-cancel"/>
203                                 <button name="invoice_cancel" states="invoice_except" string="Cancel Order" icon="gtk-cancel"/>
204                             </group>
205                         </page>
206                         <page string="Other data">
207                             <field groups="base.group_extended" name="incoterm"/>
208                             <field groups="base.group_extended" name="picking_policy" required="True"/>
209                             <field name="user_id"/>
210                             <field name="order_policy" on_change="shipping_policy_change(order_policy)"/>
211                             <field groups="base.group_extended" name="origin"/>
212                             <field groups="base.group_extended" name="invoice_quantity" attrs="{'readonly':[('order_policy','=','prepaid'),('order_policy','=','picking')]}"/>
213                             <field name="payment_term" widget="selection"/>
214                             <field name="fiscal_position" groups="base.group_extended" widget="selection"/>
215                             <field name="company_id" groups="base.group_multi_company" widget="selection"/>
216                             <separator colspan="4" string="Notes"/>
217                             <field colspan="4" name="note" nolabel="1"/>
218                         </page>
219                         <page string="History">
220                             <separator colspan="4" string="Related invoices"/>
221                             <field colspan="4" name="invoice_ids" nolabel="1"/>
222                             <field colspan="4" name="picking_ids" nolabel="1"/>
223                         </page>
224                     </notebook>
225                 </form>
226             </field>
227         </record>
228
229         <record id="view_sales_order_filter" model="ir.ui.view">
230             <field name="name">sale.order.list.select</field>
231             <field name="model">sale.order</field>
232             <field name="type">search</field>
233             <field name="arch" type="xml">
234                 <search string="Search Sales Order">
235                     <group col='11' colspan='4'>
236                         <filter icon="terp-sale" string="Quotations" domain="[('state','=','draft')]"/>
237                         <filter icon="terp-sale" string="Running" domain="[('state','in',('manual','progress'))]"/>
238                         <filter icon="terp-sale" string="Sales To Invoice" domain="[('state','=','manual')]"/>
239                         <separator orientation="vertical"/>
240                         <field name="name" select="1"/>
241                         <field name="partner_id" select="1"/>
242                         <field name="user_id" select="1" widget="selection">
243                             <filter icon="terp-partner" domain="[('user_id','=',uid)]" help="My Sale Orders" default="1"/>
244                         </field>
245                         <field name="date_order" select="1"/>
246                                         </group>
247                                         <group expand="1" string="Group By..." colspan="4" col="8">
248                                                 <filter string="Customer" icon="terp-sale" domain="[]" context="{'group_by':'partner_id'}"/>
249                         <filter string="State" icon="terp-sale" domain="[]" context="{'group_by':'state'}"/>
250                         <filter string="Order Date" icon="terp-sale" domain="[]" context="{'group_by':'date_order'}"/>
251                                         </group>                        
252                </search>
253             </field>
254         </record>
255
256         <record id="action_order_form" model="ir.actions.act_window">
257             <field name="name">Sales Orders</field>
258             <field name="type">ir.actions.act_window</field>
259             <field name="res_model">sale.order</field>
260             <field name="view_type">form</field>
261             <field name="view_mode">tree,form,calendar,graph</field>
262             <field name="search_view_id" ref="view_sales_order_filter"/>
263         </record>
264         <menuitem action="action_order_form" id="menu_sale_order" parent="base.menu_sales" sequence="3"/>
265
266         <record id="action_order_tree2" model="ir.actions.act_window">
267             <field name="name">Sales in Exception</field>
268             <field name="type">ir.actions.act_window</field>
269             <field name="res_model">sale.order</field>
270             <field name="view_type">form</field>
271             <field name="view_mode">tree,form,calendar,graph</field>
272             <field name="domain">[('state','in',('shipping_except','invoice_except'))]</field>
273             <field name="filter" eval="True"/>
274             <field name="search_view_id" ref="view_sales_order_filter"/>
275         </record>
276
277         <record id="action_order_tree4" model="ir.actions.act_window">
278             <field name="name">Sales Order in Progress</field>
279             <field name="type">ir.actions.act_window</field>
280             <field name="res_model">sale.order</field>
281             <field name="view_type">form</field>
282             <field name="view_mode">tree,form,calendar,graph</field>
283             <field name="domain">[('state','in',('progress','waiting_date','manual'))]</field>
284             <field name="search_view_id" ref="view_sales_order_filter"/>
285         </record>
286
287
288         <record id="action_order_tree5" model="ir.actions.act_window">
289             <field name="name">All Quotations</field>
290             <field name="type">ir.actions.act_window</field>
291             <field name="res_model">sale.order</field>
292             <field name="view_type">form</field>
293             <field name="view_mode">tree,form,calendar,graph</field>
294             <field name="domain">[('state','=','draft')]</field>
295             <field name="search_view_id" ref="view_sales_order_filter"/>
296         </record>
297
298         <record id="action_order_tree" model="ir.actions.act_window">
299             <field name="name">Old Quotations</field>
300             <field name="type">ir.actions.act_window</field>
301             <field name="res_model">sale.order</field>
302             <field name="view_type">form</field>
303             <field name="view_mode">tree,form,calendar,graph</field>
304             <field name="domain">[('state','=','draft'),('date_order','&lt;',time.strftime('%Y-%m-%d %H:%M:%S'))]</field>
305             <field name="filter" eval="True"/>
306             <field name="search_view_id" ref="view_sales_order_filter"/>
307         </record>
308
309         <record id="view_order_line_graph" model="ir.ui.view">
310             <field name="name">sale.order.line.graph</field>
311             <field name="model">sale.order.line</field>
312             <field name="type">graph</field>
313             <field name="arch" type="xml">
314                 <graph string="Sales order lines">
315                     <field name="product_id"/>
316                     <field name="price_subtotal" operator="+"/>
317                 </graph>
318             </field>
319         </record>
320
321         <record id="view_order_line_tree" model="ir.ui.view">
322             <field name="name">sale.order.line.tree</field>
323             <field name="model">sale.order.line</field>
324             <field name="type">tree</field>
325             <field name="arch" type="xml">
326                 <tree string="Sales order lines">
327                     <field name="order_id"/>
328                     <field name="order_partner_id"/>
329                     <field name="product_id"/>
330                     <field name="product_uom_qty" string="Qty"/>
331                     <field name="product_uom" string="UoM"/>
332                     <field name="discount"/>
333                     <field name="price_unit"/>
334                     <field name="price_net"/>
335                     <field name="price_subtotal"/>
336                     <field name="th_weight"/>
337                     <field name="state"/>
338                 </tree>
339             </field>
340         </record>
341         <record id="view_order_line_form2" model="ir.ui.view">
342             <field name="name">sale.order.line.form2</field>
343             <field name="model">sale.order.line</field>
344             <field name="type">form</field>
345             <field name="arch" type="xml">
346                 <form string="Sales Order Lines">
347                     <notebook>
348                         <page string="Order Lines">
349                             <separator colspan="4" string="Automatic Declaration"/>
350                             <field name="order_id" select="1"/>
351                             <field name="order_partner_id" readonly="1" select="1" invisible="1"/>
352                             <field name="product_uom_qty" readonly="1" select="2"/>
353                             <field name="product_uom"/>
354                             <field name="product_id" readonly="1" select="1"/>
355                             <field name="invoiced" select="2"/>
356                             <field name="company_id" groups="base.group_multi_company" widget="selection"/>
357                             <separator colspan="4" string="Manual Designation"/>
358                             <field colspan="4" name="name" select="2"/>
359                             <field name="price_unit" select="2"/>
360                             <field name="discount"/>
361                             <field name="type"/>
362                             <field name="delay" select="2"/>
363                             <field name="price_subtotal"/>
364                             <field name="th_weight"/>
365                             <field colspan="4" name="tax_id" domain="[('parent_id','=',False),('type_tax_use','&lt;&gt;','purchase')]"/>
366                             <separator colspan="4" string="States"/>
367                             <field name="state" select="2"/>
368                             <group col="2" colspan="2">
369                                 <button name="button_done" states="confirmed,exception" string="Done" type="object" icon="gtk-jump-to"/>
370                                 <button name="button_cancel" states="confirmed,exception" string="Cancel" type="object" icon="gtk-cancel" />
371                             </group>
372                         </page>
373                         <page string="Properties">
374                             <field name="property_ids" nolabel="1"/>
375                         </page>
376                         <page string="Notes">
377                             <field colspan="4" name="notes" nolabel="1"/>
378                         </page>
379                         <page string="Invoice Lines">
380                             <field colspan="4" name="invoice_lines" nolabel="1"/>
381                         </page>
382                     </notebook>
383                 </form>
384             </field>
385         </record>
386
387         <record id="view_sales_order_line_filter" model="ir.ui.view">
388             <field name="name">sale.order.line.select</field>
389             <field name="model">sale.order.line</field>
390             <field name="type">search</field>
391             <field name="arch" type="xml">
392                 <search string="Search Sales Order">
393                     <group col='8' colspan='4'>
394                         <filter icon="terp-purchase" string="To Invoice" domain="[('invoiced','&lt;&gt;', 1),('state','=','done')]" separator="1"/>
395                         <separator orientation="vertical"/>
396                         <field name="order_id" select="1"/>
397                         <field name="order_partner_id" select="1"/>
398                         <field name="product_id" select="1"/>
399                         <field name="salesman_id" select="1" widget="selection">
400                             <filter icon="terp-sale" domain="[('salesman_id','=',uid)]" help="My Sale Order Lines"/>
401                             <filter icon="terp-sale" domain="[('salesman_id','child_of',[uid])]" help="My Departments Sale Order Lines"/>
402                         </field>
403                                         <group expand="context.get('report',False)" string="Group By..." colspan="4" col="8">
404                                                 <filter string="Product" icon="terp-sale"  default="1" domain="[]" context="{'group_by':'product_id'}"/>
405                         <filter string="Order" icon="terp-sale" domain="[]" context="{'group_by':'order_id'}"/>
406                         <filter string="State" icon="terp-sale" domain="[]" context="{'group_by':'state'}"/>
407                                         </group>                        
408                         
409                     </group>
410                 </search>
411             </field>
412         </record>
413
414         <record id="action_order_line_tree2" model="ir.actions.act_window">
415             <field name="name">Uninvoiced Lines</field>
416             <field name="type">ir.actions.act_window</field>
417             <field name="res_model">sale.order.line</field>
418             <field name="view_type">form</field>
419             <field name="view_mode">tree,form,graph</field>
420             <field name="domain">[('invoiced','&lt;&gt;', 1),('state','&lt;&gt;','draft'),('state','&lt;&gt;','cancel')]</field>
421             <field name="filter" eval="True"/>
422         </record>
423
424         <record id="action_order_line_tree3" model="ir.actions.act_window">
425             <field name="name">Uninvoiced and Delivered Lines</field>
426             <field name="type">ir.actions.act_window</field>
427             <field name="res_model">sale.order.line</field>
428             <field name="view_type">form</field>
429             <field name="view_mode">tree,form,graph</field>
430             <field name="domain">[('invoiced','&lt;&gt;', 1),('state','=','done')]</field>
431             <field name="filter" eval="True"/>
432         </record>
433
434         <act_window context="{'partner_id': active_id}" domain="[('partner_id', '=', active_id)]" id="act_res_partner_2_sale_order" name="Sales" res_model="sale.order" src_model="res.partner"/>
435
436         <act_window domain="[('product_id','=',active_id)]" id="action_order_line_product_tree" name="Product sales" res_model="sale.order.line" src_model="product.product"/>
437
438         <menuitem id="menu_invoiced" name="Invoicing" parent="base.menu_base_partner" sequence="6"/>
439         <menuitem action="action_order_line_tree2" id="menu_invoicing_sales_order_lines" parent="menu_invoiced" sequence="2"/>
440         <!-- configartion view -->
441
442         <record id="view_config_picking_policy" model="ir.ui.view">
443             <field name="name">Configure Picking Policy for Sale Order </field>
444             <field name="model">sale.config.picking_policy</field>
445             <field name="type">form</field>
446             <field name="inherit_id" ref="base.res_config_view_base"/>
447             <field name="arch" type="xml">
448               <data>
449                 <form position="attributes">
450                   <attribute name="string">Sales Configuration</attribute>
451                 </form>
452                 <group string="res_config_contents" position="replace">
453                   <label colspan="4" align="0.0"
454                          string="Set the policies selected by default when creating a new sale order."/>
455                   <separator colspan="4"
456                        string="Configure Sale Order Logistic"/>
457                   <newline/>
458                   <field name="picking_policy"/>
459                   <newline/>
460                   <field name="order_policy"/>
461                   <newline/>
462                   <field name="step"/>
463                 </group>
464                 <xpath expr='//button[@name="action_skip"]' position='replace'/>
465               </data>
466             </field>
467         </record>
468
469         <record id="action_config_picking_policy" model="ir.actions.act_window">
470             <field name="name">Configure Picking Policy for Sale Order</field>
471             <field name="type">ir.actions.act_window</field>
472             <field name="res_model">sale.config.picking_policy</field>
473             <field name="view_id" ref="view_config_picking_policy"/>
474             <field name="view_type">form</field>
475             <field name="view_mode">form</field>
476             <field name="target">new</field>
477         </record>
478
479         <!-- register configuration wizard -->
480         <record id="config_wizard_step_sale_picking_policy" model="ir.actions.todo">
481             <field name="action_id" ref="action_config_picking_policy"/>
482         </record>
483
484     </data>
485 </openerp>