- In order to test the module with OpenERP, I will make products with No auto-picking to allow an intermediate picking process to provide raw materials to production orders. - I create a record for product Tea. - !record {model: product.product, id: product_product_tea0}: categ_id: product.product_category_1 name: Tea procure_method: make_to_stock supply_method: buy type: product uom_id: product.product_uom_kgm uom_po_id: product.product_uom_kgm property_stock_inventory: stock.location_inventory property_stock_procurement: stock.location_procurement property_stock_production: stock.location_production auto_pick: True - I create a record for product Sugar. - !record {model: product.product, id: product_product_sugar0}: categ_id: product.product_category_1 name: Sugar procure_method: make_to_stock supply_method: buy type: product uom_id: product.product_uom_kgm uom_po_id: product.product_uom_kgm property_stock_inventory: stock.location_inventory property_stock_procurement: stock.location_procurement property_stock_production: stock.location_production auto_pick: True - I create a record for product Milk. - !record {model: product.product, id: product_product_milk0}: categ_id: product.product_category_1 name: Milk procure_method: make_to_order supply_method: buy type: consu uom_id: product.product_uom_litre uom_po_id: product.product_uom_litre property_stock_inventory: stock.location_inventory property_stock_procurement: stock.location_procurement property_stock_production: stock.location_production auto_pick: True - I create a record for product Cup of tea. - !record {model: product.product, id: product_product_cupoftea0}: categ_id: product.product_category_1 name: Cup of Tea procure_method: make_to_order supply_method: produce type: product uom_id: product.product_uom_litre uom_po_id: product.product_uom_litre property_stock_inventory: stock.location_inventory property_stock_procurement: stock.location_procurement property_stock_production: stock.location_production auto_pick: False - I create a record for Workcenter. - !record {model: mrp.workcenter, id: mrp_workcenter_production0}: costs_cycle: 0.0 costs_hour: 0.0 name: Production Workcenter resource_type: material time_cycle: 0.0 time_efficiency: 1.0 time_start: 0.0 time_stop: 0.0 - I create a routing. - !record {model: mrp.routing, id: mrp_routing_productionrouting0}: name: Production Routing location_id: stock.stock_location_stock workcenter_lines: - cycle_nbr: 1.0 hour_nbr: 0.5 sequence: 0.0 name: Production workcenter_id: mrp_workcenter_production0 - I create a Bill of material for the product Cup of tea. - !record {model: mrp.bom, id: mrp_bom_cupoftea0}: company_id: base.main_company name: Cup of Tea product_efficiency: 1.0 product_id: product_product_cupoftea0 product_qty: 1.0 product_uom: product.product_uom_litre type: normal routing_id: mrp_routing_productionrouting0 bom_lines: - company_id: base.main_company name: Tea product_efficiency: 1.0 product_id: product_product_tea0 product_qty: 200.0 product_uom: product.product_uom_gram type: normal - company_id: base.main_company name: Sugar product_efficiency: 1.0 product_id: product_product_sugar0 product_qty: 200.0 product_uom: product.product_uom_gram type: normal - company_id: base.main_company name: Water product_efficiency: 1.0 product_id: product_product_milk0 product_qty: 0.5 product_uom: product.product_uom_litre type: normal - I make the production order for the product Cup of Tea. - !record {model: mrp.production, id: mrp_production_mo0}: product_id: product_product_cupoftea0 product_qty: 5.0 product_uom: product.product_uom_litre product_uos_qty: 0.0 bom_id: mrp_bom_cupoftea0 routing_id: mrp_routing_productionrouting0 date_planned: !eval time.strftime('%Y-%m-%d %H:%M:%S') location_dest_id: stock.stock_location_stock location_src_id: stock.stock_location_stock - I compute the data of production order. - !python {model: mrp.production}: | self.action_compute(cr, uid, [ref("mrp_production_mo0")], {"lang": "en_US", "tz": False, "search_default_Current": 1, "active_model": "ir.ui.menu", "active_ids": [ref("mrp.menu_mrp_production_action")], "active_id": ref("mrp.menu_mrp_production_action"), }) - I confirm the production order. - !workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo0} - I check that all three stock moves have the destination location which is set in routing instead of the default one. - !python {model: mrp.production}: | production = self.browse(cr, uid, [ref("mrp_production_mo0")]) route_location_id = production[0].routing_id.location_id.id for move in production[0].move_lines: assert (move.location_id.id == route_location_id),'Wrong Move !'