[MERGE]: Merged lp:~openerp-dev/openobject-addons/trunk-improve-purchase-requisition...
[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="4" class="oe_form_group_label_border">
48                <field name="name"/>
49                <field name="exclusive"/>
50                <field name="user_id"/>
51                <field name="date_start"/>
52                <field name="warehouse_id" widget="selection" groups="stock.group_locations"/>
53                <field name="date_end"/>
54                <field name="company_id" groups="base.group_multi_company" widget="selection"/>
55                <field name="origin"/>
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" groups="product.group_uom"/>
64                             </tree>
65                             <form string="Products">
66                                 <field name="product_id" />
67                                 <field name="product_qty"/>
68                                 <field name="product_uom_id" groups="product.group_uom"/>
69                                 <field name="company_id" groups="base.group_multi_company" widget="selection"/>
70                             </form>
71                         </field>
72                          <group colspan="4" col="4">
73                             <button name="%(action_purchase_requisition_partner)d" string="Request a Quotation" type="action" icon="gtk-execute"
74                             attrs="{'invisible': [('line_ids','=',False),('state', 'not in', ('in_progress'))]}"/>
75                             <group cosplan="4" col="4">
76                                 <label   string="" />
77                             </group>
78                         </group>                            
79                         <separator colspan="4" string="Quotations"/>
80                         <field colspan="4" name="purchase_ids" nolabel="1" mode="tree,form" context="{'product_ids': line_ids}" >
81                             <tree string="Purchase Order">
82                                 <field name="name" string="Reference"/>
83                                 <field name="date_order" string="Order Date"/>
84                                 <field name="partner_id"/>
85                                 <field name="company_id" groups="base.group_multi_company" widget="selection"/>
86                                 <field name="location_id"/>
87                                 <field name="minimum_planned_date"/>
88                                 <field name="origin"/>
89                                 <field name="state"/>
90                                 <button name="purchase_cancel" states="draft,confirmed,wait_auth" string="Cancel Purchase Order" icon="gtk-cancel"/>                                
91                                 <button name="purchase_confirm" states="draft" string="Confirm Purchase Order" icon="gtk-apply"/>
92                                 <button name="purchase_approve" states="confirmed" string="Approved by Supplier" icon="gtk-ok"/>
93                             </tree>
94                          </field>
95                     </page>
96                     <page string="Notes">
97                         <field name="description" colspan="4" nolabel="1"/>
98                     </page>
99                 </notebook>
100                 <div class="oe_form_bottom">
101                     <field name="message_ids_social" colspan="4" widget="ThreadView" nolabel="1"/>
102                 </div>
103             </sheet>
104             </form>
105         </field>
106     </record>
107     <record model="ir.ui.view" id="view_purchase_requisition_tree">
108         <field name="name">purchase.requisition.tree</field>
109         <field name="type">tree</field>
110         <field name="model">purchase.requisition</field>
111         <field name="arch" type="xml">
112             <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">
113                 <field name="name"/>
114                 <field name="user_id"/>
115                 <field name="date_start"/>
116                 <field name="date_end"/>
117                 <field name="origin"/>
118                 <field name="state"/>
119             </tree>
120         </field>
121     </record>
122
123     <record id="view_purchase_requisition_filter" model="ir.ui.view">
124             <field name="name">purchase.requisition.list.select</field>
125             <field name="model">purchase.requisition</field>
126             <field name="type">search</field>
127             <field name="arch" type="xml">
128                 <search string="Search Purchase Requisition">
129                  <group>
130                     <filter icon="terp-document-new" name="draft" string="New" domain="[('state','=','draft')]" help="New Purchase Requisition"/>
131                     <filter icon="terp-camera_test" string="In Progress" domain="[('state','=','in_progress')]" help="Purchase Requisition in negociation"/>
132                     <filter icon="terp-dialog-close" string="Done" domain="[('state','=','done')]" help="Current Purchase Requisition"/>
133                     <separator orientation="vertical"/>
134                     <filter icon="terp-personal-" string="Unassigned"  domain="[('user_id','=', False)]" help="Unassigned  Requisition"/>
135                     <separator orientation="vertical"/>
136                     <field name="name"/>
137                     <field name="user_id" />
138                     <field name="exclusive" />
139                 </group>
140                 <newline/>
141                   <group expand="0" string="Group By...">
142                     <filter string="Responsible" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
143                     <separator orientation="vertical"/>
144                     <filter string="Source" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'origin'}"/>
145                     <filter string="Status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
146                     <separator orientation="vertical"/>
147                     <filter string="Start Date" icon="terp-go-month" domain="[]" context="{'group_by':'date_start'}"/>
148                     <filter string="End Date" icon="terp-go-month" domain="[]" context="{'group_by':'date_end'}"/>
149                 </group>
150               </search>
151             </field>
152         </record>
153
154
155     <record model="ir.actions.act_window" id="action_purchase_requisition">
156         <field name="name">Purchase Requisitions</field>
157         <field name="type">ir.actions.act_window</field>
158         <field name="res_model">purchase.requisition</field>
159         <field name="view_type">form</field>
160         <field name="view_mode">tree,form</field>
161         <field name="context">{"search_default_create_uid":uid}</field>
162         <field name="search_view_id" ref="view_purchase_requisition_filter"/>
163         <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>
164     </record>
165
166     <menuitem
167         id="menu_purchase_requisition_pro_mgt"
168         sequence="10"
169         parent="purchase.menu_procurement_management"
170         action="action_purchase_requisition"/>
171
172     <record model="ir.ui.view" id="product_normal_form_view_inherit">
173         <field name="name">product.form.inherit</field>
174         <field name="type">form</field>
175         <field name="model">product.product</field>
176         <field name="inherit_id" ref="product.product_normal_form_view"/>
177         <field name="arch" type="xml">
178             <field name="supply_method" position="after">
179                 <group colspan="2" col="2" attrs="{'invisible': [('supply_method','&lt;&gt;','buy')]}">
180                 <field name="purchase_requisition"/>
181                 </group>
182             </field>
183         </field>
184     </record>
185
186     <record model="ir.ui.view" id="procurement_normal_form_view_inherit">
187         <field name="name">procurement.form.inherit</field>
188         <field name="type">form</field>
189         <field name="model">procurement.order</field>
190         <field name="inherit_id" ref="procurement.procurement_form_view"/>
191         <field name="arch" type="xml">
192              <xpath expr="//field[@name='close_move']" position="after">
193                 <field name="requisition_id"/>
194             </xpath>
195         </field>
196     </record>
197     <act_window
198             domain="[('requisition_id', '=', active_id)]"
199             context="{'default_requisition_id': active_id}"
200             id="act_res_partner_2_purchase_order"
201             name="Purchase orders"
202             res_model="purchase.order"
203             src_model="purchase.requisition"/>
204
205     </data>
206 </openerp>