From ca09a748500a3f6fe8d063ceba4494b05280bf28 Mon Sep 17 00:00:00 2001 From: "Bharat Devnani (OpenERP)" Date: Wed, 18 Jul 2012 18:11:19 +0530 Subject: [PATCH 1/3] [IMP] improved yml files of MRP related modules according to new demo data bzr revid: bde@tinyerp.com-20120718124119-tei82fkulqrqhxwv --- addons/mrp_operations/__openerp__.py | 2 +- .../test/workcenter_operations.yml | 26 +++++++++---------- addons/mrp_subproduct/__openerp__.py | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/addons/mrp_operations/__openerp__.py b/addons/mrp_operations/__openerp__.py index 621e7213585..1361f2ec3f3 100644 --- a/addons/mrp_operations/__openerp__.py +++ b/addons/mrp_operations/__openerp__.py @@ -67,7 +67,7 @@ So that we can compare the theoretic delay and real delay. 'demo_xml': ['mrp_operation_data.xml', 'mrp_operations_demo.yml'], 'test': [ -# 'test/workcenter_operations.yml', + 'test/workcenter_operations.yml', ], 'installable': True, 'auto_install': False, diff --git a/addons/mrp_operations/test/workcenter_operations.yml b/addons/mrp_operations/test/workcenter_operations.yml index 23fbe15c37d..f24c1fbd5c7 100644 --- a/addons/mrp_operations/test/workcenter_operations.yml +++ b/addons/mrp_operations/test/workcenter_operations.yml @@ -2,13 +2,13 @@ I compute the production order. - !python {model: mrp.production}: | - order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context) + order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context) order.action_compute(context=context) - I check planned date in workcenter lines of production order. - !python {model: mrp.production}: | - order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context) + order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context) for line in order.workcenter_lines: #TODO: to check start date of next line should be end of date of previous line. assert line.date_planned, "Planned Start date is not computed: %s" %(line) @@ -17,7 +17,7 @@ - I confirm the Production Order. - - !workflow {model: mrp.production, action: button_confirm, ref: mrp.mrp_production_shelf100cm} + !workflow {model: mrp.production, action: button_confirm, ref: mrp.mrp_production_1} - I run scheduler. - @@ -27,17 +27,17 @@ I forcefully close internal shipment. - !python {model: mrp.production}: | - self.force_production(cr, uid, [ref("mrp.mrp_production_shelf100cm")]) + self.force_production(cr, uid, [ref("mrp.mrp_production_1")]) - I start production. - - !workflow {model: mrp.production, action: button_produce, ref: mrp.mrp_production_shelf100cm} + !workflow {model: mrp.production, action: button_produce, ref: mrp.mrp_production_1} - Production start on first work center, so I start work operation on first work center. - !python {model: mrp.production}: | import netsvc - order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context) + order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context) wf_service = netsvc.LocalService("workflow") wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_start_working', cr) - @@ -45,7 +45,7 @@ - !python {model: mrp.production}: | import netsvc - order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context) + order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context) wf_service = netsvc.LocalService("workflow") wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_pause', cr) wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_resume', cr) @@ -54,7 +54,7 @@ - !python {model: mrp.production}: | import netsvc - order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context) + order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context) wf_service = netsvc.LocalService("workflow") wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_resume', cr) @@ -63,7 +63,7 @@ - !python {model: mrp.production}: | import netsvc - order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context) + order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context) wf_service = netsvc.LocalService("workflow") wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_cancel', cr) - @@ -71,7 +71,7 @@ - !python {model: mrp.production}: | import netsvc - order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context) + order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context) wf_service = netsvc.LocalService("workflow") wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_draft', cr) wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_start_working', cr) @@ -80,7 +80,7 @@ - !python {model: mrp.production}: | import netsvc - order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context) + order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context) wf_service = netsvc.LocalService("workflow") wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_done', cr) - @@ -88,7 +88,7 @@ - !python {model: mrp.production}: | import netsvc - order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context) + order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context) wf_service = netsvc.LocalService("workflow") for work_line in order.workcenter_lines[1:]: wf_service.trg_validate(uid, 'mrp.production.workcenter.line', work_line.id, 'button_start_working', cr) @@ -98,7 +98,7 @@ I check that the production order is now done. - !python {model: mrp.production}: | - order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context) + order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context) print order.state assert order.state == 'done', "Production should be closed after finished all operations." - diff --git a/addons/mrp_subproduct/__openerp__.py b/addons/mrp_subproduct/__openerp__.py index 3609ffbcafe..793d0f104e0 100644 --- a/addons/mrp_subproduct/__openerp__.py +++ b/addons/mrp_subproduct/__openerp__.py @@ -47,7 +47,7 @@ With this module: ], 'demo_xml': [], 'test': [ - #'test/mrp_subproduct.yml' + 'test/mrp_subproduct.yml' ], 'installable': True, 'auto_install': False, From 0354b79204d713706cdcdf8184c53ca6d630e163 Mon Sep 17 00:00:00 2001 From: "Bharat Devnani (OpenERP)" Date: Fri, 20 Jul 2012 17:30:29 +0530 Subject: [PATCH 2/3] [IMP] improved mrp_subproduct.yml bzr revid: bde@tinyerp.com-20120720120029-o4y53q3b09fhldyo --- addons/mrp_subproduct/test/mrp_subproduct.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/addons/mrp_subproduct/test/mrp_subproduct.yml b/addons/mrp_subproduct/test/mrp_subproduct.yml index 9e7c6c371a5..36b5f442362 100644 --- a/addons/mrp_subproduct/test/mrp_subproduct.yml +++ b/addons/mrp_subproduct/test/mrp_subproduct.yml @@ -2,11 +2,11 @@ In order to test mrp_subproduct with OpenERP, I add subproduct in bill of material. I make a production order, confirm it so stock moves for subproducts are generated. - - I add a sub product in Bill of material for product Cabinet. + I add a sub product in Bill of material for product External Hard Disk. - !record {model: mrp.bom, id: mrp_bom_arm1}: product_id: product.product_product_28 - name: ARM100 + Subproduct + name: External Hard Disk + Subproduct product_uom: product.product_uom_unit sub_products: - product_id: product.product_product_33 @@ -14,7 +14,7 @@ product_qty: 2.0 subproduct_type: fixed - - I create a production order for Cabinet. + I create a production order for External Hard Disk. - !record {model: mrp.production, id: mrp_production_mo0}: product_id: product.product_product_28 @@ -67,9 +67,10 @@ !python {model: mrp.product.produce}: | self.do_produce(cr, uid, [ref("mrp_product_produce0")], {"active_model": "mrp.production", "active_ids":[ref("mrp_production_mo0")], "active_id": ref("mrp_production_mo0")}) - - I see that stock moves of Cabinet including Wooden Table are done now. + I see that stock moves of External Hard Disk including Headset USB are done now. - !python {model: stock.move}: | - move_ids = self.search(cr, uid, [('product_id','in',[ref("product.product_product_28"),ref("product.product_product_41")])]) + production_order = self.pool.get('mrp.production').browse(cr, uid, ref("mrp_production_mo0")) + move_ids = self.search(cr, uid, [('origin','=',production_order.name), ('product_id','in',[ref("product.product_product_28"),ref("product.product_product_33")])]) moves = self.browse(cr, uid, move_ids) assert all(move.state == 'done' for move in moves), 'Moves are not done!' From df884c33265e88c4151e3452de7153c6e517ead1 Mon Sep 17 00:00:00 2001 From: "Bharat Devnani (OpenERP)" Date: Tue, 24 Jul 2012 18:32:51 +0530 Subject: [PATCH 3/3] [IMP] improved the yml of mrp_subproduct bzr revid: bde@tinyerp.com-20120724130251-vuyee33s7yy26pll --- addons/mrp_subproduct/test/mrp_subproduct.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/addons/mrp_subproduct/test/mrp_subproduct.yml b/addons/mrp_subproduct/test/mrp_subproduct.yml index 36b5f442362..99da9f22baf 100644 --- a/addons/mrp_subproduct/test/mrp_subproduct.yml +++ b/addons/mrp_subproduct/test/mrp_subproduct.yml @@ -4,7 +4,7 @@ - I add a sub product in Bill of material for product External Hard Disk. - - !record {model: mrp.bom, id: mrp_bom_arm1}: + !record {model: mrp.bom, id: mrp.mrp_bom_24}: product_id: product.product_product_28 name: External Hard Disk + Subproduct product_uom: product.product_uom_unit @@ -18,9 +18,9 @@ - !record {model: mrp.production, id: mrp_production_mo0}: product_id: product.product_product_28 - product_qty: 10.0 + product_qty: 2.0 product_uom: product.product_uom_unit - bom_id: mrp_bom_arm1 + bom_id: mrp.mrp_bom_24 location_src_id: stock.stock_location_stock - I compute the data of production order. @@ -30,8 +30,7 @@ - I confirm the production order. - - !python {model: mrp.production}: | - self.action_confirm(cr, uid, [ref('mrp_production_mo0')]) + !workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo0} - I check production order state. - @@ -59,7 +58,7 @@ I create record for selecting mode and quantity of products to produce. - !record {model: mrp.product.produce, id: mrp_product_produce0}: - product_qty: 10.00 + product_qty: 2.00 mode: 'consume_produce' - I finish the production order.