[FIX] stock: packages menuitem hidden by the right group. sale_stock: fixed bug ...
[odoo/odoo.git] / addons / sale / sale_workflow.xml
1 <?xml version="1.0" encoding="utf-8"?>
2 <openerp>
3     <data>
4         <record id="wkf_sale" model="workflow">
5             <field name="name">sale.order.basic</field>
6             <field name="osv">sale.order</field>
7             <field name="on_create">True</field>
8         </record>
9
10         <!-- Activity -->
11         <record id="act_draft" model="workflow.activity">
12             <field name="wkf_id" ref="wkf_sale"/>
13             <field name="flow_start">True</field>
14             <field name="name">draft</field>
15         </record>
16         
17         <record id="act_sent" model="workflow.activity">
18             <field name="wkf_id" ref="wkf_sale"/>
19             <field name="name">sent</field>
20             <field name="kind">function</field>
21             <field name="action">write({'state':'sent'})</field>
22         </record>
23      
24         <record id="act_router" model="workflow.activity">
25             <field name="wkf_id" ref="wkf_sale"/>
26             <field name="name">router</field>
27             <field name="kind">function</field>
28             <field name="action">action_wait()</field>
29             <field name="split_mode">OR</field>
30         </record>
31         
32         <record id="act_wait_invoice" model="workflow.activity">
33             <field name="wkf_id" ref="wkf_sale"/>
34             <field name="name">wait_invoice</field>
35         </record>
36
37         <record id="act_done" model="workflow.activity">
38             <field name="wkf_id" ref="wkf_sale"/>
39             <field name="name">done</field>
40             <field name="flow_stop">True</field>
41             <field name="kind">function</field>
42             <field name="action">action_done()</field>
43             <field name="join_mode">AND</field>
44         </record>
45
46         <record id="act_cancel" model="workflow.activity">
47             <field name="wkf_id" ref="wkf_sale"/>
48             <field name="name">cancel</field>
49             <field name="flow_stop">True</field>
50             <field name="kind">stopall</field>
51             <field name="action">action_cancel()</field>
52         </record>
53         
54         <record id="act_cancel2" model="workflow.activity">
55             <field name="wkf_id" ref="wkf_sale"/>
56             <field name="name">cancel2</field>
57             <field name="flow_stop">True</field>
58             <field name="kind">stopall</field>
59             <field name="action">action_cancel()</field>
60         </record>
61         
62         <record id="act_invoice" model="workflow.activity">
63             <field name="wkf_id" ref="wkf_sale"/>
64             <field name="name">invoice</field>
65             <field name="kind">subflow</field>
66             <field name="subflow_id" search="[('name','=','account.invoice.basic')]"/>
67             <field name="action">action_invoice_create()</field>
68         </record>
69         <record id="act_invoice_except" model="workflow.activity">
70             <field name="wkf_id" ref="wkf_sale"/>
71             <field name="name">invoice_except</field>
72             <field name="kind">function</field>
73             <field name="action">action_invoice_cancel()</field>
74         </record>
75         <record id="act_invoice_end" model="workflow.activity">
76             <field name="wkf_id" ref="wkf_sale"/>
77             <field name="name">invoice_end</field>
78             <field name="kind">function</field>
79             <field name="action">action_invoice_end()</field>
80         </record>
81         <record id="act_invoice_cancel" model="workflow.activity">
82             <field name="wkf_id" ref="wkf_sale"/>
83             <field name="name">invoice_cancel</field>
84             <field name="flow_stop">True</field>
85             <field name="kind">stopall</field>
86             <field name="action">action_cancel()</field>
87         </record>
88
89         <!-- Transistion -->
90
91         <record id="trans_draft_sent" model="workflow.transition">
92             <field name="act_from" ref="act_draft"/>
93             <field name="act_to" ref="act_sent"/>
94             <field name="signal">quotation_sent</field>
95         </record>
96         <record id="trans_draft_router" model="workflow.transition">
97             <field name="act_from" ref="act_draft"/>
98             <field name="act_to" ref="act_router"/>
99             <field name="signal">order_confirm</field>
100         </record>
101         <record id="trans_draft_cancel" model="workflow.transition">
102             <field name="act_from" ref="act_draft"/>
103             <field name="act_to" ref="act_cancel"/>
104             <field name="signal">cancel</field>
105         </record>
106         <record id="trans_sent_router" model="workflow.transition">
107             <field name="act_from" ref="act_sent"/>
108             <field name="act_to" ref="act_router"/>
109             <field name="signal">order_confirm</field>
110         </record>
111         <record id="trans_sent_cancel" model="workflow.transition">
112             <field name="act_from" ref="act_sent"/>
113             <field name="act_to" ref="act_cancel"/>
114             <field name="signal">cancel</field>
115         </record>
116         <record id="trans_router_wait_invoice" model="workflow.transition">
117             <field name="act_from" ref="act_router"/>
118             <field name="act_to" ref="act_wait_invoice"/>
119         </record>
120         <record id="trans_wait_invoice_all_lines_invoiced" model="workflow.transition">
121             <field name="act_from" ref="act_wait_invoice"/>
122             <field name="act_to" ref="act_invoice_end"/>
123             <field name="signal">all_lines</field>
124         </record>
125         <record id="trans_wait_invoice_cancel2" model="workflow.transition">
126             <field name="act_from" ref="act_wait_invoice"/>
127             <field name="act_to" ref="act_cancel2"/>
128             <field name="signal">cancel</field>
129         </record>
130         <record id="trans_wait_invoice_invoice_manual" model="workflow.transition">
131             <field name="act_from" ref="act_wait_invoice"/>
132             <field name="act_to" ref="act_invoice"/>
133             <field name="signal">manual_invoice</field>
134         </record>
135         <record id="trans_invoice_invoice_end" model="workflow.transition">
136             <field name="act_from" ref="act_invoice"/>
137             <field name="act_to" ref="act_invoice_end"/>
138             <field name="signal">subflow.paid</field>
139         </record>
140         <record id="trans_invoice_invoice_except" model="workflow.transition">
141             <field name="act_from" ref="act_invoice"/>
142             <field name="act_to" ref="act_invoice_except"/>
143             <field name="signal">subflow.cancel</field>
144         </record>
145         <record id="trans_invoice_except_invoice" model="workflow.transition">
146             <field name="act_from" ref="act_invoice_except"/>
147             <field name="act_to" ref="act_invoice"/>
148             <field name="signal">invoice_recreate</field>
149         </record>
150         <record id="trans_invoice_except_invoice_end" model="workflow.transition">
151             <field name="act_from" ref="act_invoice_except"/>
152             <field name="act_to" ref="act_invoice_end"/>
153             <field name="signal">invoice_corrected</field>
154         </record>
155         <record id="trans_invoice_except_invoice_cancel" model="workflow.transition">
156             <field name="act_from" ref="act_invoice_except"/>
157             <field name="act_to" ref="act_invoice_cancel"/>
158             <field name="signal">invoice_cancel</field>
159         </record>
160         <record id="trans_invoice_end_done" model="workflow.transition">
161             <field name="act_from" ref="act_invoice_end"/>
162             <field name="act_to" ref="act_done"/>
163         </record>
164
165     <!--
166         Procurements creation and checking branch
167     -->
168     
169         <!-- Activity -->
170         
171         <record id="act_wait_ship" model="workflow.activity">
172             <field name="wkf_id" ref="sale.wkf_sale"/>
173             <field name="name">wait_ship</field>
174         </record>
175         
176         <record id="act_cancel3" model="workflow.activity">
177             <field name="wkf_id" ref="sale.wkf_sale"/>
178             <field name="name">cancel3</field>
179             <field name="flow_stop">True</field>
180             <field name="kind">stopall</field>
181             <field name="action">action_cancel()</field>
182         </record>
183         
184         <record id="act_ship" model="workflow.activity">
185             <field name="wkf_id" ref="sale.wkf_sale"/>
186             <field name="name">ship</field>
187             <field name="kind">function</field>
188             <field name="action">action_ship_create()</field>
189         </record>
190
191         <record id="act_ship_ignore" model="workflow.activity">
192             <field name="wkf_id" ref="sale.wkf_sale"/>
193             <field name="name">ship_ignore</field>
194             <field name="kind">function</field>
195             <field name="action">action_ignore_delivery_exception()</field>
196         </record>
197         
198         <record id="act_ship_end" model="workflow.activity">
199             <field name="wkf_id" ref="sale.wkf_sale"/>
200             <field name="name">ship_end</field>
201             <field name="kind">dummy</field>
202         </record>
203         
204         <record id="act_ship_cancel" model="workflow.activity">
205             <field name="wkf_id" ref="sale.wkf_sale"/>
206             <field name="name">ship_cancel</field>
207             <field name="flow_stop">True</field>
208             <field name="kind">stopall</field>
209             <field name="action">action_cancel()</field>
210         </record>
211         
212         <record id="act_ship_except" model="workflow.activity">
213             <field name="wkf_id" ref="sale.wkf_sale"/>
214             <field name="name">ship_except</field>
215             <field name="kind">function</field>
216             <field name="action">write({'state':'shipping_except'})</field>
217         </record>
218         
219         
220
221         <!-- Transition -->
222         
223         <record id="trans_router_wait_ship" model="workflow.transition">
224             <field name="act_from" ref="sale.act_router"/>
225             <field name="act_to" ref="act_wait_ship"/>
226         </record>
227         
228         <record id="trans_router_wait_invoice_shipping" model="workflow.transition">
229             <field name="act_from" ref="sale.act_wait_invoice"/>
230             <field name="act_to" ref="sale.act_invoice_end"/>
231             <field name="condition">(order_policy=='picking')</field>
232         </record>
233
234         <record id="trans_wait_invoice_invoice" model="workflow.transition">
235             <field name="act_from" ref="sale.act_wait_invoice"/>
236             <field name="act_to" ref="sale.act_invoice"/>
237             <field name="condition">order_policy=='prepaid'</field>
238         </record>
239         
240         <record id="trans_wait_ship_cancel3" model="workflow.transition">
241             <field name="act_from" ref="act_wait_ship"/>
242             <field name="act_to" ref="act_cancel3"/>
243             <field name="signal">cancel</field>
244         </record>
245
246         <record id="trans_wait_ship_ship" model="workflow.transition">
247             <field name="act_from" ref="act_wait_ship"/>
248             <field name="act_to" ref="act_ship"/>
249             <field name="condition">procurement_needed() and ((order_policy!='prepaid') or invoiced)</field>
250         </record>
251         <record id="trans_wait_ship_done" model="workflow.transition">
252             <field name="act_from" ref="act_wait_ship"/>
253             <field name="act_to" ref="act_ship_end"/>
254             <field name="condition">not procurement_needed()</field>
255         </record>
256         
257         <record id="trans_ship_end_done" model="workflow.transition">
258             <field name="act_from" ref="act_ship_end"/>
259             <field name="act_to" ref="sale.act_done"/>
260         </record>
261         
262         <record id="trans_ship_ship_end" model="workflow.transition">
263             <field name="act_from" ref="act_ship"/>
264             <field name="act_to" ref="act_ship_end"/>
265             <field name="trigger_model">procurement.order</field>
266             <field name="trigger_expr_id">procurement_lines_get()</field>
267             <field name="condition">test_state('finished')</field>
268         </record>
269         
270         <record id="trans_ship_ship_except" model="workflow.transition">
271             <field name="act_from" ref="act_ship"/>
272             <field name="act_to" ref="act_ship_except"/>
273             <field name="signal">ship_except</field>
274         </record>
275         
276         <record id="trans_ship_except_ship" model="workflow.transition">
277             <field name="act_from" ref="act_ship_except"/>
278             <field name="act_to" ref="act_ship"/>
279             <field name="signal">ship_recreate</field>
280         </record>
281         
282         <record id="trans_ship_except_ship_ignore" model="workflow.transition">
283             <field name="act_from" ref="act_ship_except"/>
284             <field name="act_to" ref="act_ship_ignore"/>
285             <field name="signal">ship_corrected</field>
286         </record>
287
288         <record id="trans_ship_ignore_ship_end" model="workflow.transition">
289             <field name="act_from" ref="act_ship_ignore"/>
290             <field name="act_to" ref="act_ship_end"/>
291         </record>
292         
293         <record id="trans_ship_except_ship_cancel" model="workflow.transition">
294             <field name="act_from" ref="act_ship_except"/>
295             <field name="act_to" ref="act_ship_cancel"/>
296             <field name="signal">ship_cancel</field>
297         </record>
298         
299
300     </data>
301 </openerp>