From 45b4dab1e6b698d1ff43595762f2ff49dffc98ea Mon Sep 17 00:00:00 2001 From: "Rucha (Open ERP)" Date: Fri, 14 Oct 2011 16:22:59 +0530 Subject: [PATCH] [REM]: mrp: Removed some yml files which were having lots of code to create record rather than to test the real flow bzr revid: rpa@tinyerp.com-20111014105259-87ggqqoj3mmm0glp --- addons/mrp/test/mrp_phantom_bom.yml | 280 ---------------------------- addons/mrp/test/mrp_procurement.yml | 278 --------------------------- 2 files changed, 558 deletions(-) delete mode 100644 addons/mrp/test/mrp_phantom_bom.yml delete mode 100644 addons/mrp/test/mrp_procurement.yml diff --git a/addons/mrp/test/mrp_phantom_bom.yml b/addons/mrp/test/mrp_phantom_bom.yml deleted file mode 100644 index 5316102689c..00000000000 --- a/addons/mrp/test/mrp_phantom_bom.yml +++ /dev/null @@ -1,280 +0,0 @@ -- - I think this file is not needed as its wasting lots of useless code in creating product, phantom bom and MOs, - the way is not right to check functionality of phantom bom, its better used in mrp_packs.yml file. - also we can use product SHE100KIT BOM of demo instead of creating all new datas. - -- - In order to test the mrp phantom bom type in OpenERP, I will create products - and then I will create Phantom bom structure for those products. -- - I create BOM category fluid for Orange Juice -- - !record {model: product.uom.categ, id: product_uom_categ_fluid}: - name: Fluid -- - I create the products required to produce some orange juices with Oranges, Sugar and Water. -- - !record {model: product.uom, id: product_uom_litre0}: - category_id: product_uom_categ_fluid - factor: 1.0 - name: Litre - rounding: 0.01 -- - I create record for product Orange Juice. -- - !record {model: product.product, id: product_product_orangejuice0}: - categ_id: product.cat1 - name: Orange Juice - procure_method: make_to_order - supply_method: produce - type: product - uom_id: product_uom_litre0 - uom_po_id: product_uom_litre0 - property_stock_inventory: stock.location_inventory - property_stock_procurement: stock.location_procurement - property_stock_production: stock.location_production -- - I create record for product Orange. -- - !record {model: product.product, id: product_product_orange0}: - categ_id: product.cat1 - name: Orange - procure_method: make_to_stock - seller_ids: - - delay: 1 - name: base.res_partner_asus - min_qty: 1.0 - product_uom: product.product_uom_kgm - 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 -- - I create record for product Sugar. -- - !record {model: product.product, id: product_product_sugar0}: - categ_id: product.cat1 - name: Sugar - procure_method: make_to_stock - seller_ids: - - delay: 1 - name: base.res_partner_desertic_hispafuentes - min_qty: 2.0 - product_uom: product.product_uom_kgm - 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 -- - I create record for product Water. -- - !record {model: product.product, id: product_product_water0}: - categ_id: product.cat1 - name: Water - procure_method: make_to_order - seller_ids: - - delay: 1 - name: base.res_partner_agrolait - product_uom: product_uom_litre0 - min_qty: 2.0 - supply_method: buy - type: consu - uom_id: product_uom_litre0 - uom_po_id: product_uom_litre0 - property_stock_inventory: stock.location_inventory - property_stock_procurement: stock.location_procurement - property_stock_production: stock.location_production -- - I define the BoM to produce an orange juice. -- - !record {model: mrp.bom, id: mrp_bom_orangejuice0}: - company_id: base.main_company - name: Orange Juice - product_efficiency: 1.0 - product_id: product_product_orangejuice0 - product_qty: 1.0 - product_uom: product_uom_litre0 - type: phantom -- - changes UOM and name if product change. -- - !python {model: mrp.bom}: | - production_id = self.browse(cr, uid, [ref('mrp_bom_orangejuice0')], context=context)[0] - self.onchange_product_id(cr, uid, [ref('mrp_bom_orangejuice0')], production_id.product_id.id, False) -- - I create bom lines for BoM for Orange Juice. -- - !record {model: mrp.bom, id: mrp_bom_orangejuice0}: - bom_lines: - - bom_id: mrp_bom_orangejuice0 - company_id: base.main_company - name: Orange - product_efficiency: 1.0 - product_id: product_product_orange0 - product_qty: 0.5 - product_uom: product.product_uom_kgm - type: normal - - bom_id: mrp_bom_orangejuice0 - company_id: base.main_company - name: Sugar - product_efficiency: 1.0 - product_id: product_product_sugar0 - product_qty: 0.02 - product_uom: product.product_uom_kgm - type: normal - - bom_id: mrp_bom_orangejuice0 - company_id: base.main_company - name: Water - product_efficiency: 1.0 - product_id: product_product_water0 - product_qty: 0.80000000000000004 - product_uom: product_uom_litre0 - type: normal -- - I define Minimum stock rules for my stockable product "Orange". -- - !record {model: stock.warehouse.orderpoint, id: stock_warehouse_orderpoint_op0}: - company_id: base.main_company - location_id: stock.stock_location_stock - logic: max - name: OP/00002 - product_id: product_product_orange0 - product_max_qty: 10.0 - product_min_qty: 5.0 - product_uom: product.product_uom_kgm - qty_multiple: 1 - warehouse_id: stock.warehouse0 -- - I define Minimum stock rules for my stockable product "Sugar". -- - !record {model: stock.warehouse.orderpoint, id: stock_warehouse_orderpoint_op1}: - company_id: base.main_company - location_id: stock.stock_location_stock - logic: max - name: OP/00003 - product_id: product_product_sugar0 - product_max_qty: 4.0 - product_min_qty: 2.0 - product_uom: product.product_uom_kgm - qty_multiple: 1 - warehouse_id: stock.warehouse0 -- - I want to produce 100 litres of Orange juice. I am creating a manufacturing order for this. - I want to see how much quantities of sub products I need, to produce the Orange juice. -- - I compute the data. I get the bill of material of Orange juice and list of - scheduled products according to my bom. -- - !record {model: mrp.production, id: mrp_production_mo0}: - company_id: base.main_company - date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") - location_dest_id: stock.stock_location_output - location_src_id: stock.stock_location_stock - product_id: product_product_orangejuice0 - product_qty: 100.0 - product_uom: product_uom_litre0 -- - Creating an mrp.production record. Computing Bills of materials. -- - !record {model: mrp.production, id: mrp_production_mo0}: - bom_id: mrp.mrp_bom_orangejuice0 - company_id: base.main_company - date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") - location_dest_id: stock.stock_location_output - location_src_id: stock.stock_location_stock - name: MO/00002 - product_id: mrp.product_product_orangejuice0 - product_lines: - - name: Orange - product_id: mrp.product_product_orange0 - product_qty: 50.0 - product_uom: product.product_uom_kgm - production_id: mrp_production_mo0 - - name: Sugar - product_id: mrp.product_product_sugar0 - product_qty: 2.0 - product_uom: product.product_uom_kgm - production_id: mrp_production_mo0 - - name: Water - product_id: mrp.product_product_water0 - product_qty: 80.0 - product_uom: mrp.product_uom_litre0 - production_id: mrp_production_mo0 - product_qty: 100.0 - product_uom: mrp.product_uom_litre0 -- - I confirm the order. -- - !workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo0} -- - I am checking Procurement orders. There are 3 orders generated for Oranges, Sugar and Water. -- - !python {model: procurement.order}: | - proc_ids = self.search(cr, uid, [('product_id','in',[ref('product_product_orange0'),ref('product_product_sugar0'),ref('product_product_water0')])]) - assert proc_ids, 'No Procurements!' -- - The scheduler runs. -- - !function {model: procurement.order, name: run_scheduler}: - - model: procurement.order - search: "[]" -- - I am checking Internal picking. I see one picking for Orange juice and its - stock moves for Oranges, Sugar and Water made correctly. -- - !python {model: stock.picking}: | - pick_ids = self.search(cr, uid, [('type','=','internal')]) - assert pick_ids, 'No Internal Pickings!' -- - According to minimum stock rules. I have 2 purchase orders for - Sugar with 6 Kg from Axelor and Orange 60 Kg from ASUStek. -- - I confirm the purchase order of Sugar and Orange. -- - !python {model: purchase.order}: | - import netsvc - purch_ids = self.search(cr, uid, [('state','=','draft')]) - assert purch_ids, 'No Purchase Orders were made!' - wf_service = netsvc.LocalService("workflow") - for p_id in purch_ids: - wf_service.trg_validate(uid, 'purchase.order', p_id, 'purchase_confirm', cr) -- - I see two incoming pickings for Orange and Sugar, and receive them. -- - !python {model: stock.picking}: | - pick_ids = self.search(cr, uid, [('type','=','in')]) - assert pick_ids, 'No Incoming Shipments found!' - stock_partial_picking = self.pool.get('stock.partial.picking') - for pick_id in pick_ids: - partial_id = stock_partial_picking.create(cr, uid, {}, - context={'active_model': 'stock.picking', - 'active_ids': [pick_id]}) - stock_partial_picking.do_partial(cr, uid, [partial_id]) -- - Again the scheduler runs. -- - !function {model: procurement.order, name: run_scheduler}: - - model: procurement.order - search: "[]" -- - I check my internal picking of "Orange Juice" is done. -- - !python {model: stock.picking}: | - pick_ids = self.search(cr, uid, [('type','=','internal'),('state','=','done')]) - assert pick_ids, 'Internal Picking is not done yet!' -- - I check my manufacturing order for "Orange Juice" is ready or not. -- - !python {model: mrp.production}: | - prod_ids = self.search(cr, uid, [('state','=','ready'),('id','=',ref('mrp_production_mo0'))]) - assert prod_ids, 'Manufacturing order is not ready!' -- - I start the production order. -- - !workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo0} diff --git a/addons/mrp/test/mrp_procurement.yml b/addons/mrp/test/mrp_procurement.yml deleted file mode 100644 index 4aaf1560432..00000000000 --- a/addons/mrp/test/mrp_procurement.yml +++ /dev/null @@ -1,278 +0,0 @@ -- - In order to test the flow of procurement orders. I will put some orders with - different procurement methods. I have installed sale, mrp and purchase modules. -- - I am creating products. -- - I create record for product Shirt. -- - !record {model: product.product, id: product_product_shirt0}: - categ_id: product.cat1 - cost_method: standard - list_price: 350.0 - mes_type: fixed - name: Shirt - procure_method: make_to_stock - property_stock_inventory: stock.location_inventory - property_stock_procurement: stock.location_procurement - property_stock_production: stock.location_production - seller_delay: '1' - standard_price: 300.0 - supply_method: produce - type: product - uom_id: product.product_uom_unit - uom_po_id: product.product_uom_unit - volume: 0.0 - warranty: 0.0 - weight: 0.0 - weight_net: 0.0 -- - I create record for product Cloth. -- - !record {model: product.product, id: product_product_cloth0}: - categ_id: product.cat1 - cost_method: standard - mes_type: fixed - name: Cloth - procure_method: make_to_order - property_stock_inventory: stock.location_inventory - property_stock_procurement: stock.location_procurement - property_stock_production: stock.location_production - seller_delay: '1' - seller_ids: - - delay: 1 - name: base.res_partner_maxtor - product_uom: product.product_uom_unit - min_qty: 300.0 - standard_price: 1.0 - supply_method: buy - type: product - uom_id: product.product_uom_unit - uom_po_id: product.product_uom_unit - volume: 0.0 - warranty: 0.0 - weight: 0.0 - weight_net: 0.0 -- - I create record for product Buttons. -- - !record {model: product.product, id: product_product_buttons0}: - categ_id: product.cat1 - cost_method: standard - mes_type: fixed - name: Buttons - procure_method: make_to_stock - property_stock_inventory: stock.location_inventory - property_stock_procurement: stock.location_procurement - property_stock_production: stock.location_production - seller_delay: '1' - seller_ids: - - delay: 1 - name: base.res_partner_asus - product_uom: product.product_uom_kgm - min_qty: 100.0 - standard_price: 1.0 - supply_method: buy - type: product - uom_id: product.product_uom_kgm - uom_po_id: product.product_uom_kgm - volume: 0.0 - warranty: 0.0 - weight: 0.0 - weight_net: 0.0 -- - I am creating bills of material for 'Shirt'. -- - I create bills of material for Shirt. -- - !record {model: mrp.bom, id: mrp_bom_shirt0}: - bom_lines: - - company_id: base.main_company - name: Cloth - product_efficiency: 1.0 - product_id: product_product_cloth0 - product_qty: 1.0 - product_uom: product.product_uom_unit - product_uos_qty: 0.0 - sequence: 0.0 - type: normal - - company_id: base.main_company - name: Buttons - product_efficiency: 1.0 - product_id: product_product_buttons0 - product_qty: 8.0 - product_uom: product.product_uom_kgm - product_uos_qty: 0.0 - sequence: 0.0 - type: normal - company_id: base.main_company - name: Shirt - product_efficiency: 1.0 - product_id: product_product_shirt0 - product_qty: 1.0 - product_uom: product.product_uom_unit - product_uos_qty: 0.0 - sequence: 0.0 - type: normal -- - I create minimum stock rule for product Buttons -- - !record {model: stock.warehouse.orderpoint, id: stock_warehouse_orderpoint_op0}: - company_id: base.main_company - location_id: stock.stock_location_stock - logic: max - name: OP/00007 - product_id: mrp.product_product_buttons0 - product_max_qty: 50.0 - product_min_qty: 10.0 - product_uom: product.product_uom_kgm - qty_multiple: 1 - warehouse_id: stock.warehouse0 -- - I create a procurement order for product Shirt. -- - !record {model: procurement.order, id: procurement_order_shirt0}: - name: 'PROC: Shirt' - product_id: product_product_shirt0 - product_qty: 5.00 - location_id: stock.stock_location_stock - product_uom: product.product_uom_unit -- - I confirm the procurement order. -- - !workflow {model: procurement.order, action: button_confirm, ref: procurement_order_shirt0} -- - I run the procurement. -- - !workflow {model: procurement.order, action: button_check, ref: procurement_order_shirt0} -- - I see that there is a manufacturing order for Shirt. -- - !python {model: mrp.production}: | - from tools.translate import _ - order_ids = self.search(cr, uid, [('product_id','=',ref('product_product_shirt0'))]) - assert order_ids, 'No Manufacturing Order.' -- - I also check that there are two more procurement orders for sub products Cloth and Buttons. -- - !python {model: procurement.order}: | - from tools.translate import _ - proc_ids = self.search(cr, uid, [('product_id','in',[ref('product_product_cloth0'),ref('product_product_buttons0')])]) - assert proc_ids, 'No Procurements.' -- - The scheduler runs. -- - !function {model: procurement.order, name: run_scheduler}: - - model: procurement.order - search: "[]" -- - I check that there is one purchase order for Cloth. -- - !python {model: purchase.order}: | - purch_ids = self.search(cr, uid, [('partner_id.name','=','Maxtor')]) - assert purch_ids, 'No Purchase Orders.' -- - I confirm purchase order for Cloth. -- - !python {model: purchase.order}: | - import netsvc - purch_ids = self.search(cr, uid, [('partner_id.name','=','Maxtor')]) - wf_service = netsvc.LocalService("workflow") - for p_id in purch_ids: - wf_service.trg_validate(uid, 'purchase.order', p_id, 'purchase_confirm', cr) - -- - I confirm purchase order for Buttons. -- - !python {model: purchase.order}: | - import netsvc - purch_ids = self.search(cr, uid, [('partner_id.name','=','ASUStek')]) - wf_service = netsvc.LocalService("workflow") - for p_id in purch_ids: - wf_service.trg_validate(uid, 'purchase.order', p_id, 'purchase_confirm', cr) - -- - I Check incoming shipments for cloth. And receive products. -- - !python {model: stock.picking}: | - pick_ids = self.search(cr, uid, [('address_id.name','=','Wong'),('state','=','assigned')]) - assert pick_ids, 'No Incoming Shipments found!' - stock_partial_picking = self.pool.get('stock.partial.picking') - for pick_id in pick_ids: - partial_id = stock_partial_picking.create(cr, uid, {}, - context={'active_model': 'stock.picking', - 'active_ids': [pick_id]}) - stock_partial_picking.do_partial(cr, uid, [partial_id]) -- - I Check incoming shipments for buttons and receive products. -- - !python {model: stock.picking}: | - pick_ids = self.search(cr, uid, [('address_id.name','=','Tang'),('state','=','assigned')]) - assert pick_ids, 'No Incoming Shipments found!' - stock_partial_picking = self.pool.get('stock.partial.picking') - for pick_id in pick_ids: - partial_id = stock_partial_picking.create(cr, uid, {}, - context={'active_model': 'stock.picking', - 'active_ids': [pick_id]}) - stock_partial_picking.do_partial(cr, uid, [partial_id]) -- - Run scheduler again. -- - !function {model: procurement.order, name: run_scheduler}: - - model: procurement.order - search: "[]" -- - Check state of manufacturing order for Shirt. -- - !python {model: mrp.production}: | - from tools.translate import _ - order_ids = self.search(cr, uid, [('product_id','=',ref('product_product_shirt0')),('state','=','ready')]) - assert order_ids, 'No Manufacturing Order in Ready state.' -- - I start production order for Shirt. -- - !python {model: mrp.production}: | - from tools.translate import _ - import netsvc - prod_ids = self.search(cr, uid, [('state','=','ready')]) - assert prod_ids, _('No Ready Manufacturing Orders found!') - wf_service = netsvc.LocalService("workflow") - for p_id in prod_ids: - wf_service.trg_validate(uid, 'mrp.production', p_id, 'button_produce', cr) -- - I create record for producing products with quantity 5.00. -- - !record {model: mrp.product.produce, id: mrp_product_produce0}: - product_qty: 5.00 - mode: 'consume_produce' -- - I produce 2 products with 5.00 quantities each. -- - !python {model: mrp.product.produce}: | - prod_obj = self.pool.get('mrp.production') - prod_ids = prod_obj.search(cr, uid, [('product_id.name','=','Shirt')]) - self.do_produce(cr, uid, [ref('mrp_product_produce0')], context={'active_ids': prod_ids}) -- - I create record for remaining products with quantity 35.00. -- - !record {model: stock.move.consume, id: stock_move_consume0}: - product_id: product_product_buttons0 - product_qty: 35.00 - product_uom: product.product_uom_unit - location_id: stock.stock_location_stock -- - I produce remaining product Buttons with 35.00 quantity. -- - !python {model: stock.move.consume}: | - from tools.translate import _ - stock_obj = self.pool.get('stock.move') - stock_ids = stock_obj.search(cr, uid, [('product_id.name','=','Buttons')]) - self.do_move_consume(cr, uid, [ref('stock_move_consume0')], context={'active_ids': stock_ids}) -- - And finally production order is done. -- - !python {model: mrp.product.produce}: | - prod_obj = self.pool.get('mrp.production') - prod_ids = prod_obj.search(cr, uid, [('product_id.name','=','Shirt')]) - self.do_produce(cr, uid, [ref('mrp_product_produce0')], context={'active_ids': prod_ids}) -