From 177d1c69207d2080d5dddf5edb85266f0bf74489 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sun, 4 Aug 2013 20:25:22 +0200 Subject: [PATCH] [IMP] First test pass for sale_stock bzr revid: fp@openerp.com-20130804182522-n2cjlt27cq0wazqt --- .../test/cancel_order_sale_stock.yml | 53 +++---------------- 1 file changed, 6 insertions(+), 47 deletions(-) diff --git a/addons/sale_stock/test/cancel_order_sale_stock.yml b/addons/sale_stock/test/cancel_order_sale_stock.yml index 5f9707cdc80..97f9ceafac2 100644 --- a/addons/sale_stock/test/cancel_order_sale_stock.yml +++ b/addons/sale_stock/test/cancel_order_sale_stock.yml @@ -7,16 +7,16 @@ I do a partial delivery order. - !python {model: stock.picking}: | - picks = self.search(cr, uid, [('origin','=','Test/001')]) + domain = [('origin','=','Test/001')] + picks = self.search(cr, uid, domain, context=context) pick = self.browse(cr, uid, picks[-1], context=context) - self.pool.get('stock.pack.operation').create(cr, uid, { 'picking_id': pick.id, 'product_id': ref('product.product_product_27'), 'product_uom_id': ref('product.product_uom_unit'), 'product_qty': 1 }) - pick.do_partial(values, context=context) + pick.do_partial(context=context) - I test that I have two pickings, one done and one backorder to do - @@ -27,54 +27,13 @@ assert len(picks)==1, 'You should have one delivery order which is done!' picks = self.search(cr, uid, [('origin','=','Test/001'), ('backorder_id','=',picks[0])]) assert len(picks)==1, 'You should have one backorder to process!' -- +- I cancel the backorder - !python {model: stock.picking}: | picks = self.search(cr, uid, [('origin','=','Test/001'),('backorder_id','<>',False)]) - self..action_cancel(cr, uid, picks) + self.action_cancel(cr, uid, picks) - - I run the scheduler. -- - !python {model: procurement.order}: | - self.run_scheduler(cr, uid) -- - I check that the order status in "Ship Exception". -- - !assert {model: sale.order, id: sale.sale_order_8, string: Sale order should be in shipping exception}: - - state == "shipping_except" -- - Now I regenerate shipment. -- - !workflow {model: sale.order, action: ship_recreate, ref: sale.sale_order_8} -- - I check state of order in 'To Invoice'. -- - !assert {model: sale.order, id: sale.sale_order_8, string: Sale order should be In Progress state}: - - state == 'manual' -- - I make invoice for order. + I invoice from order. - !workflow {model: sale.order, action: manual_invoice, ref: sale.sale_order_8} -- - To cancel the sale order from Invoice Exception, I have to cancel the invoice of sale order. -- - !python {model: sale.order}: | - invoice_ids = self.browse(cr, uid, ref("sale.sale_order_8")).invoice_ids - first_invoice_id = invoice_ids[0] - self.pool.get('account.invoice').signal_invoice_cancel(cr, uid, [first_invoice_id.id]) -- - I check order status in "Invoice Exception" and related invoice is in cancel state. -- - !assert {model: sale.order, id: sale.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.sale_order_8} - -- - I check state of order in 'In Progress'. -- - !assert {model: sale.order, id: sale.sale_order_8, string: Sale order should be In progress state}: - - state == 'progress'