[IMP] Purchase:Improvement in Purchase order in pad
[odoo/odoo.git] / addons / purchase / purchase_view.xml
1 <?xml version="1.0" encoding="utf-8"?>
2 <openerp>
3     <data>
4        <menuitem icon="terp-purchase" id="base.menu_purchase_root" name="Purchases" sequence="3"
5            groups="group_purchase_manager,group_purchase_user"/>
6        <menuitem id="menu_procurement_management" name="Purchase Management"
7             parent="base.menu_purchase_root" sequence="1" />
8
9         <!--supplier addresses action-->
10         <record id="action_supplier_address_form" model="ir.actions.act_window">
11             <field name="name">Addresses</field>
12             <field name="type">ir.actions.act_window</field>
13             <field name="res_model">res.partner.address</field>
14             <field name="view_type">form</field>
15             <field name="context">{"search_default_supplier":1}</field>
16             <field name="search_view_id" ref="base.view_res_partner_address_filter"/>
17             <field name="help">Access your supplier records and maintain your relationship with them. You can track all your interactions with them through the history tab: emails, orders, meeting, etc.</field>
18         </record>
19         <record id="action_supplier_address_form_view1" model="ir.actions.act_window.view">
20             <field eval="10" name="sequence"/>
21             <field name="view_mode">tree</field>
22             <field name="view_id" ref="base.view_partner_address_tree"/>
23             <field name="act_window_id" ref="action_supplier_address_form"/>
24         </record>
25         <record id="action_supplier_address_form_view2" model="ir.actions.act_window.view">
26             <field eval="20" name="sequence"/>
27             <field name="view_mode">form</field>
28             <field name="view_id" ref="base.view_partner_address_form1"/>
29             <field name="act_window_id" ref="action_supplier_address_form"/>
30         </record>
31
32      <!--supplier menu-->
33       <menuitem id="base.menu_procurement_management_supplier" name="Address Book"
34             parent="base.menu_purchase_root" sequence="3"/>
35       <menuitem id="base.menu_procurement_management_supplier_name" name="Suppliers"
36             parent="base.menu_procurement_management_supplier"
37             action="base.action_partner_supplier_form" sequence="1"/>
38
39           <!--Inventory control-->
40       <menuitem id="menu_procurement_management_inventory" name="Receive Products"
41             parent="base.menu_purchase_root" sequence="4"/>
42       <menuitem action="stock.action_picking_tree4" id="menu_action_picking_tree4" parent="menu_procurement_management_inventory"
43             name="Incoming Shipments" sequence="9"
44             groups="base.group_extended"/>
45       <menuitem action="stock.action_reception_picking_move" id="menu_action_picking_tree_in_move"
46             parent="menu_procurement_management_inventory" sequence="11"/>
47
48      <!--Invoice control-->
49      <menuitem id="menu_procurement_management_invoice" name="Invoice Control"
50           parent="base.menu_purchase_root" sequence="6"/>
51
52     <record id="action_invoice_pending" model="ir.actions.act_window">
53         <field name="res_model">account.invoice</field>
54         <field name="view_type">form</field>
55         <field name="view_mode">tree,form,calendar,graph</field>
56         <field eval="False" name="view_id"/>
57         <field name="domain">[('type','=','in_invoice')]</field>
58         <field name="context">{'type':'in_invoice', 'journal_type': 'purchase', 'search_default_draft': 1}</field>
59         <field name="search_view_id" ref="account.view_account_invoice_filter"/>
60             <field name="help">Use this menu to control the invoices to be received by your supplier. OpenERP pre-generates draft of invoices based on your purchase orders or your receptions. Once you receive a supplier invoice, you can control it according to the draft of invoice and validate it.</field>
61     </record>
62
63      <menuitem name="Supplier Invoices to Receive"
64           id="menu_procurement_management_pending_invoice"
65           action="action_invoice_pending"
66           parent="menu_procurement_management_invoice"
67           sequence="13"/>
68
69       <!--product menu-->
70       <menuitem id="menu_procurement_management_product" name="Products"
71           parent="base.menu_purchase_root" sequence="8"/>
72       <menuitem name="Products" id="menu_procurement_partner_contact_form" action="product.product_normal_action_puchased"
73           parent="menu_procurement_management_product"/>
74
75        <record model="ir.ui.view" id="purchase_order_calendar">
76             <field name="name">purchase.order.calendar</field>
77             <field name="model">purchase.order</field>
78             <field name="type">calendar</field>
79             <field name="priority" eval="2"/>
80             <field name="arch" type="xml">
81                 <calendar string="Calendar View" date_start="minimum_planned_date" color="partner_id">
82                     <field name="name"/>
83                     <field name="amount_total"/>
84                     <field name="partner_id"/>
85                 </calendar>
86             </field>
87         </record>
88         <record model="ir.ui.view" id="view_purchase_order_graph">
89             <field name="name">purchase.order.graph</field>
90             <field name="model">purchase.order</field>
91             <field name="type">graph</field>
92             <field name="arch" type="xml">
93                 <graph string="Purchase Order" type="bar">
94                     <field name="partner_id"/>
95                     <field name="amount_total" operator="+"/>
96                 </graph>
97             </field>
98         </record>
99
100         <record id="purchase_order_form" model="ir.ui.view">
101             <field name="name">purchase.order.form</field>
102             <field name="model">purchase.order</field>
103             <field name="type">form</field>
104             <field name="arch" type="xml">
105                 <form string="Purchase Order">
106                     <group col="6" colspan="4">
107                         <field name="name"/>
108                         <field name="date_order"/>
109                         <field name="invoiced"/>
110                         <newline/>
111                         <field name="warehouse_id" on_change="onchange_warehouse_id(warehouse_id)" widget="selection"/>
112                         <field name="partner_ref"/>
113                         <field name="shipped"/>
114                         <field name="company_id" groups="base.group_multi_company" widget="selection"/>
115                     </group>
116                     <notebook colspan="4">
117                         <page string="Purchase Order">
118                             <field name="partner_id" on_change="onchange_partner_id(partner_id)" domain="[('supplier','=',True)]" context="{'search_default_supplier':1}" />
119                             <field name="partner_address_id"/>
120                             <field domain="[('type','=','purchase')]" name="pricelist_id" groups="base.group_extended"/>
121                             <field name="origin" groups="base.group_extended"/>
122                             <newline/>
123                             <field colspan="4" name="order_line" nolabel="1" mode="tree,form">
124                                 <tree string="Purchase Order Lines">
125                                     <field name="date_planned"/>
126                                     <field name="name"/>
127                                     <field name="product_qty"/>
128                                     <field name="product_uom"/>
129                                     <field name="price_unit"/>
130                                     <field name="price_subtotal"/>
131                                 </tree>
132                                 <!-- default form view -->
133                             </field>
134                             <group col="7" colspan="4">
135                                 <field name="amount_untaxed" sum="Untaxed amount"/>
136                                 <field name="amount_tax"/>
137                                 <field name="amount_total" sum="Total amount"/>
138                                 <button name="button_dummy" states="draft" string="Compute" type="object" icon="gtk-execute"/>
139                             </group>
140                             <group col="11" colspan="4">
141                                 <field name="state" readonly="1"/>
142                                 <button name="purchase_cancel" states="draft,confirmed,wait_auth" string="Cancel" icon="gtk-cancel"/>
143                                 <button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" icon="gtk-convert"/>
144                                 <button name="action_cancel" states="approved,except_picking,except_invoice" string="Cancel Purchase Order" type="object" icon="gtk-cancel"/>
145                                 <button name="picking_ok" states="except_picking" string="Manually Corrected" icon="gtk-convert"/>
146                                 <button name="invoice_ok" states="except_invoice" string="Manually Corrected" icon="gtk-convert"/>
147                                 <button name="purchase_confirm" states="draft" string="Convert to Purchase Order" icon="gtk-go-forward"/>
148                                 <button name="purchase_appbuyer" states="wait_auth" string="Approve Purchase" icon="gtk-ok"/>
149                                 <button name="purchase_approve" states="confirmed" string="Approved by Supplier" icon="gtk-go-forward"/>
150                                 <button name="%(report_purchase_order)d" string="Print" states="approved" type="action" icon="gtk-print"/>
151                             </group>
152                         </page>
153                         <page string="Delivery &amp; Invoicing" groups="base.group_extended">
154                             <group colspan="2" col="2">
155                                 <separator string="Delivery" colspan="2"/>
156                                 <field name="dest_address_id" on_change="onchange_dest_address_id(dest_address_id)"/>
157                                 <field name="minimum_planned_date"/>
158                                 <field name="location_id"/>
159                             </group>
160                             <group colspan="2" col="2">
161                                 <separator string="Invoice Control" colspan="2"/>
162                                 <field name="invoice_method"/>
163                                 <field name="invoice_id" readonly="1" groups="base.group_extended"/>
164                                 <field name="fiscal_position" widget="selection"/>
165                             </group>
166                             <newline/>
167                             <separator string="Purchase Control" colspan="4"/>
168                             <field name="validator"/>
169                             <field name="date_approve"/>
170                         </page>
171                         <page string="Notes">
172                             <field colspan="4" name="notes" nolabel="1"/>
173                         </page>
174                     </notebook>
175                 </form>
176             </field>
177         </record>
178
179        <record id="view_purchase_order_filter" model="ir.ui.view">
180             <field name="name">purchase.order.list.select</field>
181             <field name="model">purchase.order</field>
182             <field name="type">search</field>
183             <field name="arch" type="xml">
184                 <search string="Search Purchase Order">
185                  <group col='10' colspan='4'>
186                     <filter icon="terp-document-new" name="draft" string="Quotations" domain="[('state','=','draft')]" separator="1" help="Purchase order which are in draft state"/>
187                     <filter icon="terp-camera_test" name="confirmed" string="To Approve" domain="[('state','in',('wait','confirmed'))]" separator="1" help="Purchase order to be approved"/>
188                     <filter icon="terp-check" name="approved" string="Approved" domain="[('state','in',('approved','done'))]" separator="1" help="Approved purchase order"/>
189                     <separator orientation="vertical"/>
190                     <filter icon="terp-emblem-important" name="exception" string="Exception" domain="[('state','in',('except_invoice','except_picking'))]" separator="1" help="Purchase order which are in the exception state"/>
191                     <separator orientation="vertical"/>
192                     <filter icon="terp-gtk-go-back-rtl" string="No Invoice" domain="[('invoice_id','=',False)]" separator="1" help="Purchase order with No Invoice" groups="base.group_extended"/>
193                     <separator orientation="vertical"/>
194                     <field name="name" select="1" string="Reference"/>
195                     <field name="partner_id" select="1"/>
196                     <field name="product_id" select="1"/>
197                     <field name="create_uid" select="1"/>
198                 </group>
199                 <newline/>
200                   <group expand="0" string="Group By..." colspan="4" col="10" groups="base.group_extended">
201                     <filter string="Supplier" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
202                      <separator orientation="vertical"/>
203                     <filter string="Origin" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'origin'}"/>
204                     <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
205                      <separator orientation="vertical"/>
206                     <filter string="Order Date" icon="terp-go-month" domain="[]" context="{'group_by':'date_order'}"/>
207                     <filter string="Expected Date" icon="terp-go-month" domain="[]" context="{'group_by':'minimum_planned_date'}"/>
208
209                 </group>
210               </search>
211             </field>
212         </record>
213         <record id="purchase_order_tree" model="ir.ui.view">
214             <field name="name">purchase.order.tree</field>
215             <field name="model">purchase.order</field>
216             <field name="type">tree</field>
217             <field name="arch" type="xml">
218                 <tree colors="grey:state=='cancel';blue:state in ('wait','confirmed');red:state in ('except_invoice','except_picking')" string="Purchase Order">
219                     <field name="name" string="Reference"/>
220                     <field name="date_order" string="Order Date"/>
221                     <field name="partner_id"/>
222                     <field name="company_id" groups="base.group_multi_company" widget="selection"/>
223                     <field name="location_id"/>
224                     <field name="minimum_planned_date"/>
225                     <field name="origin"/>
226                     <field name="invoiced_rate" widget="progressbar"/>
227                     <field name="shipped_rate" widget="progressbar"/>
228                     <field name="amount_untaxed" sum="Total Untaxed amount"/>
229                     <field name="amount_total" sum="Total amount"/>
230                     <field name="state"/>
231                 </tree>
232             </field>
233         </record>
234
235         <record id="purchase_rfq" model="ir.actions.act_window">
236             <field name="name">Requests for Quotation</field>
237             <field name="type">ir.actions.act_window</field>
238             <field name="res_model">purchase.order</field>
239             <field name="view_type">form</field>
240             <field name="context">{'search_default_draft': 1}</field>
241             <field name="view_mode">tree,form,graph,calendar</field>
242             <field name="search_view_id" ref="view_purchase_order_filter"/>
243             <field name="help">With the Requests for quotation menu you can create new request for quotations, review existing one and confirm them to order once the supplier offer is approved. When you confirm a RfQ, OpenERP will convert it to a Purchase Order and generate the next steps: draft reception of the products, invoice to control.</field>
244         </record>
245         <menuitem action="purchase_rfq" id="menu_purchase_rfq" parent="menu_procurement_management"
246                 sequence="6" groups="group_purchase_manager,group_purchase_user"/>
247
248         <record id="purchase_form_action" model="ir.actions.act_window">
249             <field name="name">Purchase Orders</field>
250             <field name="type">ir.actions.act_window</field>
251             <field name="res_model">purchase.order</field>
252             <field name="view_mode">tree,form,graph,calendar</field>
253             <field name="context">{'search_default_approved': 1,'search_default_create_uid':uid}</field>
254             <field name="search_view_id" ref="view_purchase_order_filter"/>
255             <field name="help">From the Purchase Orders menu, you can track the status of your orders: products received, invoice received and controlled.
256 </field>
257         </record>
258         <menuitem action="purchase_form_action" id="menu_purchase_form_action" parent="menu_procurement_management" />
259
260
261         <record id="purchase_order_line_form" model="ir.ui.view">
262             <field name="name">purchase.order.line.form</field>
263             <field name="model">purchase.order.line</field>
264             <field name="type">form</field>
265             <field name="arch" type="xml">
266                 <form string="Purchase Order Line">
267                     <notebook colspan="4">
268                         <page string="Order Line">
269                             <field colspan="4" context="partner_id=parent.partner_id,quantity=product_qty,pricelist=parent.pricelist_id,uom=product_uom,warehouse=parent.warehouse_id" name="product_id" on_change="product_id_change(parent.pricelist_id,product_id,product_qty,product_uom,parent.partner_id, parent.date_order,parent.fiscal_position,date_planned,name,price_unit,notes)"/>
270                             <field context="partner_id=parent.partner_id,quantity=product_qty,pricelist=parent.pricelist_id,uom=product_uom,warehouse=parent.warehouse_id" name="product_qty" on_change="product_id_change(parent.pricelist_id,product_id,product_qty,product_uom,parent.partner_id,parent.date_order,parent.fiscal_position,date_planned,name,price_unit,notes)"/>
271                             <field name="product_uom" on_change="product_uom_change(parent.pricelist_id,product_id,product_qty,product_uom,parent.partner_id, parent.date_order,parent.fiscal_position)"/>
272                             <field colspan="4" name="name"/>
273                             <field name="date_planned" widget="date"/>
274                             <field name="price_unit"/>
275                             <field name="company_id" groups="base.group_multi_company" widget="selection"/>
276                             <field name="account_analytic_id" colspan="4" groups="analytic.group_analytic_accounting" domain="[('parent_id','!=',False)]" />
277                             <group colspan="4" col="4" groups="base.group_extended">
278                                 <separator colspan="4" string="Taxes"/>
279                                 <field colspan="4" nolabel="1" name="taxes_id"
280                                     domain="[('parent_id','=',False),('type_tax_use','!=','sale')]"/>
281                             </group>
282                         </page>
283                         <page string="Invoicing" groups="base.group_extended">
284                             <separator colspan="4" string="Manual Invoices"/>
285                             <field name="invoiced"/>
286                             <newline/>
287                             <field colspan="4" name="invoice_lines" nolabel="1" widget="many2many"/>
288                         </page>
289                            <page string="Notes">
290                             <field colspan="4" name="notes" nolabel="1"/>
291                         </page>
292                         <page string="History" groups="base.group_extended">
293                                <separator colspan="4" string="Stock Moves"/>
294                                <field colspan="4" name="move_ids" nolabel="1" widget="many2many"/>
295                         </page>
296                     </notebook>
297                 </form>
298             </field>
299         </record>
300
301         <record id="purchase_order_line_tree" model="ir.ui.view">
302             <field name="name">purchase.order.line.tree</field>
303             <field name="model">purchase.order.line</field>
304             <field name="type">tree</field>
305             <field name="arch" type="xml">
306                 <tree string="Purchase Order Lines">
307                     <field name="order_id"/>
308                     <field name="name"/>
309                     <field name="partner_id" string="Supplier" />
310                     <field name="product_id"/>
311                     <field name="price_unit"/>
312                     <field name="product_qty"/>
313                     <field name="product_uom"/>                    
314                     <field name="price_subtotal"/>
315                     <field name="date_planned"  widget="date" width="135"/>
316                     
317                    
318                     
319                     <field name="state" invisible="1"/>
320                     <field name="invoiced" invisible="1"/>
321                 </tree>
322             </field>
323         </record>
324         <record id="purchase_order_line_form2" model="ir.ui.view">
325             <field name="name">purchase.order.line.form2</field>
326             <field name="model">purchase.order.line</field>
327             <field name="type">form</field>
328             <field name="priority" eval="20"/>
329             <field name="arch" type="xml">
330                 <form string="Purchase Order Line">
331                     <notebook colspan="4">
332                         <page string="Order Line">
333                                <separator colspan="4" string="General Information"/>
334                              <field name="order_id"/>
335                             <field name="product_id" readonly="1" />
336                             <field name="product_qty" readonly="1" />
337                             <field name="product_uom" readonly="1"/>
338                             <field colspan="4" name="name"/>
339                             <field name="date_planned" widget="date"  readonly="1"/>
340                             <field name="price_unit"/>
341                             <field name="company_id" groups="base.group_multi_company" widget="selection"/>
342                             <field name="account_analytic_id" colspan="4" groups="analytic.group_analytic_accounting" domain="[('parent_id','!=',False)]"/>
343                             <group colspan="4" col="4" groups="base.group_extended">
344                                 <separator colspan="4" string="Taxes"/>
345                                 <field colspan="4" nolabel="1" name="taxes_id"
346                                     domain="[('parent_id','=',False),('type_tax_use','!=','sale')]"/>
347                             </group>
348                         </page>
349                         <page string="Invoicing" groups="base.group_extended">
350                             <separator colspan="4" string="Manual Invoices"/>
351                             <field name="invoiced"/>
352                             <newline/>
353                             <field colspan="4" name="invoice_lines" nolabel="1" widget="many2many"/>
354                         </page>
355                          <page string="Notes">
356                             <field colspan="4" name="notes" nolabel="1"/>
357                         </page>
358                         <page string="History" groups="base.group_extended">
359                                <separator colspan="4" string="Stock Moves"/>
360                                <field colspan="4" name="move_ids" nolabel="1" widget="many2many"/>
361                         </page>
362                     </notebook>
363                 </form>
364             </field>
365         </record>
366           <record id="purchase_order_line_search" model="ir.ui.view">
367             <field name="name">purchase.order.line.search</field>
368             <field name="model">purchase.order.line</field>
369             <field name="type">search</field>
370             <field name="arch" type="xml">
371                 <search string="Search Purchase Order">
372                         <group>
373                         <field name="order_id"/>
374                         <field name="product_id"/>
375                         <field name="partner_id"  string="Supplier"/>
376                         </group> 
377                         <newline/>
378                         <group expand="0" string="Group By...">
379                         <filter string="Supplier" icon="terp-partner" domain="[]" context="{'group_by' : 'partner_id'}" />
380                         <separator orientation="vertical"/>
381                         <filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by' : 'product_id'}" />
382                         <filter icon="terp-gtk-jump-to-rtl" string="Order Reference" domain="[]" context="{'group_by' :'order_id'}"/>
383                         <separator orientation="vertical"/>
384                         <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by' : 'state'}" />
385                         </group>
386                </search>
387             </field>
388         </record>
389
390         <act_window
391             context="{'search_default_partner_id': [active_id]}"
392             id="act_res_partner_2_purchase_order"
393             name="Purchase Orders"
394             res_model="purchase.order"
395             src_model="res.partner"/>
396
397         <act_window
398             context="{'search_default_product_id': [active_id]}"
399             id="action_purchase_line_product_tree"
400             name="Purchases"
401             res_model="purchase.order.line"
402             src_model="product.product"
403             groups="base.group_extended"/>
404
405
406         <record id="purchase_line_form_action2" model="ir.actions.act_window">
407             <field name="name">Purchase Lines Not Invoiced</field>
408             <field name="type">ir.actions.act_window</field>
409             <field name="res_model">purchase.order.line</field>
410             <field name="domain">[('state','in',('confirmed','done')), ('invoiced', '=', False)]</field>
411             <field name="view_type">form</field>
412             <field name="view_mode">tree,form</field>
413             <field name="search_view_id" ref="purchase_order_line_search"/>
414             <field name="help">If you set the invoicing control on a purchase order as "Manual", you can track here all the purchase order lines for which you did not received the supplier invoice yet. Once you are ready to receive a supplier invoice, you can generate a draft supplier invoice based on the lines from this menu.</field>
415         </record>
416         <record id="purchase_line_form_action_tree2" model="ir.actions.act_window.view">
417             <field eval="1" name="sequence"/>
418             <field name="view_mode">tree</field>
419             <field name="view_id" ref="purchase_order_line_tree"/>
420             <field name="act_window_id" ref="purchase_line_form_action2"/>
421         </record>
422         <record id="purchase_line_form_action_form2" model="ir.actions.act_window.view">
423             <field eval="2" name="sequence"/>
424             <field name="view_mode">form</field>
425             <field name="view_id" ref="purchase_order_line_form2"/>
426             <field name="act_window_id" ref="purchase_line_form_action2"/>
427         </record>
428         <menuitem
429             action="purchase_line_form_action2"
430             id="menu_purchase_line_order_draft"
431             groups="base.group_extended"
432             parent="menu_procurement_management_invoice"
433             sequence="72"/>
434
435         <!--
436             Procurements
437         -->
438
439         <record id="view_procurement_form_inherit" model="ir.ui.view">
440             <field name="name">procurement.order.form.inherit</field>
441             <field name="model">procurement.order</field>
442             <field name="inherit_id" ref="procurement.procurement_form_view"/>
443             <field name="type">form</field>
444             <field name="arch" type="xml">
445                 <xpath expr="/form/notebook/page/field[@name='close_move']" position="before">
446                     <field name="purchase_id"/>
447                 </xpath>
448             </field>
449         </record>
450
451     </data>
452 </openerp>