2 In order to test the cancel sale order.
5 !workflow {model: sale.order, action: order_confirm, ref: sale.sale_order_8}
7 I send delivery in two shipments, so I am doing a partial delivery order.
9 !python {model: stock.picking}: |
10 delivery_orders = self.search(cr, uid, [('sale_id','=',ref("sale.sale_order_8"))])
11 first_picking = self.browse(cr, uid, delivery_orders[0], context=context)
12 if first_picking.force_assign(cr, uid, first_picking):
13 first_move = first_picking.move_lines[0]
14 values = {'move%s'%(first_move.id): {'product_qty': 2, 'product_uom':ref('product.product_uom_unit')}}
15 first_picking.do_partial(values, context=context)
17 Now I cancel latest shipment.
19 !python {model: stock.picking}: |
21 delivery_orders = self.search(cr, uid, [('sale_id','=',ref("sale.sale_order_8"))])
22 last_delivery_order_id = delivery_orders[0]
23 wf_service = netsvc.LocalService("workflow")
24 wf_service.trg_validate(uid, 'stock.picking', last_delivery_order_id, 'button_cancel', cr)
28 !python {model: procurement.order}: |
30 self.run_scheduler(cr, uid)
32 I check order status in "Ship Exception".
34 !assert {model: sale.order, id: sale.sale_order_8, string: Sale order should be in shipping exception}:
35 - state == "shipping_except"
37 Now I regenerate shipment.
39 !workflow {model: sale.order, action: ship_recreate, ref: sale.sale_order_8}
41 I check state of order in 'To Invoice'.
43 !assert {model: sale.order, id: sale.sale_order_8, string: Sale order should be In Progress state}:
46 I make invoice for order.
48 !workflow {model: sale.order, action: manual_invoice, ref: sale.sale_order_8}
50 To cancel the sale order from Invoice Exception, I have to cancel the invoice of sale order.
52 !python {model: sale.order}: |
54 invoice_ids = self.browse(cr, uid, ref("sale.sale_order_8")).invoice_ids
55 wf_service = netsvc.LocalService("workflow")
56 first_invoice_id = invoice_ids[0]
57 wf_service.trg_validate(uid, 'account.invoice', first_invoice_id.id, 'invoice_cancel', cr)
59 I check order status in "Invoice Exception" and related invoice is in cancel state.
61 !assert {model: sale.order, id: sale.sale_order_8, string: Sale order should be in Invoice Exception state}:
62 - state == "invoice_except", "Order should be in Invoice Exception state after cancel Invoice"
64 Then I click on the Ignore Exception button.
66 !workflow {model: sale.order, action: invoice_corrected, ref: sale.sale_order_8}
69 I check state of order in 'In Progress'.
71 !assert {model: sale.order, id: sale.sale_order_8, string: Sale order should be In progress state}: