[MERGE]: Merged lp:~openerp-commiter/openobject-addons/trunk-improve-purchase-requisi...
[odoo/odoo.git] / addons / purchase_requisition / purchase_requisition_view.xml
1 <?xml version="1.0"?>
2 <openerp>
3     <data>
4
5
6     <record model="ir.ui.view" id="purchase_order_form_inherit">
7         <field name="name">purchase.order.form.inherit</field>
8         <field name="type">form</field>
9         <field name="model">purchase.order</field>
10         <field name="inherit_id" ref="purchase.purchase_order_form"/>
11         <field name="arch" type="xml">
12             <field name="shipped" position="after">
13                 <field name="requisition_id"/>
14             </field>
15         </field>
16     </record>
17
18     <record model="ir.ui.view" id="purchase_order_search_inherit">
19         <field name="name">purchase.order.list.select.inherit</field>
20         <field name="type">form</field>
21         <field name="model">purchase.order</field>
22         <field name="inherit_id" ref="purchase.view_purchase_order_filter"/>
23         <field name="arch" type="xml">
24             <xpath expr="//filter[@name='approved']" position="after">
25                 <filter icon="terp-gtk-jump-to-rtl" string="Requisition" domain="[('requisition_id','!=',False)]"  help="Purchase Orders with requisition"/>
26             </xpath>
27         </field>
28     </record>
29
30     <record model="ir.ui.view" id="view_purchase_requisition_form">
31         <field name="name">purchase.requisition.form</field>
32         <field name="type">form</field>
33         <field name="model">purchase.requisition</field>
34         <field name="arch" type="xml">
35             <form layout="manual">
36             <div class="oe_form_topbar">
37                 <button name="tender_in_progress" states="draft" string="Send to Suppliers" type="object" />
38                 <button name="tender_reset" states="done,cancel" string="Reset to Draft" type="object" />
39                 <button name="tender_done" states="in_progress" string=" Purchase Done" type="object" />
40                 <button name="tender_cancel" states="draft,in_progress" string="Cancel" type="object" />
41                 <div class="oe_right">
42                     <field name="state" nolabel="1" select="1" readonly ="1" widget="statusbar" statusbar_visible="draft,in_progress,done" statusbar_colors='{"in_progress":"blue"}'/>
43                 </div>
44                 <div class="oe_clear"/>
45             </div>
46             <sheet string="Purchase Requisition" layout="auto">
47                 <group colspan="4" col="6">
48                     <field name="name"/>
49                     <field name="user_id"/>
50                     <field name="exclusive"/>
51                     <field name="date_start"/>
52                     <field name="date_end"/>
53                     <field name="origin"/>
54                     <field name="warehouse_id" widget="selection"/>
55                     <field name="company_id" groups="base.group_multi_company" widget="selection"/>
56                 </group>
57                 <notebook colspan="4">
58                     <page string="Products">
59                         <field name="line_ids" colspan="4" nolabel="1">
60                             <tree string="Products" editable="bottom">
61                                 <field name="product_id" on_change="onchange_product_id(product_id,product_uom_id)"/>
62                                 <field name="product_qty"/>
63                                 <field name="product_uom_id"/>
64                             </tree>
65                             <form string="Products">
66                                 <field name="product_id" />
67                                 <field name="product_qty"/>
68                                 <field name="product_uom_id" />
69                                 <field name="company_id" groups="base.group_multi_company" widget="selection"/>
70                             </form>
71                         </field>
72                         <group colspan="2">
73                            <label colspan="2"  string=""/>
74                            <button name="%(action_purchase_requisition_partner)d" string="Request a Quotation" type="action" icon="gtk-execute"
75                               attrs="{'readonly': [('state', '=', 'done')]}"/>
76                         </group>                            
77                         <separator colspan="4" string="Quotations"/>
78                         <field colspan="4" name="purchase_ids" nolabel="1" mode="tree,form">
79                             <tree string="Purchase Order">
80                                 <field name="name" string="Reference"/>
81                                 <field name="date_order" string="Order Date"/>
82                                 <field name="partner_id"/>
83                                 <field name="company_id" groups="base.group_multi_company" widget="selection"/>
84                                 <field name="location_id"/>
85                                 <field name="minimum_planned_date"/>
86                                 <field name="origin"/>
87                                 <field name="state"/>
88                                 <button name="purchase_cancel" states="draft,confirmed,wait_auth" string="Cancel Purchase Order" icon="gtk-cancel"/>                                
89                                 <button name="purchase_confirm" states="draft" string="Confirm Purchase Order" icon="gtk-apply"/>
90                                 <button name="purchase_approve" states="confirmed" string="Approved by Supplier" icon="gtk-ok"/>
91                             </tree>
92                          </field>
93                     </page>
94                     
95                     <page string="Notes">
96                         <field name="description" colspan="4" nolabel="1"/>
97                     </page>
98                 </notebook>
99             </sheet>
100             </form>
101         </field>
102     </record>
103     <record model="ir.ui.view" id="view_purchase_requisition_tree">
104         <field name="name">purchase.requisition.tree</field>
105         <field name="type">tree</field>
106         <field name="model">purchase.requisition</field>
107         <field name="arch" type="xml">
108             <tree colors="grey:state == 'done';red:date_end&lt;current_date and state not in ('done','cancel');black:date_end&gt;=current_date;" string="Purchase Requisition">
109                 <field name="name"/>
110                 <field name="user_id"/>
111                 <field name="date_start"/>
112                 <field name="date_end"/>
113                 <field name="origin"/>
114                 <field name="state"/>
115             </tree>
116         </field>
117     </record>
118
119     <record id="view_purchase_requisition_filter" model="ir.ui.view">
120             <field name="name">purchase.requisition.list.select</field>
121             <field name="model">purchase.requisition</field>
122             <field name="type">search</field>
123             <field name="arch" type="xml">
124                 <search string="Search Purchase Requisition">
125                  <group>
126                     <filter icon="terp-document-new" name="draft" string="New" domain="[('state','=','draft')]" help="New Purchase Requisition"/>
127                     <filter icon="terp-camera_test" string="In Progress" domain="[('state','=','in_progress')]" help="Purchase Requisition in negociation"/>
128                     <filter icon="terp-dialog-close" string="Done" domain="[('state','=','done')]" help="Current Purchase Requisition"/>
129                     <separator orientation="vertical"/>
130                     <filter icon="terp-personal-" string="Unassigned"  domain="[('user_id','=', False)]" help="Unassigned  Requisition"/>
131                     <separator orientation="vertical"/>
132                     <field name="name"/>
133                     <field name="user_id" />
134                     <field name="exclusive" />
135                 </group>
136                 <newline/>
137                   <group expand="0" string="Group By...">
138                     <filter string="Responsible" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
139                     <separator orientation="vertical"/>
140                     <filter string="Source" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'origin'}"/>
141                     <filter string="Status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
142                     <separator orientation="vertical"/>
143                     <filter string="Start Date" icon="terp-go-month" domain="[]" context="{'group_by':'date_start'}"/>
144                     <filter string="End Date" icon="terp-go-month" domain="[]" context="{'group_by':'date_end'}"/>
145                 </group>
146               </search>
147             </field>
148         </record>
149
150
151     <record model="ir.actions.act_window" id="action_purchase_requisition">
152         <field name="name">Purchase Requisitions</field>
153         <field name="type">ir.actions.act_window</field>
154         <field name="res_model">purchase.requisition</field>
155         <field name="view_type">form</field>
156         <field name="view_mode">tree,form</field>
157         <field name="context">{"search_default_create_uid":uid}</field>
158         <field name="search_view_id" ref="view_purchase_requisition_filter"/>
159         <field name="help">A purchase requisition is the step before a request for quotation. In a purchase requisition (or purchase tender), you can record the products you need to buy and trigger the creation of RfQs to suppliers. After the negotiation, once you have reviewed all the supplier's offers, you can validate some and cancel others.</field>
160     </record>
161
162     <menuitem
163         id="menu_purchase_requisition_pro_mgt"
164         sequence="10"
165         parent="purchase.menu_procurement_management"
166         action="action_purchase_requisition"/>
167
168     <record model="ir.ui.view" id="product_normal_form_view_inherit">
169         <field name="name">product.form.inherit</field>
170         <field name="type">form</field>
171         <field name="model">product.product</field>
172         <field name="inherit_id" ref="product.product_normal_form_view"/>
173         <field name="arch" type="xml">
174             <field name="supply_method" position="after">
175                 <group colspan="2" col="2" attrs="{'invisible': [('supply_method','&lt;&gt;','buy')]}">
176                 <field name="purchase_requisition"/>
177                 </group>
178             </field>
179         </field>
180     </record>
181
182     <record model="ir.ui.view" id="procurement_normal_form_view_inherit">
183         <field name="name">procurement.form.inherit</field>
184         <field name="type">form</field>
185         <field name="model">procurement.order</field>
186         <field name="inherit_id" ref="procurement.procurement_form_view"/>
187         <field name="arch" type="xml">
188              <xpath expr="//field[@name='close_move']" position="after">
189                 <field name="requisition_id"/>
190             </xpath>
191         </field>
192     </record>
193     <act_window
194             domain="[('requisition_id', '=', active_id)]"
195             context="{'default_requisition_id': active_id}"
196             id="act_res_partner_2_purchase_order"
197             name="Purchase orders"
198             res_model="purchase.order"
199             src_model="purchase.requisition"/>
200
201     </data>
202 </openerp>