[IMP]: Improved code to use new object res.config.settings for application settings.
[odoo/odoo.git] / addons / sale / test / cancel_order.yml
1 -
2   In order to test the cancel sale order.
3 -
4   Now I cancel Quotation.
5 -
6   !python {model: sale.order}: |
7     self.action_cancel(cr, uid, [ref("order7")])
8 -
9   I check state of Quotation after cancelled.
10 -
11   !assert {model: sale.order, id: order7, string: sale order should be in cancel state}:
12     - state == 'cancel'
13 -
14   I set cancelled quotation to draft.
15 -
16   !python {model: sale.order}: |
17     self.action_cancel_draft(cr, uid, [ref("order7")])
18 -
19   I confirm order.
20 -
21   !workflow {model: sale.order, action: order_confirm, ref: order7}
22 -
23   I send delivery in two shipments, so I am doing a partial delivery order.
24 -
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)
32 -
33   Now I cancel latest shipment.
34 -
35   !python {model: stock.picking}: |
36     import netsvc
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)
41 -
42   I run the scheduler.
43 -
44   !python {model: procurement.order}: |
45
46      self.run_scheduler(cr, uid)
47 -
48   I check order status in "Ship Exception".
49 -
50   !assert {model: sale.order, id: order7, string: Sale order should be in shipping exception}:
51     - state == "shipping_except"
52 -
53   Now I regenerate shipment.
54 -
55   !workflow {model: sale.order, action: ship_recreate, ref: order7}
56 -
57   I check state of order in 'To Invoice'.
58 -
59   !assert {model: sale.order, id: order7, string: Sale order should be In Progress state}:
60     - state == 'manual'
61 -
62   I make invoice for order.
63 -
64   !workflow {model: sale.order, action: manual_invoice, ref: order7}
65 -
66   To cancel the sale order from Invoice Exception, I have to cancel the invoice of sale order.
67 -
68   !python {model: sale.order}: |
69     import netsvc
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)
74 -
75   I check order status in "Invoice Exception" and related invoice is in cancel state.
76 -
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"
79 -
80   Then I click on the Ignore Exception button.
81 -
82   !workflow {model: sale.order, action: invoice_corrected, ref: order7}
83
84 -
85   I check state of order in 'In Progress'.
86 -
87   !assert {model: sale.order, id: order7, string: Sale order should be In progress state}:
88     - state == 'progress'