Launchpad automatic translations update.
[odoo/odoo.git] / addons / sale_stock / test / cancel_order_sale_stock.yml
1 -
2   In order to test the cancel sale order.
3   First I confirm order.
4 -
5   !workflow {model: sale.order, action: order_confirm, ref: sale.sale_order_8}
6 -
7   I send delivery in two shipments, so I am doing a partial delivery order.
8 -
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)
16 -
17   Now I cancel latest shipment.
18 -
19   !python {model: stock.picking}: |
20     import netsvc
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)
25 -
26   I run the scheduler.
27 -
28   !python {model: procurement.order}: |
29
30      self.run_scheduler(cr, uid)
31 -
32   I check order status in "Ship Exception".
33 -
34   !assert {model: sale.order, id: sale.sale_order_8, string: Sale order should be in shipping exception}:
35     - state == "shipping_except"
36 -
37   Now I regenerate shipment.
38 -
39   !workflow {model: sale.order, action: ship_recreate, ref: sale.sale_order_8}
40 -
41   I check state of order in 'To Invoice'.
42 -
43   !assert {model: sale.order, id: sale.sale_order_8, string: Sale order should be In Progress state}:
44     - state == 'manual'
45 -
46   I make invoice for order.
47 -
48   !workflow {model: sale.order, action: manual_invoice, ref: sale.sale_order_8}
49 -
50   To cancel the sale order from Invoice Exception, I have to cancel the invoice of sale order.
51 -
52   !python {model: sale.order}: |
53     import netsvc
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)
58 -
59   I check order status in "Invoice Exception" and related invoice is in cancel state.
60 -
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"
63 -
64   Then I click on the Ignore Exception button.
65 -
66   !workflow {model: sale.order, action: invoice_corrected, ref: sale.sale_order_8}
67
68 -
69   I check state of order in 'In Progress'.
70 -
71   !assert {model: sale.order, id: sale.sale_order_8, string: Sale order should be In progress state}:
72     - state == 'progress'