From 73f522cbc4b2dae974c4e1dc9e3733df416634d0 Mon Sep 17 00:00:00 2001 From: "Rucha (Open ERP)" Date: Thu, 17 Nov 2011 14:59:17 +0530 Subject: [PATCH] [IMP]: mrp_operations: Improvements in test cases to test effect of cancelling production order on related work orders bzr revid: rpa@tinyerp.com-20111117092917-gt2w0og2glqa3bca --- .../test/mrp_operation_test.yml | 41 ++++++------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/addons/mrp_operations/test/mrp_operation_test.yml b/addons/mrp_operations/test/mrp_operation_test.yml index 9cb81abebde..c285877f2c3 100644 --- a/addons/mrp_operations/test/mrp_operation_test.yml +++ b/addons/mrp_operations/test/mrp_operation_test.yml @@ -1,16 +1,10 @@ - - In order to test mrp_operations module in OpenERP, - I create a production order. + Now I will check how cancelling production order will affect its work orders. - !record {model: mrp.production, id: mrp_production_mo1}: - company_id: base.main_company - date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") - location_dest_id: stock.stock_location_stock location_src_id: stock.stock_location_stock - name: MO/01234567 - product_id: product.product_product_pc1 + product_id: product.product_product_cpu_gen product_qty: 5.0 - product_uom: product.product_uom_unit product_uos_qty: 5.0 - Now I confirm the production order. @@ -24,31 +18,22 @@ order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo1')),('state','=','draft')]) assert order_id, _('No work order defined for this production order!') - - The scheduler runs. + In order to cancel the production order, I first cancel its picking. - - !function {model: procurement.order, name: run_scheduler}: - - model: procurement.order - search: "[('state','=','confirmed')]" + !function {model: stock.picking, name: action_cancel}: + - model: mrp.production + eval: "[obj(ref('mrp_production_mo1')).picking_id.id]" - - I am checking Internal picking. -- - !python {model: mrp.production}: | - from tools.translate import _ - pick_ids = self.browse(cr, uid, ref("mrp_production_mo1")) - assert pick_ids.picking_id.id, _('No Internal Picking generated!') -- - In order to cancel the MO, first cancel its picking -- - !python {model: stock.picking}: | - mrp_obj = self.pool.get('mrp.production') - mo = mrp_obj.browse(cr, uid, ref("mrp_production_mo1")) - self.action_cancel(cr, uid, [mo.picking_id.id], context=None) -- - Then cancel The Manufacturing order. + Now I cancel the production order. - !workflow {model: mrp.production, action: button_cancel, ref: mrp_production_mo1} - - I check that there is one Work order generated related to the production order that is cancelled or not. + Now I check that the production order is cancelled. +- + !assert {model: mrp.production, id: mrp_production_mo1}: + - state == 'cancel' +- + I check that the work order related to the production order that is cancelled or not. - !python {model: mrp.production.workcenter.line}: | from tools.translate import _