[IMP] Improved yml files for mrp* modules

bzr revid: pso@tinyerp.com-20120724131411-cf4tg0h8ylk5dlt7
This commit is contained in:
pso (OpenERP) 2012-07-24 18:44:11 +05:30
commit 8d58cdc1bf
4 changed files with 26 additions and 26 deletions

View File

@ -67,7 +67,7 @@ So that we can compare the theoretic delay and real delay.
'demo_xml': ['mrp_operation_data.xml',
'mrp_operations_demo.yml'],
'test': [
# 'test/workcenter_operations.yml',
'test/workcenter_operations.yml',
],
'installable': True,
'auto_install': False,

View File

@ -2,13 +2,13 @@
I compute the production order.
-
!python {model: mrp.production}: |
order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
order.action_compute(context=context)
-
I check planned date in workcenter lines of production order.
-
!python {model: mrp.production}: |
order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
for line in order.workcenter_lines:
#TODO: to check start date of next line should be end of date of previous line.
assert line.date_planned, "Planned Start date is not computed: %s" %(line)
@ -17,7 +17,7 @@
-
I confirm the Production Order.
-
!workflow {model: mrp.production, action: button_confirm, ref: mrp.mrp_production_shelf100cm}
!workflow {model: mrp.production, action: button_confirm, ref: mrp.mrp_production_1}
-
I run scheduler.
-
@ -27,17 +27,17 @@
I forcefully close internal shipment.
-
!python {model: mrp.production}: |
self.force_production(cr, uid, [ref("mrp.mrp_production_shelf100cm")])
self.force_production(cr, uid, [ref("mrp.mrp_production_1")])
-
I start production.
-
!workflow {model: mrp.production, action: button_produce, ref: mrp.mrp_production_shelf100cm}
!workflow {model: mrp.production, action: button_produce, ref: mrp.mrp_production_1}
-
Production start on first work center, so I start work operation on first work center.
-
!python {model: mrp.production}: |
import netsvc
order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_start_working', cr)
-
@ -45,7 +45,7 @@
-
!python {model: mrp.production}: |
import netsvc
order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_pause', cr)
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_resume', cr)
@ -54,7 +54,7 @@
-
!python {model: mrp.production}: |
import netsvc
order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_resume', cr)
@ -63,7 +63,7 @@
-
!python {model: mrp.production}: |
import netsvc
order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_cancel', cr)
-
@ -71,7 +71,7 @@
-
!python {model: mrp.production}: |
import netsvc
order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_draft', cr)
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_start_working', cr)
@ -80,7 +80,7 @@
-
!python {model: mrp.production}: |
import netsvc
order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_done', cr)
-
@ -88,7 +88,7 @@
-
!python {model: mrp.production}: |
import netsvc
order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
wf_service = netsvc.LocalService("workflow")
for work_line in order.workcenter_lines[1:]:
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', work_line.id, 'button_start_working', cr)
@ -98,7 +98,7 @@
I check that the production order is now done.
-
!python {model: mrp.production}: |
order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
print order.state
assert order.state == 'done', "Production should be closed after finished all operations."
-

View File

@ -47,7 +47,7 @@ With this module:
],
'demo_xml': [],
'test': [
#'test/mrp_subproduct.yml'
'test/mrp_subproduct.yml'
],
'installable': True,
'auto_install': False,

View File

@ -2,11 +2,11 @@
In order to test mrp_subproduct with OpenERP, I add subproduct in bill of material.
I make a production order, confirm it so stock moves for subproducts are generated.
-
I add a sub product in Bill of material for product Cabinet.
I add a sub product in Bill of material for product External Hard Disk.
-
!record {model: mrp.bom, id: mrp_bom_arm1}:
!record {model: mrp.bom, id: mrp.mrp_bom_24}:
product_id: product.product_product_28
name: ARM100 + Subproduct
name: External Hard Disk + Subproduct
product_uom: product.product_uom_unit
sub_products:
- product_id: product.product_product_33
@ -14,13 +14,13 @@
product_qty: 2.0
subproduct_type: fixed
-
I create a production order for Cabinet.
I create a production order for External Hard Disk.
-
!record {model: mrp.production, id: mrp_production_mo0}:
product_id: product.product_product_28
product_qty: 10.0
product_qty: 2.0
product_uom: product.product_uom_unit
bom_id: mrp_bom_arm1
bom_id: mrp.mrp_bom_24
location_src_id: stock.stock_location_stock
-
I compute the data of production order.
@ -30,8 +30,7 @@
-
I confirm the production order.
-
!python {model: mrp.production}: |
self.action_confirm(cr, uid, [ref('mrp_production_mo0')])
!workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo0}
-
I check production order state.
-
@ -59,7 +58,7 @@
I create record for selecting mode and quantity of products to produce.
-
!record {model: mrp.product.produce, id: mrp_product_produce0}:
product_qty: 10.00
product_qty: 2.00
mode: 'consume_produce'
-
I finish the production order.
@ -67,9 +66,10 @@
!python {model: mrp.product.produce}: |
self.do_produce(cr, uid, [ref("mrp_product_produce0")], {"active_model": "mrp.production", "active_ids":[ref("mrp_production_mo0")], "active_id": ref("mrp_production_mo0")})
-
I see that stock moves of Cabinet including Wooden Table are done now.
I see that stock moves of External Hard Disk including Headset USB are done now.
-
!python {model: stock.move}: |
move_ids = self.search(cr, uid, [('product_id','in',[ref("product.product_product_28"),ref("product.product_product_41")])])
production_order = self.pool.get('mrp.production').browse(cr, uid, ref("mrp_production_mo0"))
move_ids = self.search(cr, uid, [('origin','=',production_order.name), ('product_id','in',[ref("product.product_product_28"),ref("product.product_product_33")])])
moves = self.browse(cr, uid, move_ids)
assert all(move.state == 'done' for move in moves), 'Moves are not done!'