[FIX]: mrp: Fixed flow of production process in yml

bzr revid: rpa@tinyerp.com-20110927091208-sh8y3ye42thdwgc4
This commit is contained in:
Rucha (Open ERP) 2011-09-27 14:42:08 +05:30
parent 5a473c06e9
commit 2391006300
1 changed files with 24 additions and 21 deletions

View File

@ -28,10 +28,10 @@
-
!workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo1}
-
I create record for producing products with quantity 8.00
I create record for changing production quantity to 6.00
-
!record {model: change.production.qty, id: mrp_production_qty}:
product_qty: 8.0
product_qty: 6.0
-
Changes the Quantity of Product.
-
@ -40,10 +40,10 @@
self.default_get(cr, uid, ["product_qty"], context)
self.change_prod_qty(cr, uid, [ref("mrp_production_qty")], context=context)
-
I check now quantity of the production order is 8 or not.
I check now quantity of the production order is 6 or not.
-
!assert {model: mrp.production, id: mrp_production_mo1}:
- product_qty == 8
- product_qty == 6
-
I am checking Procurement orders for components of PC1.
-
@ -68,28 +68,28 @@
pick_ids = self.search(cr, uid, [('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.
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')])
order_ids = self.search(cr, uid, [('state','=','ready'), ('product_id', '=', ref('product.product_product_cpu_gen'))])
assert order_ids, _('No manufacturing order in Ready state!')
import netsvc
wf_service = netsvc.LocalService("workflow")
for order in order_ids:
wf_service.trg_validate(uid, 'mrp.production', order, 'button_produce', cr)
-
I start producing that product first. So I marked it as started.
-
!workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo1}
-
I create record for producing products with quantity 5.00.
I create record for producing products with quantity 6.00.
-
!record {model: mrp.product.produce, id: mrp_product_produce0}:
product_qty: 5.00
product_qty: 6.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')])
prod_ids = prod_obj.search(cr, uid, [('state','=','in_production'), ('product_id', '=', ref('product.product_product_cpu_gen'))])
self.do_produce(cr, uid, [ref('mrp_product_produce0')], context={'active_ids': prod_ids})
-
Now the manufacturing order for subproduct CPU_GEN is done and manufacturing
@ -97,23 +97,26 @@
-
!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!')
prod_ids = self.search(cr, uid, [('state','=','done'), ('product_id', '=', ref('product.product_product_cpu_gen'))])
assert prod_ids, _('Manufacturing order for CPU_GEN is yet not done!')
-
I start producing the product PC1.
-
!workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo1}
-
I create record for producing products with quantity 5.00.
I create record for producing products with quantity 6.00.
-
!record {model: mrp.product.produce, id: mrp_product_produce1}:
product_qty: 5.00
product_qty: 6.00
mode: 'consume_produce'
-
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, [ref('mrp_product_produce1')], context={'active_ids': prod_ids})
context = {"lang": 'en_US', "active_model":"mrp.production", "active_ids": [ref("mrp_production_mo1")], "tz": False, "active_id":ref('mrp_production_mo1')}
self.do_produce(cr, uid, [ref('mrp_product_produce1')], context=context)
-
I check now the production order for PC1 is done.
-
!assert {model: mrp.production, id: mrp_production_mo1}:
- state == 'done'