[ADD,IMP]: mrp: created new demo yml for production orders so that we can use those demo in yaml test files,
* Improved reference of demo data in yml + removed creation of demo record bzr revid: rpa@tinyerp.com-20111117124452-53fylwd4fcrf8qsb
This commit is contained in:
@@ -90,6 +90,7 @@ Dashboard provided by this module:
|
||||
],
|
||||
'demo_xml': [
|
||||
'mrp_demo.xml',
|
||||
'mrp_production_order_demo.yml'
|
||||
],
|
||||
'test': [
|
||||
'test/mrp_production_order.yml',
|
||||
|
||||
@@ -709,28 +709,5 @@
|
||||
<field name="bom_id" ref="mrp_bom_defaultbomforshelfofcm1"/>
|
||||
</record>
|
||||
|
||||
<record id="mrp_production_order1" model="mrp.production">
|
||||
<field name="product_id" ref="product.product_product_pc1"/>
|
||||
<field name="product_uom" ref="product.product_uom_unit"/>
|
||||
<field name="location_src_id" ref="stock.stock_location_stock"/>
|
||||
<field name="location_dest_id" ref="stock.stock_location_output"/>
|
||||
<field name="bom_id" ref="mrp.mrp_bom_9"/>
|
||||
<field name="routing_id" ref="mrp.mrp_routing_0"/>
|
||||
</record>
|
||||
|
||||
<workflow action="button_confirm" model="mrp.production" ref="mrp_production_order1"/>
|
||||
|
||||
<!-- Run Scheduler -->
|
||||
<function model="procurement.order" name="run_scheduler"/>
|
||||
|
||||
<record id="mrp_production_order2" model="mrp.production">
|
||||
<field name="product_id" ref="product.product_product_pc3"/>
|
||||
<field name="product_uom" ref="product.product_uom_unit"/>
|
||||
<field name="location_src_id" ref="stock.stock_location_stock"/>
|
||||
<field name="location_dest_id" ref="stock.stock_location_stock"/>
|
||||
<field name="bom_id" ref="mrp.mrp_bom_2"/>
|
||||
<field name="routing_id" ref="mrp.mrp_routing_0"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
-
|
||||
!record {model: mrp.production, id: mrp_production_order1}:
|
||||
location_src_id: stock.stock_location_stock
|
||||
location_dest_id: stock.stock_location_output
|
||||
product_id: product.product_product_pc1
|
||||
name: MO/00001
|
||||
product_qty: 5.0
|
||||
product_uos_qty: 5.0
|
||||
-
|
||||
!function {model: mrp.production, name: action_compute, id: mrp_production_order1}:
|
||||
- model: mrp.production
|
||||
eval: "[obj(ref('mrp_production_order1')).id]"
|
||||
|
||||
-
|
||||
!workflow {model: mrp.production, action: button_confirm, ref: mrp_production_order1}
|
||||
-
|
||||
!record {model: mrp.production, id: mrp_production_order2}:
|
||||
location_src_id: stock.stock_location_stock
|
||||
product_id: product.product_product_kitshelfofcm0
|
||||
product_qty: 5.0
|
||||
product_uos_qty: 5.0
|
||||
-
|
||||
!record {model: mrp.production, id: mrp_production_order3}:
|
||||
location_src_id: stock.stock_location_stock
|
||||
product_id: product.product_product_pc3
|
||||
@@ -1,7 +1,7 @@
|
||||
-
|
||||
In order to test the Packs in OpenERP, we will try to sell a "KIT Shelf of 100cm" which is composed of "[PROFIL] Assembly Section" and "[SIDEPAN] Side Panel" having Phantom BOM.
|
||||
-
|
||||
As all my data are already available, I will create an outgoing order picking for 2 "KIT Shelf of 100cm"
|
||||
I will create an outgoing order picking for 2 "KIT Shelf of 100cm"
|
||||
-
|
||||
!record {model: stock.picking, id: picking_out}:
|
||||
address_id: base.res_partner_address_tang
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
-
|
||||
In order to test effect of cancelling Internal picking on production order, I first confirm order for PC3.
|
||||
-
|
||||
!workflow {model: mrp.production, action: button_confirm, ref: mrp_production_order2}
|
||||
!workflow {model: mrp.production, action: button_confirm, ref: mrp_production_order3}
|
||||
-
|
||||
I check that the related internal picking is waiting availability.
|
||||
-
|
||||
!assert {model: mrp.production, id: mrp_production_order2}:
|
||||
!assert {model: mrp.production, id: mrp_production_order3}:
|
||||
- picking_id.state == 'confirmed'
|
||||
-
|
||||
In order to cancel the production order, I first cancel its picking.
|
||||
-
|
||||
!function {model: stock.picking, name: action_cancel}:
|
||||
- model: mrp.production
|
||||
eval: "[obj(ref('mrp_production_order2')).picking_id.id]"
|
||||
eval: "[obj(ref('mrp_production_order3')).picking_id.id]"
|
||||
-
|
||||
Now I cancel the production order.
|
||||
-
|
||||
!workflow {model: mrp.production, action: button_cancel, ref: mrp_production_order2}
|
||||
!workflow {model: mrp.production, action: button_cancel, ref: mrp_production_order3}
|
||||
-
|
||||
Now I check that the production order is cancelled.
|
||||
-
|
||||
!assert {model: mrp.production, id: mrp_production_order2}:
|
||||
!assert {model: mrp.production, id: mrp_production_order3}:
|
||||
- state == 'cancel'
|
||||
-
|
||||
I remove this production order.
|
||||
-
|
||||
!delete {model: mrp.production, id: mrp_production_order2}
|
||||
!delete {model: mrp.production, id: mrp_production_order3}
|
||||
|
||||
@@ -1,27 +1,9 @@
|
||||
-
|
||||
In order to test the manufacturing order working with procurements I will create manufacturing orders of products having different configuration and check the flow.
|
||||
In order to test the manufacturing order working with procurements I will check different manufacturing orders of different products having different configuration and check the flow.
|
||||
-
|
||||
I am creating a manufacturing order of 5 PC1-Basic PC which has 'Assembly Basic PC' as its BOM.
|
||||
I create record for wizard 'Change Qty' as we have to produce 6.0 PC1 instead of 5.0,
|
||||
-
|
||||
!record {model: mrp.production, id: mrp_production_mo1}:
|
||||
company_id: base.main_company
|
||||
date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S")
|
||||
location_dest_id: stock.stock_location_stock
|
||||
location_src_id: stock.stock_location_stock
|
||||
product_id: product.product_product_pc1
|
||||
name: MO/0123
|
||||
product_qty: 5.0
|
||||
product_uom: product.product_uom_unit
|
||||
product_uos_qty: 5.0
|
||||
-
|
||||
I click on the "Compute Data" to compute work centre and scheduled product.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
self.action_compute(cr, uid, [ref("mrp_production_mo1")])
|
||||
-
|
||||
I remembered that we have to produce 6.0 PC1 instead of 5.0, so I create record for wizard 'Change Qty'.
|
||||
-
|
||||
!record {model: change.production.qty, id: mrp_production_qty, context: "{'active_id': ref('mrp_production_mo1')}"}:
|
||||
!record {model: change.production.qty, id: mrp_production_qty, context: "{'active_id': ref('mrp_production_order1')}"}:
|
||||
-
|
||||
I change value to 6.0
|
||||
-
|
||||
@@ -31,44 +13,44 @@
|
||||
I Approve change qty wizard for 6.0 PC1.
|
||||
-
|
||||
!python {model: change.production.qty}: |
|
||||
context = {"lang": 'en_US', "active_model":"mrp.production", "active_ids": [ref("mrp_production_mo1")], "tz": False, "active_id":ref('mrp_production_mo1')}
|
||||
context = {"lang": 'en_US', "active_model":"mrp.production", "active_ids": [ref("mrp_production_order1")], "tz": False, "active_id":ref('mrp_production_order1')}
|
||||
self.change_prod_qty(cr, uid, [ref("mrp_production_qty")], context=context)
|
||||
-
|
||||
I confirm the manufacturing order for 5 PC1.
|
||||
-
|
||||
!workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo1}
|
||||
-
|
||||
I check there is an internal picking for this MO to bring components in Raw Materials Location.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
from tools.translate import _
|
||||
pick_ids = self.browse(cr, uid, ref("mrp_production_mo1"))
|
||||
assert pick_ids.picking_id.id, _('No Internal Picking created for this manufacturing order!')
|
||||
-
|
||||
!workflow {model: mrp.production, action: button_confirm, ref: mrp_production_order1}
|
||||
-
|
||||
I compute the scheduler to procure the components based on their supply method.
|
||||
-
|
||||
!function {model: procurement.order, name: run_scheduler}:
|
||||
- model: procurement.order
|
||||
search: "[]"
|
||||
-
|
||||
I check there is an internal picking for this MO to bring components in Raw Materials Location.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
from tools.translate import _
|
||||
pick_ids = self.browse(cr, uid, ref("mrp_production_order1"))
|
||||
assert pick_ids.picking_id.id, _('No Internal Picking created for this manufacturing order!')
|
||||
-
|
||||
I see that there is a manufacturing order for the sub product CPU_GEN with ready state and I start production of it.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
from tools.translate import _
|
||||
order_ids = self.search(cr, uid, [('state','=','ready'), ('product_id', '=', ref('product.product_product_cpu_gen')), ('origin', 'ilike', '%MO/0123%')])
|
||||
order_ids = self.search(cr, uid, [('state','=','ready'), ('product_id', '=', ref('product.product_product_cpu_gen')), ('origin', 'ilike', '%MO/00001%')])
|
||||
assert order_ids, _('No manufacturing order in Ready state for CPU_GEN!')
|
||||
import netsvc
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for order in order_ids:
|
||||
wf_service.trg_validate(uid, 'mrp.production', order, 'button_produce', cr)
|
||||
-
|
||||
Now to produce CPU_GEN, I create record of wizard 'Consume & Produce' with quantity 6.0.
|
||||
Now to produce CPU_GEN, I create record of wizard 'Consume & Produce'.
|
||||
-
|
||||
!record {model: mrp.product.produce, id: mrp_product_produce0}:
|
||||
product_qty: 6.0
|
||||
mode: 'consume_produce'
|
||||
product_qty: 5.0
|
||||
-
|
||||
I confirm the production of 6.0 CPU_GEN.
|
||||
I confirm the production of CPU_GEN.
|
||||
-
|
||||
!python {model: mrp.product.produce}: |
|
||||
prod_obj = self.pool.get('mrp.production')
|
||||
@@ -77,25 +59,25 @@
|
||||
-
|
||||
Component CPU_GEN is produced and now manufacturing order for PC1 is ready to produce.
|
||||
-
|
||||
!assert {model: mrp.production, id: mrp_production_mo1}:
|
||||
!assert {model: mrp.production, id: mrp_production_order1}:
|
||||
- state == 'ready'
|
||||
-
|
||||
I start production of PC1.
|
||||
-
|
||||
!workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo1}
|
||||
!workflow {model: mrp.production, action: button_produce, ref: mrp_production_order1}
|
||||
-
|
||||
I create record for producing products with quantity 6.0.
|
||||
-
|
||||
!record {model: mrp.product.produce, id: mrp_product_produce1, context: "{'active_id': ref('mrp_production_mo1')}"}:
|
||||
!record {model: mrp.product.produce, id: mrp_product_produce1, context: "{'active_id': ref('mrp_production_order1')}"}:
|
||||
mode: 'consume_produce'
|
||||
-
|
||||
I produce the products by clicking on 'Produce'
|
||||
-
|
||||
!python {model: mrp.product.produce}: |
|
||||
context = {"lang": 'en_US', "active_model":"mrp.production", "active_ids": [ref("mrp_production_mo1")], "tz": False, "active_id":ref('mrp_production_mo1')}
|
||||
context = {"lang": 'en_US', "active_model":"mrp.production", "active_ids": [ref("mrp_production_order1")], "tz": False, "active_id":ref('mrp_production_order1')}
|
||||
self.do_produce(cr, uid, [ref('mrp_product_produce1')], context=context)
|
||||
-
|
||||
I check now the production order for 6.0 PC1 is done.
|
||||
-
|
||||
!assert {model: mrp.production, id: mrp_production_mo1}:
|
||||
!assert {model: mrp.production, id: mrp_production_order1}:
|
||||
- state == 'done'
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
import netsvc, tools, os
|
||||
(data, format) = netsvc.LocalService('report.mrp.production.order').create(cr, uid, [ref('mrp.mrp_production_mo1')], {}, {})
|
||||
(data, format) = netsvc.LocalService('report.mrp.production.order').create(cr, uid, [ref('mrp.mrp_production_order1')], {}, {})
|
||||
if tools.config['test_report_directory']:
|
||||
file(os.path.join(tools.config['test_report_directory'], 'mrp-production_order_report.'+format), 'wb+').write(data)
|
||||
|
||||
|
||||
@@ -1,33 +1,21 @@
|
||||
-
|
||||
I create production order of 5.0 KIT Shelf of 100cm to test partial consumption and production.
|
||||
I confirm the production order of 5.0 KIT Shelf of 100cm to test partial consumption and production.
|
||||
-
|
||||
!record {model: mrp.production, id: mrp_production_mo3}:
|
||||
company_id: base.main_company
|
||||
date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S")
|
||||
location_dest_id: stock.stock_location_stock
|
||||
location_src_id: stock.stock_location_stock
|
||||
product_id: product.product_product_kitshelfofcm0
|
||||
product_qty: 5.0
|
||||
product_uom: product.product_uom_unit
|
||||
product_uos_qty: 5.0
|
||||
-
|
||||
I confirm the production order.
|
||||
-
|
||||
!workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo3}
|
||||
!workflow {model: mrp.production, action: button_confirm, ref: mrp_production_order2}
|
||||
-
|
||||
The production order is Waiting Goods, so I force reservation of components.
|
||||
-
|
||||
!python {model: mrp.production}:
|
||||
self.force_production(cr, uid, [ref("mrp_production_mo3")])
|
||||
self.force_production(cr, uid, [ref("mrp_production_order2")])
|
||||
-
|
||||
I mark KIT Shelf as in production.
|
||||
-
|
||||
!workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo3}
|
||||
!workflow {model: mrp.production, action: button_produce, ref: mrp_production_order2}
|
||||
-
|
||||
I Consume 4.0 Side Panels first and scrap one damaged Side Panel.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
production = self.browse(cr, uid, ref("mrp_production_mo3"))
|
||||
production = self.browse(cr, uid, ref("mrp_production_order2"))
|
||||
move_ids = [move for move in production.move_lines if move.product_id.id == ref('product.product_product_sidepanel0')]
|
||||
if move_ids:
|
||||
move = move_ids[0]
|
||||
@@ -39,14 +27,14 @@
|
||||
I produce 2.0 KIT Shelves.
|
||||
-
|
||||
!python {model: mrp.product.produce}: |
|
||||
context = {"lang": 'en_US', "active_model":"mrp.production", "active_ids": [ref("mrp_production_mo3")], "tz": False, "active_id":ref('mrp_production_mo3')}
|
||||
context = {"lang": 'en_US', "active_model":"mrp.production", "active_ids": [ref("mrp_production_order2")], "tz": False, "active_id":ref('mrp_production_order2')}
|
||||
wiz_id = self.create(cr, uid, {'mode': 'consume_produce', 'product_qty': 2.0}, context=context)
|
||||
self.do_produce(cr, uid, [wiz_id], context=context)
|
||||
-
|
||||
I check there will be 2.0 KIT Shelves in Finished Products.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
production = self.browse(cr, uid, ref("mrp_production_mo3"))
|
||||
production = self.browse(cr, uid, ref("mrp_production_order2"))
|
||||
move_ids = [move for move in production.move_created_ids2 if move.product_id.id == ref('product.product_product_kitshelfofcm0')]
|
||||
if move_ids:
|
||||
assert move_ids[0].product_qty == 2.0
|
||||
@@ -54,24 +42,24 @@
|
||||
Now I consume remaining components for production of KIT Shelves.
|
||||
-
|
||||
!python {model: mrp.product.produce}: |
|
||||
context = {"lang": 'en_US', "active_model":"mrp.production", "active_ids": [ref("mrp_production_mo3")], "tz": False, "active_id":ref('mrp_production_mo3')}
|
||||
context = {"lang": 'en_US', "active_model":"mrp.production", "active_ids": [ref("mrp_production_order2")], "tz": False, "active_id":ref('mrp_production_order2')}
|
||||
wiz_id = self.create(cr, uid, {'mode': 'consume'}, context=context)
|
||||
self.do_produce(cr, uid, [wiz_id], context=context)
|
||||
-
|
||||
I check now there is nothing remaining in Products to Consume.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
production = self.browse(cr, uid, ref("mrp_production_mo3"))
|
||||
production = self.browse(cr, uid, ref("mrp_production_order2"))
|
||||
assert len(production.move_lines) == 0
|
||||
-
|
||||
Now I produce remaining 3.0 KIT Shelves.
|
||||
-
|
||||
!python {model: mrp.product.produce}: |
|
||||
context = {"lang": 'en_US', "active_model":"mrp.production", "active_ids": [ref("mrp_production_mo3")], "tz": False, "active_id":ref('mrp_production_mo3')}
|
||||
context = {"lang": 'en_US', "active_model":"mrp.production", "active_ids": [ref("mrp_production_order2")], "tz": False, "active_id":ref('mrp_production_order2')}
|
||||
wiz_id = self.create(cr, uid, {'mode': 'consume_produce'}, context=context)
|
||||
self.do_produce(cr, uid, [wiz_id], context=context)
|
||||
-
|
||||
I check now the production order for 5.0 KIT Shelves is done.
|
||||
-
|
||||
!assert {model: mrp.production, id: mrp_production_mo3}:
|
||||
!assert {model: mrp.production, id: mrp_production_order2}:
|
||||
- state == 'done'
|
||||
|
||||
Reference in New Issue
Block a user