2 In order to test the cancel sale order.
4 Now I cancel Quotation.
6 !python {model: sale.order}: |
7 self.action_cancel(cr, uid, [ref("order7")])
9 I check state of Quotation after cancelled.
11 !assert {model: sale.order, id: order7, string: sale order should be in cancel state}:
14 I set cancelled quotation to draft.
16 !python {model: sale.order}: |
17 self.action_cancel_draft(cr, uid, [ref("order7")])
21 !workflow {model: sale.order, action: order_confirm, ref: order7}
23 I send delivery in two shipments, so I am doing a partial delivery order.
25 !python {model: stock.picking}: |
26 delivery_orders = self.search(cr, uid, [('sale_id','=',ref("order7"))])
27 first_picking = self.browse(cr, uid, delivery_orders[0], context=context)
28 if first_picking.force_assign(cr, uid, first_picking):
29 first_move = first_picking.move_lines[0]
30 values = {'move%s'%(first_move.id): {'product_qty': 5, 'product_uom':ref('product.product_uom_unit')}}
31 first_picking.do_partial(values, context=context)
33 Now I cancel latest shipment.
35 !python {model: stock.picking}: |
37 delivery_orders = self.search(cr, uid, [('sale_id','=',ref("order7"))])
38 last_delivery_order_id = delivery_orders[0]
39 wf_service = netsvc.LocalService("workflow")
40 wf_service.trg_validate(uid, 'stock.picking', last_delivery_order_id, 'button_cancel', cr)
44 !python {model: procurement.order}: |
46 self.run_scheduler(cr, uid)
48 I check order status in "Ship Exception".
50 !assert {model: sale.order, id: order7, string: Sale order should be in shipping exception}:
51 - state == "shipping_except"
53 Now I regenerate shipment.
55 !workflow {model: sale.order, action: ship_recreate, ref: order7}
57 I check state of order in 'To Invoice'.
59 !assert {model: sale.order, id: order7, string: Sale order should be In Progress state}:
62 I make invoice for order.
64 !workflow {model: sale.order, action: manual_invoice, ref: order7}
66 To cancel the sale order from Invoice Exception, I have to cancel the invoice of sale order.
68 !python {model: sale.order}: |
70 invoice_ids = self.browse(cr, uid, ref("order7")).invoice_ids
71 wf_service = netsvc.LocalService("workflow")
72 first_invoice_id = invoice_ids[0]
73 wf_service.trg_validate(uid, 'account.invoice', first_invoice_id.id, 'invoice_cancel', cr)
75 I check order status in "Invoice Exception" and related invoice is in cancel state.
77 !assert {model: sale.order, id: order7, string: Sale order should be in Invoice Exception state}:
78 - state == "invoice_except", "Order should be in Invoice Exception state after cancel Invoice"
80 Then I click on the Ignore Exception button.
82 !workflow {model: sale.order, action: invoice_corrected, ref: order7}
85 I check state of order in 'In Progress'.
87 !assert {model: sale.order, id: order7, string: Sale order should be In progress state}: