[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
This commit is contained in:
Rucha (Open ERP) 2011-11-17 14:59:17 +05:30
parent b93c997fed
commit 73f522cbc4
1 changed files with 13 additions and 28 deletions

View File

@ -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 _