47 lines
1.9 KiB
YAML
47 lines
1.9 KiB
YAML
-
|
|
In order to test the cancel sale order.
|
|
I confirm order.
|
|
-
|
|
!workflow {model: sale.order, action: order_confirm, ref: sale_order_8}
|
|
-
|
|
|
|
I check state of order in 'Sale Order'.
|
|
-
|
|
!assert {model: sale.order, id: sale_order_8, string: Sale order should be In Progress state}:
|
|
- state == 'manual'
|
|
-
|
|
I check that Invoice should not be created.
|
|
-
|
|
!python {model: sale.order}: |
|
|
sale_order = self.browse(cr, uid, ref("sale_order_8"))
|
|
assert len(sale_order.invoice_ids) == False, "Invoice should not be created."
|
|
|
|
-
|
|
I create advance invoice.
|
|
-
|
|
!python {model: sale.advance.payment.inv}: |
|
|
ctx = context.copy()
|
|
ctx.update({"active_model": 'sale.order', "active_ids": [ref("sale_order_8")], "active_id":ref("sale.sale_order_8")})
|
|
order_line = self.pool.get('sale.order.line').browse(cr, uid, ref("sale_order_line_20"), context=context)
|
|
pay_id = self.create(cr, uid, {'advance_payment_method': 'fixed', 'product_id': order_line.product_id.id, 'amount': order_line.price_subtotal, 'qtty': order_line.product_uom_qty})
|
|
self.create_invoices(cr, uid, [pay_id], context=ctx)
|
|
|
|
-
|
|
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_order_8")).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_order_8, 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_order_8}
|