2
I create a Sale Order to follow
4
!record {model: sale.order, id: so1}:
6
company_id: base.main_company
9
invoice_quantity: order
10
partner_order_id: customer1_addr
11
partner_invoice_id: customer1_addr
12
partner_shipping_id: customer1_addr
14
pricelist_id: product.list0
19
product_uom: product.product_uom_unit
29
product_uom: product.product_uom_unit
39
product_uom: product.product_uom_unit
49
product_uom: product.product_uom_unit
60
!python {model: ir.actions.server}: |
61
context = {'active_id': ref('sales_followup.so1'),
62
'active_ids': [ref('sales_followup.so1')]}
63
res = self.run(cr, uid, [ref('sales_followup.action_sale_order_follow_up')], context)
64
assert res != False, "Error on ir.actions.server launching"
66
I check the creation of the wizard
68
!python {model: sale.order.followup}: |
69
assert len(self.search(cr, uid, [])) == 1, "Wrong number of created wizard"
71
(Step 1) I check if the wizard is related to the sale order and if the information is ok
73
!python {model: sale.order.followup}: |
74
wiz_ids = self.search(cr, uid, [])
75
for wiz in self.browse(cr, uid, wiz_ids):
76
assert wiz.order_id.id == ref('sales_followup.so1'), "The created wizard is not linked to the Sale Order (1)"
77
assert wiz.state == 'Draft', "The state on the wizard is different than the state of the Sale Order (1)"
78
assert len(wiz.line_ids) == 4, "Number of lines in the follow-up not corresponding to the number of lines in the sale order (1)"
79
for line in wiz.line_ids:
80
if line.product_id.id == ref('product1'):
81
assert line.sourced_ok == 'No', "Sourced is not equal to 'No' (1/P1)"
82
assert len(line.tender_ids) == 0, "Number of calls for tender is different than 0 (1/P1)"
83
assert line.tender_status == 'N/A (0)', "Tender status is different than 'N/A (0)' (1/P1)"
84
assert len(line.purchase_ids) == 0, "Number of PO is different than 0 (1/P1)"
85
assert line.purchase_status == 'No order (0)', "The purchase status is different than 'No order (0)' (1/P1)"
86
assert len(line.incoming_ids) == 0, "Number of Incoming shipment is different than 0 (1/P1)"
87
assert line.incoming_status == 'No shipment (0)', "The incoming status is different than 'No shipment (0)' (1/P1)"
88
assert line.product_available == 'Waiting (0.0)', "The product availability is not 'Waiting (0.0)' (1/P1)"
89
assert line.available_qty == 0.00, "The available qty is not equal to 0.00 (1/P1)"
90
assert len(line.outgoing_ids) == 0, "Number of outgoing deliveries is different than 0 (1/P1)"
91
assert line.outgoing_status == 'No deliveries (0)', "Outgoing status is different than 'No deliveries (0)' (1/P1)"
93
if line.product_id.id == ref('product2'):
94
assert line.sourced_ok == 'No', "Sourced is not equal to 'No' (1/P2)"
95
assert len(line.tender_ids) == 0, "Number of calls for tender is different than 0 (1/P2)"
96
assert line.tender_status == 'N/A (0)', "Tender status is different than 'N/A (0)' (1/P2)"
97
assert len(line.purchase_ids) == 0, "Number of PO is different than 0 (1/P2)"
98
assert line.purchase_status == 'N/A (0)', "The purchase status is not 'N/A (0)' (1/P2)"
99
assert len(line.incoming_ids) == 0, "Number of Incoming shipment is different than 0 (1/P2)"
100
assert line.incoming_status == 'N/A (0)', "The incoming status is not 'N/A (0)' (1/P2)"
101
assert line.product_available == 'Waiting (0.0)', "The product availability is not 'Waiting (0.0)' (1/P2)"
102
assert line.available_qty == 0.00, "The available qty is not equal to 0.00 (1/P2)"
103
assert len(line.outgoing_ids) == 0, "Number of outgoing deliveries is different than 0 (1/P2)"
104
assert line.outgoing_status == 'No deliveries (0)', "Outgoing status is different than 'No deliveries (0)' (1/P2)"
106
if line.product_id.id == ref('product3'):
107
assert line.sourced_ok == 'No', "Sourced is not equal to 'No' (1/P3)"
108
assert len(line.tender_ids) == 0, "Number of calls for tender is different than 0 (1/P3)"
109
assert line.tender_status == 'N/A (0)', "Tender status is different than 'N/A (0)' (1/P3)"
110
assert len(line.purchase_ids) == 0, "Number of PO is different than 0 (1/P3)"
111
assert line.purchase_status == 'N/A (0)', "The purchase status is not 'N/A (0)' (1/P3)"
112
assert len(line.incoming_ids) == 0, "Number of Incoming shipment is different than 0 (1/P3)"
113
assert line.incoming_status == 'N/A (0)', "The incoming status is not 'N/A (0)' (1/P3)"
114
assert line.product_available == 'Waiting (2000.0)', "The product availability is not 'Waiting (2000.0)' (1/P3)"
115
assert line.available_qty == 2000.0, "The available qty is not equal to 2000.00 (1/P3)"
116
assert len(line.outgoing_ids) == 0, "Number of outgoing deliveries is different than 0 (1/P3)"
117
assert line.outgoing_status == 'No deliveries (0)', "Outgoing status is different than 'No deliveries (0)' (1/P3)"
119
if line.product_id.id == ref('product4'):
120
assert line.sourced_ok == 'No', "Sourced is not equal to 'No' (1/P4)"
121
assert len(line.tender_ids) == 0, "Number of calls for tender is different than 0 (1/P4)"
122
assert line.tender_status == 'N/A (0)', "Tender status is different than 'N/A (0)' (1/P4)"
123
assert len(line.purchase_ids) == 0, "Number of PO is different than 0 (1/P4)"
124
assert line.purchase_status == 'No order (0)', "The purchase status is different than 'No order (0)' (1/P4)"
125
assert len(line.incoming_ids) == 0, "Number of Incoming shipment is different than 0 (1/P4)"
126
assert line.incoming_status == 'No shipment (0)', "The incoming status is different than 'No shipment (0)' (1/P4)"
127
assert line.product_available == 'Waiting (0.0)', "The product availability is not 'Waiting (0.0)' (1/P4)"
128
assert line.available_qty == 0.00, "The available qty is not equal to 0.00 (1/P4)"
129
assert len(line.outgoing_ids) == 0, "Number of outgoing deliveries is different than 0 (1/P4)"
130
assert line.outgoing_status == 'No deliveries (0)', "Outgoing status is different than 'No deliveries (0)' (1/P4)"
132
self.unlink(cr, uid, wiz_ids)
134
I confirm the sale order
136
!workflow {model: sale.order, action: order_confirm, ref: so1}
139
I create again a wizard
141
!python {model: ir.actions.server}: |
142
context = {'active_id': ref('sales_followup.so1'),
143
'active_ids': [ref('sales_followup.so1')]}
144
res = self.run(cr, uid, [ref('sales_followup.action_sale_order_follow_up')], context)
145
assert res != False, "Error on ir.actions.server launching"
147
(Step 2) I check if the wizard is related to the sale order and if the information is ok
149
!python {model: sale.order.followup}: |
150
wiz_ids = self.search(cr, uid, [])
151
for wiz in self.browse(cr, uid, wiz_ids):
152
assert wiz.order_id.id == ref('sales_followup.so1'), "The created wizard is not linked to the Sale Order (2)"
153
assert len(wiz.line_ids) == 4, "Number of lines in the follow-up not corresponding to the number of lines in the sale order (2)"
155
for line in wiz.line_ids:
156
if line.product_id.id == ref('product1'):
157
assert line.sourced_ok == 'Closed', "Sourced is not equal to 'Closed' (2/P1)"
158
assert len(line.tender_ids) == 0, "Number of calls for tender is different than 0 (2/P1)"
159
assert line.tender_status == 'N/A (0)', "Tender status is different than 'N/A (0)' (2/P1)"
160
assert len(line.purchase_ids) == 0, "Number of PO is different than 0 (2/P1)"
161
assert line.purchase_status == 'No order (0)', "The purchase status is different than 'No order (0)' (2/P1)"
162
assert len(line.incoming_ids) == 0, "Number of Incoming shipment is different than 0 (2/P1)"
163
assert line.incoming_status == 'No shipment (0)', "The incoming status is different than 'No shipment (0)' (2/P1)"
164
assert line.product_available == 'Waiting (0.0)', "The product availability is not 'Waiting (0.0)' (2/P1)"
165
assert line.available_qty == 0.00, "The available qty is not equal to 0.00 (2/P1)"
166
assert len(line.outgoing_ids) == 1, "Number of outgoing deliveries is different than 1 (2/P1)"
167
assert line.outgoing_status == 'Waiting (1)', "Outgoing status is different than 'Waiting (1)' (2/P1)"
169
if line.product_id.id == ref('product2'):
170
assert line.sourced_ok == 'Closed', "Sourced is not equal to 'Closed' (2/P2)"
171
assert len(line.tender_ids) == 0, "Number of calls for tender is different than 0 (2/P2)"
172
assert line.tender_status == 'N/A (0)', "Tender status is different than 'N/A (0)' (2/P2)"
173
assert len(line.purchase_ids) == 0, "Number of PO is different than 0 (2/P2)"
174
assert line.purchase_status == 'N/A (0)', "The purchase status is not 'N/A (0)' (2/P2)"
175
assert len(line.incoming_ids) == 0, "Number of Incoming shipment is different than 0 (2/P2)"
176
assert line.incoming_status == 'N/A (0)', "The incoming status is not 'N/A (0)' (2/P2)"
177
assert line.product_available == 'Waiting (0.0)', "The product availability is not 'Waiting (0.0)' (2/P2)"
178
assert line.available_qty == 0.00, "The available qty is not equal to 0.00 (2/P2)"
179
assert len(line.outgoing_ids) == 1, "Number of outgoing deliveries is different than 1 (2/P2)"
180
assert line.outgoing_status == 'Waiting (1)', "Outgoing status is different than 'Waiting (1)'(2/P2)"
182
if line.product_id.id == ref('product3'):
183
assert line.sourced_ok == 'Closed', "Sourced is not equal to 'Closed' (2/P3)"
184
assert len(line.tender_ids) == 0, "Number of calls for tender is different than 0 (2/P3)"
185
assert line.tender_status == 'N/A (0)', "Tender status is different than 'N/A (0)' (2/P3)"
186
assert len(line.purchase_ids) == 0, "Number of PO is different than 0 (2/P3)"
187
assert line.purchase_status == 'N/A (0)', "The purchase status is not 'N/A (0)' (2/P3)"
188
assert len(line.incoming_ids) == 0, "Number of Incoming shipment is different than 0 (2/P3)"
189
assert line.incoming_status == 'N/A (0)', "The incoming status is not 'N/A (0)' (2/P3)"
190
assert line.product_available == 'Available (2000.0)', "The product availability is not 'Available (2000.0)' (2/P3)"
191
assert line.available_qty == 2000.0, "The available qty is not equal to 2000.00 (2/P3)"
192
assert len(line.outgoing_ids) == 1, "Number of outgoing deliveries is different than 1 (2/P3)"
193
assert line.outgoing_status == 'Available (1)', "Outgoing status is different than 'Waiting (1)' (2/P3)"
195
if line.product_id.id == ref('product4'):
196
assert line.sourced_ok == 'Closed', "Sourced is not equal to 'Closed' (2/P4)"
197
assert len(line.tender_ids) == 0, "Number of calls for tender is different than 0 (2/P4)"
198
assert line.tender_status == 'N/A (0)', "Tender status is different than 'N/A (0)' (2/P4)"
199
assert len(line.purchase_ids) == 0, "Number of PO is different than 0 (2/P4)"
200
assert line.purchase_status == 'No order (0)', "The purchase status is different than 'No order (0)' (2/P4)"
201
assert len(line.incoming_ids) == 0, "Number of Incoming shipment is different than 0 (2/P4)"
202
assert line.incoming_status == 'No shipment (0)', "The incoming status is different than 'No shipment (0)' (2/P4)"
203
assert line.product_available == 'Waiting (0.0)', "The product availability is not 'Waiting (0.0)' (2/P4)"
204
assert line.available_qty == 0.00, "The available qty is not equal to 0.00 (2/P4)"
205
assert len(line.outgoing_ids) == 1, "Number of outgoing deliveries is different than 1 (2/P4)"
206
assert line.outgoing_status == 'Waiting (1)', "Outgoing status is different than 'Waiting (1)' (2/P4)"
207
self.unlink(cr, uid, wiz_ids)
211
!python {model: procurement.order}: |
212
self.run_scheduler(cr, uid , context={'update_mode':'init'})
214
I create again a wizard
216
!python {model: ir.actions.server}: |
217
context = {'active_id': ref('sales_followup.so1'),
218
'active_ids': [ref('sales_followup.so1')]}
219
res = self.run(cr, uid, [ref('sales_followup.action_sale_order_follow_up')], context)
220
assert res != False, "Error on ir.actions.server launching"
222
(Step 3) I check if the wizard is related to the sale order and if the information is ok
224
!python {model: sale.order.followup}: |
226
wiz_ids = self.search(cr, uid, [])
227
for wiz in self.browse(cr, uid, wiz_ids):
228
assert wiz.order_id.id == ref('sales_followup.so1'), "The created wizard is not linked to the Sale Order (3)"
229
assert len(wiz.line_ids) == 4, "Number of lines in the follow-up not corresponding to the number of lines in the sale order (3)"
231
for line in wiz.line_ids:
232
if line.product_id.id == ref('product1'):
233
assert line.sourced_ok == 'Closed', "Sourced is not equal to 'Closed' (3/P1)"
234
assert len(line.tender_ids) == 0, "Number of calls for tender is different than 0 (3/P1)"
235
assert line.tender_status == 'N/A (0)', "Tender status is different than 'N/A (0)' (3/P1)"
236
assert len(line.purchase_ids) == 1, "Number of PO is different than 0 (3/P1)"
237
assert line.purchase_status == 'Draft (1)', "The purchase status is different than 'Draft (1)' (3/P1)"
238
assert len(line.incoming_ids) == 0, "Number of Incoming shipment is different than 0 (3/P1)"
239
assert line.incoming_status == 'No shipment (0)', "The incoming status is different than 'No shipment (0)' (3/P1)"
240
assert line.product_available == 'Waiting (0.0)', "The product availability is not 'Waiting (0.0)' (3/P1)"
241
assert line.available_qty == 0.0, "The available qty is not equal to 0.00 (3/P1)"
242
assert len(line.outgoing_ids) == 1, "Number of outgoing deliveries is different than 1 (3/P1)"
243
assert line.outgoing_status == 'Waiting (1)', "Outgoing status is different than 'Waiting (1)' (3/P1)"
245
for quotation in line.purchase_ids:
246
for o_line in quotation.order_line:
247
self.pool.get('purchase.order.line').write(cr, uid, o_line.id, {'price_unit': 6000})
248
wf_service = netsvc.LocalService("workflow")
249
wf_service.trg_validate(uid, 'purchase.order', quotation.id, 'purchase_confirm', cr)
251
if line.product_id.id == ref('product2'):
252
assert line.sourced_ok == 'Closed', "Sourced is not equal to 'Closed' (3/P2)"
253
assert len(line.tender_ids) == 0, "Number of calls for tender is different than 0 (3/P2)"
254
assert line.tender_status == 'N/A (0)', "Tender status is different than 'N/A (0)' (3/P2)"
255
assert len(line.purchase_ids) == 0, "Number of PO is different than 0 (3/P2)"
256
assert line.purchase_status == 'N/A (0)', "The purchase status is not 'N/A (0)' (3/P2)"
257
assert len(line.incoming_ids) == 0, "Number of Incoming shipment is different than 0 (3/P2)"
258
assert line.incoming_status == 'N/A (0)', "The incoming status is not 'N/A (0)' (3/P2)"
259
assert line.product_available == 'Waiting (0.0)', "The product availability is not 'Waiting (0.0)' (3/P2)"
260
assert line.available_qty == 0.0, "The available qty is not equal to 0.00 (3/P2)"
261
assert len(line.outgoing_ids) == 1, "Number of outgoing deliveries is different than 1 (3/P2)"
262
assert line.outgoing_status == 'Waiting (1)', "Outgoing status is different than 'Waiting (1)' (3/P2)"
264
if line.product_id.id == ref('product3'):
265
assert line.sourced_ok == 'Closed', "Sourced is not equal to 'Closed' (3/P3)"
266
assert len(line.tender_ids) == 0, "Number of calls for tender is different than 0 (3/P3)"
267
assert line.tender_status == 'N/A (0)', "Tender status is different than 'N/A (0)' (3/P3)"
268
assert len(line.purchase_ids) == 0, "Number of PO is different than 0 (3/P3)"
269
assert line.purchase_status == 'N/A (0)', "The purchase status is not 'N/A (0)' (3/P3)"
270
assert len(line.incoming_ids) == 0, "Number of Incoming shipment is different than 0 (3/P3)"
271
assert line.incoming_status == 'N/A (0)', "The incoming status is not 'N/A (0)' (3/P3)"
272
assert line.product_available == 'Available (2000.0)', "The product availability is not 'Available (2000.0)' (3/P3)"
273
assert line.available_qty == 2000.0, "The available qty is not equal to 2000.00 (3/P3)"
274
assert len(line.outgoing_ids) == 1, "Number of outgoing deliveries is different than 1 (3/P3)"
275
assert line.outgoing_status == 'Available (1)', "Outgoing status is different than 'Available (1)' (3/P3)"
277
if line.product_id.id == ref('product4'):
278
assert line.sourced_ok == 'Closed', "Sourced is not equal to 'Closed' (3/P4)"
279
assert len(line.tender_ids) == 0, "Number of calls for tender is different than 0 (3/P4)"
280
assert line.tender_status == 'N/A (0)', "Tender status is different than 'N/A (0)' (3/P4)"
281
assert len(line.purchase_ids) == 1, "Number of PO is different than 1 (3/P4)"
282
assert line.purchase_status == 'Draft (1)', "The purchase status is different than 'Draft (1)' (3/P4)"
283
assert len(line.incoming_ids) == 0, "Number of Incoming shipment is different than 0 (3/P4)"
284
assert line.product_available == 'Waiting (0.0)', "The product availability is not 'Waiting (0.0)' (3/P4)"
285
assert line.available_qty == 0.00, "The available qty is not equal to 0.00 (3/P4)"
286
assert len(line.outgoing_ids) == 1, "Number of outgoing deliveries is different than 1 (3/P4)"
287
assert line.outgoing_status == 'Waiting (1)', "Outgoing status is different than 'Waiting (1)' (3/P4)"
289
for quotation in line.purchase_ids:
290
for o_line in quotation.order_line:
291
self.pool.get('purchase.order.line').write(cr, uid, o_line.id, {'price_unit': 6000})
292
wf_service = netsvc.LocalService("workflow")
293
wf_service.trg_validate(uid, 'purchase.order', quotation.id, 'purchase_confirm', cr)
295
self.unlink(cr, uid, wiz_ids)
297
I create again a wizard
299
!python {model: ir.actions.server}: |
300
context = {'active_id': ref('sales_followup.so1'),
301
'active_ids': [ref('sales_followup.so1')]}
302
res = self.run(cr, uid, [ref('sales_followup.action_sale_order_follow_up')], context)
303
assert res != False, "Error on ir.actions.server launching"
305
(Step 4) I check if the wizard is related to the sale order and if the information is ok
307
!python {model: sale.order.followup}: |
309
wiz_ids = self.search(cr, uid, [])
310
for wiz in self.browse(cr, uid, wiz_ids):
311
assert wiz.order_id.id == ref('sales_followup.so1'), "The created wizard is not linked to the Sale Order (4)"
312
assert len(wiz.line_ids) == 4, "Number of lines in the follow-up not corresponding to the number of lines in the sale order (4)"
314
for line in wiz.line_ids:
316
if line.product_id.id == ref('product1'):
317
assert line.sourced_ok == 'Closed', "Sourced is not equal to 'Closed' (4/P1)"
318
assert len(line.tender_ids) == 0, "Number of calls for tender is different than 0 (4/P1)"
319
assert line.tender_status == 'N/A (0)', "Tender status is different than 'N/A (0)' (4/P1)"
320
assert len(line.purchase_ids) == 1, "Number of PO is different than 1 (4/P1)"
321
assert line.purchase_status == 'Validated (1)', "The purchase status is different than 'Validated (1)' (4/P1)"
322
assert len(line.incoming_ids) == 0, "Number of Incoming shipment is different than 0 (4/P1)"
323
assert line.incoming_status == 'No shipment (0)', "The incoming status is different than 'No shipment (0)' (4/P1)"
324
assert line.product_available == 'Waiting (0.0)', "The product availability is not 'Waiting (0.0)' (4/P1)"
325
assert line.available_qty == 0.0, "The available qty is not equal to 0.00 (4/P1)"
326
assert len(line.outgoing_ids) == 1, "Number of outgoing deliveries is different than 1 (4/P1)"
327
assert line.outgoing_status == 'Waiting (1)', "Outgoing status is different than 'Waiting (1)' (4/P1)"
329
if line.product_id.id == ref('product2'):
330
assert line.sourced_ok == 'Closed', "Sourced is not equal to 'Closed' (4/P2)"
331
assert len(line.tender_ids) == 0, "Number of calls for tender is different than 0 (4/P2)"
332
assert line.tender_status == 'N/A (0)', "Tender status is different than 'N/A (0)' (4/P2)"
333
assert len(line.purchase_ids) == 0, "Number of PO is different than 0 (4/P2)"
334
assert line.purchase_status == 'N/A (0)', "The purchase status is not 'N/A (0)' (4/P2)"
335
assert len(line.incoming_ids) == 0, "Number of Incoming shipment is different than 0 (4/P2)"
336
assert line.incoming_status == 'N/A (0)', "The incoming status is not 'N/A (0)' (4/P2)"
337
assert line.product_available == 'Waiting (0.0)', "The product availability is not 'Waiting (0.0)' (4/P2)"
338
assert line.available_qty == 0.0, "The available qty is not equal to 0.00 (4/P2)"
339
assert len(line.outgoing_ids) == 1, "Number of outgoing deliveries is different than 1 (4/P2)"
340
assert line.outgoing_status == 'Waiting (1)', "Outgoing status is different than 'Waiting (1)' (4/P2)"
342
if line.product_id.id == ref('product3'):
343
assert line.sourced_ok == 'Closed', "Sourced is not equal to 'Closed' (4/P3)"
344
assert len(line.tender_ids) == 0, "Number of calls for tender is different than 0 (4/P3)"
345
assert line.tender_status == 'N/A (0)', "Tender status is different than 'N/A (0)' (4/P3)"
346
assert len(line.purchase_ids) == 0, "Number of PO is different than 0 (4/P3)"
347
assert line.purchase_status == 'N/A (0)', "The purchase status is not 'N/A (0)' (4/P3)"
348
assert len(line.incoming_ids) == 0, "Number of Incoming shipment is different than 0 (4/P3)"
349
assert line.incoming_status == 'N/A (0)', "The incoming status is not 'N/A (0)' (4/P3)"
350
assert line.product_available == 'Available (2000.0)', "The product availability is not 'Available (2000.0)' (4/P3)"
351
assert line.available_qty == 2000.0, "The available qty is not equal to 2000.00 (4/P3)"
352
assert len(line.outgoing_ids) == 1, "Number of outgoing deliveries is different than 1 (4/P3)"
353
assert line.outgoing_status == 'Available (1)', "Outgoing status is different than 'Available (1)' (4/P3)"
354
for move in line.outgoing_ids:
355
self.pool.get('stock.move').action_assign(cr, uid, [move.id])
357
if line.product_id.id == ref('product4'):
358
assert line.sourced_ok == 'Closed', "Sourced is not equal to 'Closed' (4/P4)"
359
assert len(line.tender_ids) == 0, "Number of calls for tender is different than 0 (4/P4)"
360
assert line.tender_status == 'N/A (0)', "Tender status is different than 'N/A (0)' (4/P4)"
361
assert len(line.purchase_ids) == 1, "Number of PO is different than 1 (4/P4)"
362
assert line.purchase_status == 'Validated (1)', "The purchase status is different than 'Validated (1)' (4/P4)"
363
assert len(line.incoming_ids) == 0, "Number of Incoming shipment is different than 0 (4/P4)"
364
assert line.incoming_status == 'No shipment (0)', "The incoming status is different than 'No shipment (0)' (4/P4)"
365
assert line.product_available == 'Waiting (0.0)', "The product availability is not 'Waiting (0.0)' (4/P4)"
366
assert line.available_qty == 0.00, "The available qty is not equal to 0.00 (4/P4)"
367
assert len(line.outgoing_ids) == 1, "Number of outgoing deliveries is different than 1 (4/P4)"
368
assert line.outgoing_status == 'Waiting (1)', "Outgoing status is different than 'Waiting (1)' (4/P4)"
370
for quotation in line.purchase_ids:
371
# Delivery confirmed date is mandatory at confirmed state (unifield naming) (== 'approved' state openERP naming)
372
quotation.write({'delivery_confirmed_date': '2012-03-03'}, context=context)
373
wf_service = netsvc.LocalService("workflow")
374
wf_service.trg_validate(uid, 'purchase.order', quotation.id, 'purchase_approve', cr)
376
self.unlink(cr, uid, wiz_ids)
378
I create again a wizard
380
!python {model: ir.actions.server}: |
381
context = {'active_id': ref('sales_followup.so1'),
382
'active_ids': [ref('sales_followup.so1')]}
383
res = self.run(cr, uid, [ref('sales_followup.action_sale_order_follow_up')], context)
384
assert res != False, "Error on ir.actions.server launching"
386
(Step 5) I check if the wizard is related to the sale order and if the information is ok
388
!python {model: sale.order.followup}: |
390
wiz_ids = self.search(cr, uid, [])
391
for wiz in self.browse(cr, uid, wiz_ids):
392
assert wiz.order_id.id == ref('sales_followup.so1'), "The created wizard is not linked to the Sale Order (5)"
393
assert len(wiz.line_ids) == 4, "Number of lines in the follow-up not corresponding to the number of lines in the sale order (5)"
395
for line in wiz.line_ids:
396
if line.product_id.id == ref('product1'):
397
assert line.sourced_ok == 'Closed', "Sourced is not equal to 'Closed' (5/P1)"
398
assert len(line.tender_ids) == 0, "Number of calls for tender is different than 0 (5/P1)"
399
assert line.tender_status == 'N/A (0)', "Tender status is different than 'N/A (0)' (5/P1)"
400
assert len(line.purchase_ids) == 1, "Number of PO is different than 1 (5/P1)"
401
assert line.purchase_status == 'Confirmed (1)', "The purchase status is different than 'Confirmed (1)' (5/P1)"
402
assert len(line.incoming_ids) == 1, "Number of Incoming shipment is different than 1 (5/P1)"
403
assert line.incoming_status == 'Available (1)', "The incoming status is different than 'Available (1)' (5/P1)"
404
assert line.product_available == 'Waiting (0.0)', "The product availability is not 'Waiting (0.0)' (5/P1)"
405
assert line.available_qty == 0.00, "The available qty is not equal to 0.00 (5/P1)"
406
assert len(line.outgoing_ids) == 1, "Number of outgoing deliveries is different than 1 (5/P1)"
407
assert line.outgoing_status == 'Waiting (1)', "Outgoing status is different than 'Waiting (1)' (5/P1)"
409
if line.product_id.id == ref('product2'):
410
assert line.sourced_ok == 'Closed', "Sourced is not equal to 'Closed' (5/P2)"
411
assert len(line.tender_ids) == 0, "Number of calls for tender is different than 0 (5/P2)"
412
assert line.tender_status == 'N/A (0)', "Tender status is different than 'N/A (0)' (5/P2)"
413
assert len(line.purchase_ids) == 0, "Number of PO is different than 0 (5/P2)"
414
assert line.purchase_status == 'N/A (0)', "The purchase status is not 'N/A (0)' (5/P2)"
415
assert len(line.incoming_ids) == 0, "Number of Incoming shipment is different than 0 (5/P2)"
416
assert line.incoming_status == 'N/A (0)', "The incoming status is not 'N/A (0)' (5/P2)"
417
assert line.product_available == 'Waiting (0.0)', "The product availability is not 'Waiting (0.0)' (5/P2)"
418
assert line.available_qty == 0.00, "The available qty is not equal to 0.00 (5/P2)"
419
assert len(line.outgoing_ids) == 1, "Number of outgoing deliveries is different than 1 (5/P2)"
420
assert line.outgoing_status == 'Waiting (1)', "Outgoing status is different than 'Waiting (1)' (5/P2)"
422
if line.product_id.id == ref('product3'):
423
assert line.sourced_ok == 'Closed', "Sourced is not equal to 'Closed' (5/P3)"
424
assert len(line.tender_ids) == 0, "Number of calls for tender is different than 0 (5/P3)"
425
assert line.tender_status == 'N/A (0)', "Tender status is different than 'N/A (0)' (5/P3)"
426
assert len(line.purchase_ids) == 0, "Number of PO is different than 0 (5/P3)"
427
assert line.purchase_status == 'N/A (0)', "The purchase status is not 'N/A (0)' (5/P3)"
428
assert len(line.incoming_ids) == 0, "Number of Incoming shipment is different than 0 (5/P3)"
429
assert line.incoming_status == 'N/A (0)', "The incoming status is not 'N/A (0)' (5/P3)"
430
assert line.product_available == 'Available (2000.0)', "The product availability is not 'Available (2000.0)' (5/P3)"
431
assert line.available_qty == 2000.0, "The available qty is not equal to 2000.00 (5/P3)"
432
assert len(line.outgoing_ids) == 1, "Number of outgoing deliveries is different than 1 (5/P3)"
433
assert line.outgoing_status == 'Available (1)', "Outgoing status is different than 'Available (1)' (5/P3)"
434
for out in line.outgoing_ids:
435
self.pool.get('stock.move').action_done(cr, uid, out.id)
437
if line.product_id.id == ref('product4'):
438
assert line.sourced_ok == 'Closed', "Sourced is not equal to 'Closed' (5/P4)"
439
assert len(line.tender_ids) == 0, "Number of calls for tender is different than 0 (5/P4)"
440
assert line.tender_status == 'N/A (0)', "Tender status is different than 'N/A (0)' (5/P4)"
441
assert len(line.purchase_ids) == 1, "Number of PO is different than 1 (5/P4)"
442
assert line.purchase_status == 'Confirmed (1)', "The purchase status is different than 'Confirmed (1)' (5/P4)"
443
assert len(line.incoming_ids) == 1, "Number of Incoming shipment is different than 1 (5/P4)"
444
assert line.incoming_status == 'Available (1)', "The incoming status is different than 'Available (1)' (5/P4)"
445
assert line.product_available == 'Waiting (0.0)', "The product availability is not 'Waiting (0.0)' (5/P4)"
446
assert line.available_qty == 0.00, "The available qty is not equal to 0.00 (5/P4)"
447
assert len(line.outgoing_ids) == 1, "Number of outgoing deliveries is different than 1 (5/P4)"
448
assert line.outgoing_status == 'Waiting (1)', "Outgoing status is different than 'Waiting (1)' (5/P4)"
450
self.unlink(cr, uid, wiz_ids)
452
I create again a wizard
454
!python {model: ir.actions.server}: |
455
context = {'active_id': ref('sales_followup.so1'),
456
'active_ids': [ref('sales_followup.so1')]}
457
res = self.run(cr, uid, [ref('sales_followup.action_sale_order_follow_up')], context)
458
assert res != False, "Error on ir.actions.server launching"
460
(Step 6 - Final) I check if the wizard is related to the sale order and if the information is ok
462
!python {model: sale.order.followup}: |
464
wiz_ids = self.search(cr, uid, [])
465
for wiz in self.browse(cr, uid, wiz_ids):
466
assert wiz.order_id.id == ref('sales_followup.so1'), "The created wizard is not linked to the Sale Order (6)"
467
assert len(wiz.line_ids) == 4, "Number of lines in the follow-up not corresponding to the number of lines in the sale order (6)"
469
for line in wiz.line_ids:
470
if line.product_id.id == ref('product3'):
471
assert line.available_qty == 1997.0, "The available qty is not equal to 1997.00 (6/P3)"
472
assert len(line.outgoing_ids) == 1, "Number of outgoing deliveries is different than 1 (6/P3)"
473
assert line.outgoing_status == 'Closed (1)', "Outgoing status is different than 'Closed (1)' (6/P3)"