[IMP]sale: Improve code and add msg string

bzr revid: dbr@tinyerp.com-20111125052938-tlydiz9d8taijl38
This commit is contained in:
DBR (OpenERP)
2011-11-25 10:59:38 +05:30
parent f375cbadaa
commit f74b9565c7
+12 -15
View File
@@ -1,21 +1,20 @@
-
In order to test the cancel sale order.
-
Now I cancel quotation.
Now I cancel Quotation.
-
!python {model: sale.order}: |
self.action_cancel(cr, uid, [ref("order7")])
-
I check state of quotation after cancelled.
I check state of Quotation after cancelled.
-
!assert {model: sale.order, id: order7}:
!assert {model: sale.order, id: order7, string: sale order should be in cancel state}:
- state == 'cancel'
-
I set cancelled quotation to draft.
-
!python {model: sale.order}: |
self.action_cancel_draft(cr, uid, [ref("order7")])
-
I confirm order
-
@@ -26,13 +25,13 @@
!python {model: stock.picking}: |
delivery_orders = self.search(cr, uid, [('sale_id','=',ref("order7"))])
first_picking = self.browse(cr, uid, delivery_orders[0], context=context)
if first_picking.force_assign(context=context):
if first_picking.force_assign(cr, uid, first_picking):
print first_picking.move_lines
first_move = first_picking.move_lines[0]
values = {'move%s'%(first_move.id): {'product_qty': 5}}
first_picking.do_partial(values, context=context)
-
Now I cancel a lastest shipment
Now I cancel latest shipment
-
!python {model: stock.picking}: |
import netsvc
@@ -48,7 +47,7 @@
-
I check order status in "Ship Exception".
-
!assert {model: sale.order, id: order7}:
!assert {model: sale.order, id: order7, string: Sale order should be in shipping exception}:
- state == "ship_except"
-
Now I regenerate shipment
@@ -57,7 +56,7 @@
-
I check state of order in 'In Progress'.
-
!assert {model: sale.order, id: order7}:
!assert {model: sale.order, id: order7, string: Sale order should be In Progress state}:
- state == 'progress'
-
I make invoice for order
@@ -67,14 +66,15 @@
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("order7")).invoice_ids
wf_service = netsvc.LocalService("workflow")
first_invoice_id = invoice_ids[0]
wf_service.trg_validate(uid, 'account.invoice', first_invoice_id, 'invoice_cancel', cr)
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: order7}:
!assert {model: sale.order, id: order7, 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.
@@ -84,9 +84,6 @@
-
I check state of order in 'In Progress'.
-
!assert {model: sale.order, id: order7}:
!assert {model: sale.order, id: order7, string: Sale order should be In progress state}:
- state == 'progress'