2 In order to test the module with OpenERP, I will make products with No auto-picking
3 to allow an intermediate picking process to provide raw materials to production orders.
5 I create a record for product Tea.
7 !record {model: product.product, id: product_product_tea0}:
8 categ_id: product.product_category_1
10 procure_method: make_to_stock
13 uom_id: product.product_uom_kgm
14 uom_po_id: product.product_uom_kgm
15 property_stock_inventory: stock.location_inventory
16 property_stock_procurement: stock.location_procurement
17 property_stock_production: stock.location_production
20 I create a record for product Sugar.
22 !record {model: product.product, id: product_product_sugar0}:
23 categ_id: product.product_category_1
25 procure_method: make_to_stock
28 uom_id: product.product_uom_kgm
29 uom_po_id: product.product_uom_kgm
30 property_stock_inventory: stock.location_inventory
31 property_stock_procurement: stock.location_procurement
32 property_stock_production: stock.location_production
35 I create a record for product Milk.
37 !record {model: product.product, id: product_product_milk0}:
38 categ_id: product.product_category_1
40 procure_method: make_to_order
43 uom_id: product.product_uom_litre
44 uom_po_id: product.product_uom_litre
45 property_stock_inventory: stock.location_inventory
46 property_stock_procurement: stock.location_procurement
47 property_stock_production: stock.location_production
50 I create a record for product Cup of tea.
52 !record {model: product.product, id: product_product_cupoftea0}:
53 categ_id: product.product_category_1
55 procure_method: make_to_order
56 supply_method: produce
58 uom_id: product.product_uom_litre
59 uom_po_id: product.product_uom_litre
60 property_stock_inventory: stock.location_inventory
61 property_stock_procurement: stock.location_procurement
62 property_stock_production: stock.location_production
65 I create a record for Workcenter.
67 !record {model: mrp.workcenter, id: mrp_workcenter_production0}:
70 name: Production Workcenter
71 resource_type: material
79 !record {model: mrp.routing, id: mrp_routing_productionrouting0}:
80 name: Production Routing
81 location_id: stock.stock_location_stock
87 workcenter_id: mrp_workcenter_production0
89 I create a Bill of material for the product Cup of tea.
91 !record {model: mrp.bom, id: mrp_bom_cupoftea0}:
92 company_id: base.main_company
94 product_efficiency: 1.0
95 product_id: product_product_cupoftea0
97 product_uom: product.product_uom_litre
99 routing_id: mrp_routing_productionrouting0
101 - company_id: base.main_company
103 product_efficiency: 1.0
104 product_id: product_product_tea0
106 product_uom: product.product_uom_gram
108 - company_id: base.main_company
110 product_efficiency: 1.0
111 product_id: product_product_sugar0
113 product_uom: product.product_uom_gram
115 - company_id: base.main_company
117 product_efficiency: 1.0
118 product_id: product_product_milk0
120 product_uom: product.product_uom_litre
123 I make the production order for the product Cup of Tea.
125 !record {model: mrp.production, id: mrp_production_mo0}:
126 product_id: product_product_cupoftea0
128 product_uom: product.product_uom_litre
130 bom_id: mrp_bom_cupoftea0
131 routing_id: mrp_routing_productionrouting0
132 date_planned: !eval time.strftime('%Y-%m-%d %H:%M:%S')
133 location_dest_id: stock.stock_location_stock
134 location_src_id: stock.stock_location_stock
136 I compute the data of production order.
138 !python {model: mrp.production}: |
139 self.action_compute(cr, uid, [ref("mrp_production_mo0")], {"lang": "en_US", "tz": False, "search_default_Current":
140 1, "active_model": "ir.ui.menu", "active_ids": [ref("mrp.menu_mrp_production_action")],
141 "active_id": ref("mrp.menu_mrp_production_action"), })
143 I confirm the production order.
145 !workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo0}
147 I check that all three stock moves have the destination location which is set in routing instead of the default one.
149 !python {model: mrp.production}: |
150 production = self.browse(cr, uid, [ref("mrp_production_mo0")])
151 route_location_id = production[0].routing_id.location_id.id
152 for move in production[0].move_lines:
153 assert (move.location_id.id == route_location_id),'Wrong Move !'