diff --git a/addons/sale_mrp/test/cancellation_propagated.yml b/addons/sale_mrp/test/cancellation_propagated.yml index 62fd56773bb..770601bac6d 100644 --- a/addons/sale_mrp/test/cancellation_propagated.yml +++ b/addons/sale_mrp/test/cancellation_propagated.yml @@ -1,5 +1,5 @@ - - I first create a warehouse with pick-pack-ship and reception in 2 step + I first create a warehouse with pick-pack-ship and reception in 2 steps - !record {model: stock.warehouse, id: wh_pps}: name: WareHouse PickPackShip @@ -16,11 +16,11 @@ uom_id: product.product_uom_unit uom_po_id: product.product_uom_unit - - I create a bom (service and product) for this product + I create a bom for this product - !record {model: mrp.bom, id: mrp_bom_test1}: company_id: base.main_company - name: BOM In test + name: My BOM product_id: product_manu product_qty: 1.0 type: normal @@ -30,14 +30,14 @@ product_id: product.product_product_44 product_qty: 1.0 - - Set routes on product to be MTO + And set routes on product to be MTO and manufacture - !python {model: product.product}: | route_warehouse0_manufacture = self.pool.get('stock.warehouse').browse(cr, uid, ref('stock.warehouse0')).manufacture_pull_id.route_id.id route_warehouse0_mto = self.pool.get('stock.warehouse').browse(cr, uid, ref('stock.warehouse0')).mto_pull_id.route_id.id self.write(cr, uid, ref('product_manu'), { 'route_ids': [(6, 0, [route_warehouse0_mto,route_warehouse0_manufacture])]}, context=context) - - Create a sales order with route_id manufacture. + I create a sales order - !record {model: sale.order, id: sale_order_product_manu}: partner_id: base.res_partner_3 @@ -46,12 +46,7 @@ order_line: - product_id: product_manu product_uom_qty: 5.00 -- - !python {model: sale.order.line}: | - route_warehouse0_buy = self.pool.get('stock.warehouse').browse(cr, uid, ref('stock.warehouse0')).manufacture_pull_id.route_id.id - order = self.pool.get('sale.order').browse(cr, uid, ref('sale_order_product_manu')) - line_ids = [x.id for x in order.order_line] - self.write(cr, uid, line_ids, {'route_id': route_warehouse0_buy}) + - Confirm sales order - @@ -59,34 +54,34 @@ - Check the propagation when we cancel the main procurement * Retrieve related procurements and check that there are all running - * Check that Purchase order is well created + * Check that the purchase order has been well created * Cancel the main procurement - * Check that all procurements related and the purchase order are well cancelled + * Check that all procurements related and the purchase order has been well cancelled - !python {model: procurement.order}: | # Retrieve related procu so = self.pool.get('sale.order').browse(cr, uid, ref('sale_order_product_manu')) procu_ids = self.search(cr, uid, [('group_id.name', '=', so.name)]) - assert len(procu_ids)>0, 'None procu found for so %s (%d)' %(so.name, so.id) + assert len(procu_ids)>0, 'No procurements are found for sale order "%s" (with id : %d)' %(so.name, so.id) - # Check that all procurement are running + # Check that all procurements are running for procu in self.browse(cr, uid, procu_ids, context=context): - assert procu.state == u'running', 'Procu %d should be running and is in state : %s!' %(procu.id, procu.state) + assert procu.state == u'running', 'Procurement with id %d should be "running" but is with a state : %s!' %(procu.id, procu.state) - # Check that one or more Production Order + # Check that one production order exist prodor_ids = [proc.production_id for proc in self.browse(cr, uid, procu_ids) if proc.production_id] - assert len(prodor_ids) > 0, 'No production Order found !' + assert len(prodor_ids) > 0, 'No production order found !' # Cancel the main procurement main_procu_id = self.search(cr, uid, [('origin', '=', so.name)]) assert len(main_procu_id) == 1, 'Main procurement not identified !' self.cancel(cr, uid, main_procu_id,context=context) - assert self.browse(cr, uid, main_procu_id[0]).state == u'cancel', 'Main procurement is not cancelled !!!' + assert self.browse(cr, uid, main_procu_id[0]).state == u'cancel', 'Main procurement should be cancelled !' - # Check that all procurements related is cancelled + # Check that all procurements related are cancelled for procu in self.browse(cr, uid, procu_ids, context=context): - assert procu.state == u'cancel', 'Procu %d should be cancelled and is in state : %s!' %(procu.id, procu.state) + assert procu.state == u'cancel', 'Procurement with id %d should be with the state "cancel" but is with a state : %s!' %(procu.id, procu.state) # Check that the production order is cancelled for prodor in self.pool.get('mrp.production').browse(cr, uid, [prodor.id for prodor in prodor_ids], context=context): - assert prodor.state == u'cancel', 'Production Order %d should be cancelled and is in state : %s!' %(prodor.id, prodor.state) + assert prodor.state == u'cancel', 'Production order %d should be cancelled but is in state : %s!' %(prodor.id, prodor.state) diff --git a/addons/sale_mrp/test/sale_mrp.yml b/addons/sale_mrp/test/sale_mrp.yml index b1e1e5c8750..58a93e1b0a6 100644 --- a/addons/sale_mrp/test/sale_mrp.yml +++ b/addons/sale_mrp/test/sale_mrp.yml @@ -1,5 +1,5 @@ - - In order to test the sale_mrp module in OpenERP,I start by creating a new product 'Slider Mobile' + In order to test the sale_mrp module in OpenERP, I start by creating a new product 'Slider Mobile' - I define product category Mobile Products Sellable. - @@ -109,8 +109,7 @@ proc_ids = self.search(cr, uid, [('origin','like',so.name), ('state','=','running')]) # Check that all procurement are running for procu in self.browse(cr,uid,proc_ids,context=context): - print procu.name - assert procu.state == u'running', 'Procu %d should be running and is in state : %s!' %(procu.id,procu.state) + assert procu.state == u'running', 'Procurement with id %d should be with a state "running" but is with a state : %s!' %(procu.id,procu.state) - I verify that a manufacturing order has been generated, and that its name and reference are correct - diff --git a/addons/stock_complex_routes/test/cancellation_propagated.yml b/addons/stock_complex_routes/test/cancellation_propagated.yml index a1cf72043e2..cb68b582a6a 100644 --- a/addons/stock_complex_routes/test/cancellation_propagated.yml +++ b/addons/stock_complex_routes/test/cancellation_propagated.yml @@ -1,5 +1,5 @@ - - I first create a warehouse with pick-pack-ship and reception in 2 step + I first create a warehouse with pick-pack-ship and reception in 2 steps - !record {model: stock.warehouse, id: wh_pps}: name: WareHouse PickPackShip @@ -10,7 +10,7 @@ Next I create a new product in this warehouse - !record {model: product.product, id: product_mto}: - name: "My MTO Product" + name: "My Product" type: product uom_id: product.product_uom_unit uom_po_id: product.product_uom_unit @@ -20,14 +20,14 @@ min_qty: 2.0 qty: 10.0 - - Set routes on product to be MTO + Set routes on product to be MTO adn Buy - !python {model: product.product}: | route_warehouse0_buy = self.pool.get('stock.warehouse').browse(cr, uid, ref('stock.warehouse0')).buy_pull_id.route_id.id route_warehouse0_mto = self.pool.get('stock.warehouse').browse(cr, uid, ref('stock.warehouse0')).mto_pull_id.route_id.id self.write(cr, uid, ref('product_mto'), { 'route_ids': [(6, 0, [route_warehouse0_mto,route_warehouse0_buy])]}, context=context ) - - Create a sales order with a line of 5 "My MTO Product", with route_id Buy. + Create a sales order with a line of 5 "My Product". - !record {model: sale.order, id: sale_order_product_mto}: partner_id: base.res_partner_3 @@ -36,47 +36,41 @@ order_line: - product_id: product_mto product_uom_qty: 5.00 -- - !python {model: sale.order.line}: | - route_warehouse0_buy = self.pool.get('stock.warehouse').browse(cr, uid, ref('stock.warehouse0')).buy_pull_id.route_id.id - order = self.pool.get('sale.order').browse(cr, uid, ref('sale_order_product_mto')) - line_ids = [x.id for x in order.order_line] - self.write(cr, uid, line_ids, {'route_id': route_warehouse0_buy}) - - Confirm sales order + Confirm the sale order - !workflow {model: sale.order, action: order_confirm, ref: sale_order_product_mto} - Check the propagation when we cancel the main procurement * Retrieve related procurements and check that there are all running - * Check that Purchase order is well created + * Check that a purchase order is well created * Cancel the main procurement * Check that all procurements related and the purchase order are well cancelled - !python {model: procurement.order}: | - # Retrieve related procu + # Retrieve related procurement so = self.pool.get('sale.order').browse(cr, uid, ref('sale_order_product_mto')) procu_ids = self.search(cr, uid, [('group_id.name', '=', so.name)]) - assert len(procu_ids)>0, 'None procu found for so %s (%d)' %(so.name,so.id) + assert len(procu_ids)>0, 'No procurement found for sale order %s (with id: %d)' %(so.name,so.id) - # Check that all procurement are running + # Check that all procurements are running for procu in self.browse(cr,uid,procu_ids,context=context): - assert procu.state == u'running', 'Procu %d should be running and is in state : %s!' %(procu.id, procu.state) + assert procu.state == u'running', 'Procurement with id: %d should be running but is with state : %s!' %(procu.id, procu.state) - # Check that one or more PO + # Check that one or more Purchase order purchase_ids = [proc.purchase_line_id.order_id for proc in self.browse(cr, uid, procu_ids) if proc.purchase_line_id] - assert len(purchase_ids) > 0, 'No purchase order find !' + assert len(purchase_ids) > 0, 'No purchase order found !' # Cancel the main procurement main_procu_id = self.search(cr, uid, [('origin', '=', so.name)]) assert len(main_procu_id) == 1, 'Main procurement not identified !' self.cancel(cr, uid, main_procu_id, context=context) - assert self.browse(cr, uid, main_procu_id[0]).state == u'cancel', 'Main procurement is not cancelled !!!' + assert self.browse(cr, uid, main_procu_id[0]).state == u'cancel', 'Main procurement should be cancelled !' - # Check that all procurements related is cancelled + # Check that all procurements related are cancelled for procu in self.browse(cr, uid, procu_ids, context=context): - assert procu.state == u'cancel', 'Procu %d should be cancelled and is in state : %s!' %(procu.id, procu.state) + assert procu.state == u'cancel', 'Procurement %d should be cancelled but is with a state : %s!' %(procu.id, procu.state) - # Check that the purchase order is cancelled + # Check that the purchase order is well cancelled for po in self.pool.get('purchase.order').browse(cr, uid, [po.id for po in purchase_ids], context=context): - assert po.state == u'cancel', 'Purchase %d should be cancelled and is in state : %s!' %(po.id, po.state) + assert po.state == u'cancel', 'Purchase order %d should be cancelled but is in state : %s!' %(po.id, po.state)