odoo/addons/sale_stock/test/cancel_order_sale_stock.yml

42 lines
1.5 KiB
YAML

-
In order to test the cancel sale order.
First I confirm order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale.order5}
-
Now I regenerate shipment.
-
!workflow {model: sale.order, action: ship_recreate, ref: sale.order5}
-
I check state of order in 'To Invoice'.
-
!assert {model: sale.order, id: sale.order5, string: Sale order should be In Progress state}:
- state == 'manual'
-
I make invoice for order.
-
!workflow {model: sale.order, action: manual_invoice, ref: sale.order5}
-
To cancel the sale order from Invoice Exception, I have to cancel the invoice of sale order.
-
!python {model: sale.order}: |
import netsvc
invoice_ids = self.browse(cr, uid, ref("sale.order5")).invoice_ids
wf_service = netsvc.LocalService("workflow")
first_invoice_id = invoice_ids[0]
wf_service.trg_validate(uid, 'account.invoice', first_invoice_id.id, 'invoice_cancel', cr)
-
I check order status in "Invoice Exception" and related invoice is in cancel state.
-
!assert {model: sale.order, id: sale.order5, string: Sale order should be in Invoice Exception state}:
- state == "invoice_except", "Order should be in Invoice Exception state after cancel Invoice"
-
Then I click on the Ignore Exception button.
-
!workflow {model: sale.order, action: invoice_corrected, ref: sale.order5}
-
I check state of order in 'In Progress'.
-
!assert {model: sale.order, id: sale.order5, string: Sale order should be In progress state}:
- state == 'progress'