diff --git a/addons/mrp/__openerp__.py b/addons/mrp/__openerp__.py index 43e0eb3af8d..0fa66ac7bd1 100644 --- a/addons/mrp/__openerp__.py +++ b/addons/mrp/__openerp__.py @@ -77,7 +77,7 @@ 'report/mrp_production_order_view.xml', ], 'demo_xml': ['mrp_demo.xml', 'mrp_order_point.xml'], -# 'test': ['test/mrp_phantom_bom.yml'], +# 'test': ['test/mrp_phantom_bom.yml','test/mrp_production_order.yml'], 'installable': True, 'active': False, 'certificate': '0032052481373', diff --git a/addons/mrp/test/mrp_phantom_bom.yml b/addons/mrp/test/mrp_phantom_bom.yml index f841739e366..df4ade1cb6e 100644 --- a/addons/mrp/test/mrp_phantom_bom.yml +++ b/addons/mrp/test/mrp_phantom_bom.yml @@ -222,7 +222,13 @@ - I receive both the products. My incoming pickings are done. - - !function {model: stock.move.split, name: split_lot}: - - model: stock.picking - search: "[('origin','in',['PO00001:SCHEDULER','PO00002:SCHEDULER','PO00003:OP/00002','PO00004:OP/00003']),('type','=','in')]" - \ No newline at end of file + !record {model: stock.partial.picking, id: stock_partial_picking0}: + date: '2010-04-30 16:53:36' + partner_id: base.res_partner_asus + address_id: base.res_partner_address_tang +- + !python {model: stock.partial.picking}: | + pick_obj = self.pool.get('stock.picking') + picking_ids = pick_obj.search(cr, uid, [('origin','in',['PO00001:SCHEDULER','PO00002:SCHEDULER','PO00003:OP/00002','PO00004:OP/00003']),('type','=','in')]) + self.do_partial(cr, uid, [1],context={'active_ids': picking_ids}) + \ No newline at end of file diff --git a/addons/mrp/test/mrp_production_order.yml b/addons/mrp/test/mrp_production_order.yml new file mode 100644 index 00000000000..023a9f22f31 --- /dev/null +++ b/addons/mrp/test/mrp_production_order.yml @@ -0,0 +1,139 @@ +- + In order to test the manufacturing order working with procurements I will use + some products with different supply method and procurement method, also check + the bills of material for the products. +- + I am creating one manufacturing order. +- + !record {model: mrp.production, id: mrp_production_mo0}: + bom_id: mrp.mrp_bom_9 + routing_id: mrp.mrp_routing_0 + company_id: base.main_company + date_planned: '2010-05-06 14:55:52' + location_dest_id: stock.stock_location_stock + location_src_id: stock.stock_location_stock + name: MO/00004 + product_id: product.product_product_pc1 + product_qty: 5.0 + product_uom: product.product_uom_unit + product_uos_qty: 0.0 +- + Creating a mrp.production.workcenter.line record +- + !record {model: mrp.production.workcenter.line, id: mrp_production_workcenter_line_assemblyline0}: + cycle: 5.0 + hour: 10.0 + name: Assembly Line 1 + production_id: mrp_production_mo0 + sequence: 0.0 + workcenter_id: mrp.mrp_workcenter_0 +- + Creating a mrp.production.product.line record +- + !record {model: mrp.production.product.line, id: mrp_production_product_line_regularprocessorconfig0}: + name: Regular processor config + product_id: product.product_product_cpu_gen + product_qty: 5.0 + product_uom: product.product_uom_unit + product_uos_qty: 0.0 + production_id: mrp_production_mo0 +- + Creating a mrp.production.product.line record +- + !record {model: mrp.production.product.line, id: mrp_production_product_line_hddseagategb0}: + name: HDD Seagate 7200.8 80GB + product_id: product.product_product_hdd1 + product_qty: 5.0 + product_uom: product.product_uom_unit + product_uos_qty: 0.0 + production_id: mrp_production_mo0 +- + Creating a mrp.production.product.line record +- + !record {model: mrp.production.product.line, id: mrp_production_product_line_atxmidsizetower0}: + name: ATX Mid-size Tower + product_id: product.product_product_tow1 + product_qty: 5.0 + product_uom: product.product_uom_unit + product_uos_qty: 0.0 + production_id: mrp_production_mo0 +- + Creating a mrp.production.product.line record +- + !record {model: mrp.production.product.line, id: mrp_production_product_line_mouse0}: + name: Mouse + product_id: product.product_product_25 + product_qty: 5.0 + product_uom: product.product_uom_unit + product_uos_qty: 0.0 + production_id: mrp_production_mo0 +- + Creating a mrp.production.product.line record +- + !record {model: mrp.production.product.line, id: mrp_production_product_line_keyboard0}: + name: Keyboard + product_id: product.product_product_24 + product_qty: 5.0 + product_uom: product.product_uom_unit + product_uos_qty: 0.0 + production_id: mrp_production_mo0 +- + I confirm the order. +- + !workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo0} +- + I am checking Procurement orders. +- + !python {model: mrp.procurement}: | + from tools.translate import _ + proc_ids = self.search(cr, uid, [('origin','=',':MO/00004')]) + assert proc_ids, _('No Procurements!') +- + The scheduler runs. +- + !function {model: mrp.procurement, name: run_scheduler}: + - model: mrp.procurement + search: "[('origin','=',':MO/00004')]" +- + I am checking Internal picking. +- + !python {model: stock.picking}: | + from tools.translate import _ + pick_ids = self.search(cr, uid, [('origin','=',':MO/00004'),('type','=','internal')]) + assert pick_ids, _('No Internal Pickings!') +- + I see that there is a manufacturing order for the subproduct of PC1 with ready state. +- + !python {model: mrp.production}: | + from tools.translate import _ + order_ids = self.search(cr, uid, [('origin','=',':MO/00004'),('state','=','ready')]) + assert order_ids, _('No manufacturing order!') +- + I start producing that product first. So I marked it as started. +- + !record {model: mrp.product.produce, id: mrp_product_produce0}: + product_qty: 5.00 + mode: 'consume_produce' +- + !python {model: mrp.product.produce}: | + prod_obj = self.pool.get('mrp.production') + prod_ids = prod_obj.search(cr, uid, [('origin','=',':MO/00004')]) + self.do_produce(cr, uid, [1], context={'active_ids': prod_ids}) +- + Now the manufacturing order for subproduct CPU_GEN is done. And manufacturing + order for PC1 is in ready state. +- + !python {model: mrp.production}: | + from tools.translate import _ + prod_ids = self.search(cr, uid, [('origin','=',':MO/00004'),('state','=','done')]) + assert prod_ids, _('Manufacturing order is yet not done!') +- + I start producing the product PC1. +- + !workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo0} +- + !python {model: mrp.product.produce}: | + from tools.translate import _ + prod_obj = self.pool.get('mrp.production') + prod_ids = prod_obj.search(cr, uid, [('product_id.default_code','=','PC1')]) + self.do_produce(cr, uid, [1], context={'active_ids': prod_ids})