odoo/addons/mrp/test/mrp_production_order.yml

146 lines
4.9 KiB
YAML

-
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
-
I create a record for Workcenter line.
-
!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
-
I create second record for Workcenter line.
-
!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
-
I create third record for Workcenter line.
-
!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
-
I create fourth record for Workcenter line.
-
!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
-
I create a record for production line.
-
!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
-
I create second record for production line.
-
!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: procurement.order}: |
from tools.translate import _
proc_ids = self.search(cr, uid, [('state','!=','confirmed')])
assert proc_ids, _('No Procurements!')
-
The scheduler runs.
-
!function {model: procurement.order, name: run_scheduler}:
- model: procurement.order
search: "[('state','=','confirmed')]"
-
I am checking Internal picking.
-
!python {model: stock.picking}: |
from tools.translate import _
pick_ids = self.search(cr, uid, [('state','!=','done'),('type','=','internal')])
assert pick_ids, _('No Internal Pickings!')
-
I see that there is a manufacturing order for the sub product of PC1 with ready state.
-
!python {model: mrp.production}: |
from tools.translate import _
order_ids = self.search(cr, uid, [('state','=','confirmed')])
assert order_ids, _('No manufacturing order!')
-
I start producing that product first. So I marked it as started.
-
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 the product.
-
!python {model: mrp.product.produce}: |
prod_obj = self.pool.get('mrp.production')
prod_ids = prod_obj.search(cr, uid, [('state','=','confirmed')])
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, [('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}
-
Finally my production order is done.
-
!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})