<act_window domain converted to context is done
[odoo/odoo.git] / addons / procurement / procurement_view.xml
1 <?xml version="1.0" encoding="utf-8"?>
2 <openerp>
3         <data>
4                 <!--
5         Procurement
6         -->
7                 
8
9         <record id="procurement_tree_view" model="ir.ui.view">
10             <field name="name">procurement.order.tree</field>
11             <field name="model">procurement.order</field>
12             <field name="type">tree</field>
13             <field name="arch" type="xml">
14                 <tree string="Procurement Lines" colors="red:date_planned&lt;current_date and state in ('exception');black:state=='running';darkgreen:state=='confirmed';gray:state in ['done','cancel'];blue:state in ('ready')">
15                     <field name="date_planned" widget="date"/>
16                     <field name="origin"/>
17                     <field name="product_id"/>
18                     <field name="product_qty"/>
19                     <field name="product_uom" string="UOM"/>
20                     <field name="procure_method"/>
21                     <field name="state"/>
22                     <field name="message"/>
23                     <field name="name" invisible="1"/>
24                 </tree>
25             </field>
26         </record>
27         <record id="procurement_form_view" model="ir.ui.view">
28             <field name="name">procurement.order.form</field>
29             <field name="model">procurement.order</field>
30             <field name="type">form</field>
31             <field name="arch" type="xml">
32                 <form string="Procurement">
33                     <group col="2" colspan="2">
34                         <separator colspan="2" string="References"/>
35                         <field name="name" string="Procurement Reason"/>
36                         <field name="origin"/>
37                         <field name="company_id" groups="base.group_multi_company" widget="selection"/>
38                     </group>
39                     <group col="2" colspan="2">
40                         <separator colspan="2" string="Planification"/>
41                         <field name="date_planned"/>
42                         <field name="procure_method"/>
43                         <field name="priority" groups="base.group_extended"/>
44                     </group>
45                     <notebook colspan="4">
46                     <page string="Procurement Details">
47                         <separator colspan="4" string="Product &amp; Location"/>
48                         <field name="product_id" on_change="onchange_product_id(product_id)"/>
49                         <field name="location_id" domain="[('usage','=','internal')]"/>
50                         <field name="product_qty"/>
51                         <field name="product_uom" widget="selection"/>
52
53                         <field name="product_uos_qty" groups="product.group_uos,base.group_extended"/>
54                         <field name="product_uos" widget="selection" groups="product.group_uos,base.group_extended"/>
55
56                         <separator colspan="4" string="Status"/>
57                         <field colspan="4" name="message" readonly="1"/>
58                         <field name="state" readonly="1"/>
59                         <group col="7" colspan="2">
60                             <button name="button_confirm" states="draft" string="Confirm" icon="gtk-apply"/>
61                             <button name="button_restart" states="exception" string="Retry" icon="gtk-convert"/>
62                             <button name="button_cancel" states="draft,exception,waiting" string="Cancel" icon="gtk-cancel"/>
63                             <button name="button_check" states="confirmed" string="Run Procurement" icon="gtk-media-play"/>
64                         </group>
65                     </page>
66                     <page string="Extra Information">
67                         <separator colspan="4" string="Details"/>
68                         <field name="move_id" groups="base.group_extended"/>
69                         <field name="date_close"/>
70                         <field name="close_move" groups="base.group_extended"/>
71                     </page>
72                     <page string="Notes">
73                         <separator colspan="4" string="Note" />
74                         <field name="note" colspan="4" nolabel="1"/>
75                     </page>
76                     </notebook>
77                 </form>
78             </field>
79         </record>
80         <record id="view_procurement_filter" model="ir.ui.view">
81             <field name="name">procurement.order.select</field>
82             <field name="model">procurement.order</field>
83             <field name="type">search</field>
84             <field name="arch" type="xml">
85                 <search string="Search Procurement">
86                     <group col='10' colspan='4'>
87                        <filter icon="terp-check" string="Current" domain="[('state','in',('draft','confirmed'))]" name="current" help="Procurement Orders in draft or open state."/>
88                        <filter icon="terp-emblem-important" string="Exceptions" domain="[('state','=','exception')]" help="Procurement Orders with exceptions"/>
89                        <filter icon="terp-gnome-cpu-frequency-applet+" string="Late"
90                            domain="['&amp;', ('date_planned::date','&lt;', current_date), ('state', 'in', ('draft', 'confirmed'))]"
91                            help="Procurement started late" />
92                        <filter icon="terp-gtk-go-back-rtl" string="To Fix" domain="[('state', '=', 'exception'),('message','=','')]" help="Procurement Orders with exceptions and without message"/>
93                        <separator orientation="vertical"/>
94                        <field name="origin"/>
95                        <field name="product_id" />
96                        <field name="date_planned" widget="date"/>
97                        <field name="state" />
98                     </group>
99                     <newline/>
100                     <group expand="0" string="Group By" colspan="4" col="8" groups="base.group_extended">
101                         <filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>
102                         <filter string="Reason" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'name'}"/>
103                         <filter string="Scheduled Date" icon="terp-go-month" domain="[]" context="{'group_by':'date_planned'}"/>
104                         <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
105                     </group>
106                 </search>
107             </field>
108         </record>
109         <record id="procurement_action" model="ir.actions.act_window">
110             <field name="name">Procurement Orders</field>
111             <field name="type">ir.actions.act_window</field>
112             <field name="res_model">procurement.order</field>
113             <field name="view_type">form</field>
114             <field name="view_id" eval="False"/>
115             <field name="context">{'search_default_current':1}</field>
116             <field name="search_view_id" ref="view_procurement_filter"/>
117             <field name="context">{'search_default_Current':1}</field>
118             <field name="help">The procurement order will schedule a proposal for automatic procurement for the product concerned. This procurement will start a task, a purchase order form for the supplier or a production depending on the product configuration.</field>
119         </record>
120
121         <record id="procurement_action3" model="ir.actions.act_window">
122             <field name="name">Procurements</field>
123             <field name="type">ir.actions.act_window</field>
124             <field name="res_model">procurement.order</field>
125             <field name="view_type">form</field>
126             <field name="view_mode">tree,form</field>
127             <field name="search_view_id" ref="view_procurement_filter"/>
128             <field name="domain">[]</field>
129             <field name="context">{}</field>
130         </record>
131
132         <record id="procurement_action5" model="ir.actions.act_window">
133             <field name="name">Procurement Exceptions</field>
134             <field name="type">ir.actions.act_window</field>
135             <field name="res_model">procurement.order</field>
136             <field name="view_type">form</field>
137             <field name="view_mode">tree,form</field>
138             <field name="domain">[('state','=','exception')]</field>
139             <field name="help"> For each customer order line or raw materials in a manufacturing order, there is a procurement form . In normal system use, procurement orders are automatically generated by OpenERP. But if there are configuration problems, the system can remain blocked by a procurement without generating a corresponding document. It is a procurement exception. Some problems are link to timing and will be correct automatically by the system. If there is no procurement rule, the exception must be corrected manually.</field>
140         </record>
141
142         <record id="procurement_action4" model="ir.actions.act_window">
143             <field name="name">Procurement Exceptions to Fix</field>
144             <field name="type">ir.actions.act_window</field>
145             <field name="res_model">procurement.order</field>
146             <field name="view_type">form</field>
147             <field name="view_mode">tree,form</field>
148             <field name="domain">[('state','=','exception'), ('message', '&lt;&gt;', '')]</field>
149             <field name="filter" eval="True"/>
150         </record>
151
152         <record id="procurement_action11" model="ir.actions.act_window">
153             <field name="name">Temporary Procurement Exceptions</field>
154             <field name="type">ir.actions.act_window</field>
155             <field name="res_model">procurement.order</field>
156             <field name="view_type">form</field>
157             <field name="view_mode">tree,form</field>
158             <field name="domain">[('state','=','exception'), ('message', '=', '')]</field>
159         </record>
160
161         <!-- Order Point -->
162         <record id="view_warehouse_orderpoint_tree" model="ir.ui.view">
163             <field name="name">stock.warehouse.orderpoint.tree</field>
164             <field name="model">stock.warehouse.orderpoint</field>
165             <field name="type">tree</field>
166             <field name="arch" type="xml">
167                 <tree string="Minimum Stock Rules">
168                     <field name="name"/>
169                     <field name="warehouse_id"/>
170                     <field name="location_id"/>
171                     <field name="product_id"/>
172                     <field name="product_uom"/>
173                     <field name="product_min_qty"/>
174                     <field name="product_max_qty"/>
175                 </tree>
176             </field>
177         </record>
178
179         <record model="ir.ui.view" id="warehouse_orderpoint_search">
180             <field name="name">stock.warehouse.orderpoint.search</field>
181             <field name="model">stock.warehouse.orderpoint</field>
182             <field name="type">search</field>
183             <field name="arch" type="xml">
184                 <search string="Minimum Stock Rules Search">
185                     <group col="10" colspan="4">
186                         <field name="name"/>
187                         <field name="warehouse_id" widget="selection"/>
188                         <field name="location_id"/>
189                         <field name="company_id" widget="selection" groups="base.group_multi_company"/>
190                         <field name="product_id"/>
191                     </group>
192                     <newline/>
193                     <group expand="0" string="Group By..." colspan="4" col="10">
194                         <filter string="Warehouse" icon="terp-go-home" domain="[]"  context="{'group_by':'warehouse_id'}"/>
195                         <filter string="Location" icon="terp-go-home" domain="[]" context="{'group_by':'location_id'}"/>
196                     </group>
197                 </search>
198             </field>
199         </record>
200
201         <record id="view_warehouse_orderpoint_form" model="ir.ui.view">
202             <field name="name">stock.warehouse.orderpoint.form</field>
203             <field name="model">stock.warehouse.orderpoint</field>
204             <field name="type">form</field>
205             <field name="arch" type="xml">
206                 <form string="Minimum Stock Rules">
207                     <group col="2" colspan="2">
208                         <separator string="General Information" colspan="2" />
209                         <field name="name" />
210                         <field name="product_id" on_change="onchange_product_id(product_id)"/>
211                         <field name="product_uom"/>
212                     </group>
213                     <group col="2" colspan="2">
214                         <separator string="Locations" colspan="2" />
215                         <field name="warehouse_id" on_change="onchange_warehouse_id(warehouse_id)" widget="selection"/>
216                         <field name="location_id"/>
217                         <field name="company_id" groups="base.group_multi_company" widget="selection"/>
218                     </group>
219                     <group col="2" colspan="2">
220                         <separator string="Quantity Rules" colspan="2" />
221                         <field name="product_min_qty"/>
222                         <field name="product_max_qty"/>
223                         <field name="qty_multiple"/>
224                     </group>
225                     <group col="2" colspan="2" groups="base.group_extended">
226                         <separator string="Misc" colspan="2" />
227                         <field name="procurement_id" readonly="1"/>
228                         <field name="active" />
229                     </group>
230                 </form>
231             </field>
232         </record>
233
234         <record id="action_orderpoint_form" model="ir.actions.act_window">
235             <field name="name">Minimum Stock Rules</field>
236             <field name="res_model">stock.warehouse.orderpoint</field>
237             <field name="type">ir.actions.act_window</field>
238             <field name="view_type">form</field>
239             <field name="view_id" ref="view_warehouse_orderpoint_tree"/>
240             <field name="search_view_id" ref="warehouse_orderpoint_search" />
241         </record>
242
243         <act_window 
244         context="{'search_default_warehouse_id': [active_id]}"
245         id="act_stock_warehouse_2_stock_warehouse_orderpoint"
246         name="Minimum Stock Rules" 
247         res_model="stock.warehouse.orderpoint" 
248         src_model="stock.warehouse"/>
249
250         <!-- add product_uom to context to be the default value when adding new orderpoints -->
251         <act_window
252             context="{'product_uom': locals().has_key('uom_id') and uom_id,'search_default_product_id': [active_id]}"
253             id="act_product_product_2_stock_warehouse_orderpoint"
254             name="Minimum Stock Rules"
255             res_model="stock.warehouse.orderpoint"
256             src_model="product.product"/>
257
258         <act_window
259             context="{'product_uom': locals().has_key('uom_id') and uom_id}"
260             domain="[('procurement_id', '=', active_id)]"
261             id="act_procurement_2_stock_warehouse_orderpoint"
262             name="Minimum Stock Rules"
263             res_model="stock.warehouse.orderpoint"
264             src_model="procurement.order"/>
265
266                 <menuitem id="base.menu_mrp_scheduler" name="Schedulers" parent="stock.menu_stock_root" groups="base.group_system" sequence="3"/>
267                 <menuitem action="action_compute_schedulers" id="base.mrp_Sched_all" parent="base.menu_mrp_scheduler" sequence="50" groups="base.group_system"/>
268                 <menuitem action="procurement.procurement_action" id="base.menu_mrp_procurement_action" parent="stock.menu_stock_warehouse_mgmt" sequence="9" groups="base.group_system"/>              
269     </data>
270 </openerp>