[IMP]: in mrp search proper picking id and in operation improve message and search picking id

bzr revid: ksa@tinyerp.com-20110921105456-lbuag1hiqv4wej4m
This commit is contained in:
Kirti Savalia (OpenERP)
2011-09-21 16:24:56 +05:30
parent ac12fc31c3
commit 0a54692edd
3 changed files with 25 additions and 47 deletions
+13 -11
View File
@@ -11,6 +11,7 @@
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: 0.0
@@ -62,7 +63,7 @@
!python {model: stock.picking}: |
mrp_obj = self.pool.get('mrp.production')
mo = mrp_obj.browse(cr, uid, ref("mrp_production_mo1"))
picking_id = self.search(cr, uid, [])
picking_id = self.search(cr, uid, [('origin','like','%MO/0123')])
if picking_id:
self.action_cancel(cr, uid, picking_id, context=None)
-
@@ -105,18 +106,10 @@
product_qty: 5.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})
-
I am set the product quantity.
I create record for producing products with quantity 8.00
-
!record {model: change.production.qty, id: mrp_production_qty}:
product_qty: 5.0
product_qty: 8.0
-
Changes the Quantity of Product.
-
@@ -124,3 +117,12 @@
context = {"lang": 'en_US', "active_model":"mrp.production", "active_ids": [ref("mrp_production_qty")], "tz": False, "active_id":ref('mrp_production_qty')}
self.default_get(cr, uid, ["product_qty"], context)
self.change_prod_qty(cr, uid, [ref("mrp_production_qty")], context=context)
-
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})
@@ -1,7 +1,5 @@
-
In order to test mrp_operations module in OpenERP I will put a Production order
and check its effects on Work orders.
-
In order to test mrp_operations module in OpenERP,
I create a production order.
-
!record {model: mrp.production, id: mrp_production_mo1}:
@@ -15,24 +13,16 @@
product_uom: product.product_uom_unit
product_uos_qty: 5.0
-
I am computing the data.
-
!python {model: mrp.production}: |
self.action_compute(cr, uid, [ref("mrp_production_mo1")], {"lang": "en_US", "tz":
False, "search_default_current": 1, "active_model": "ir.ui.menu", "active_ids":
[ref("mrp.menu_mrp_production_action")], "active_id": ref("mrp.menu_mrp_production_action"),
})
-
Now I confirm my production order.
Now I confirm the production order.
-
!workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo1}
-
I check that there is one Work order generated related to my production order.
I check that there is one Work order generated related to the production order.
-
!python {model: mrp.production.workcenter.line}: |
from tools.translate import _
order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo1')),('state','=','draft')])
assert order_id, _('No Work order!')
assert order_id, _('No Work order define for this production order!')
-
The scheduler runs.
-
@@ -44,10 +34,10 @@
-
!python {model: stock.picking}: |
from tools.translate import _
pick_ids = self.search(cr, uid, [('state','!=','done'),('type','=','internal')])
pick_ids = self.search(cr, uid, [('state','!=','done'),('type','=','internal'),('origin','like','%MO/01234567')])
assert pick_ids, _('No Internal Pickings!')
-
In order to cancel the MO, I first cancel its picking
In order to cancel the MO, first cancel its picking
-
!python {model: stock.picking}: |
mrp_obj = self.pool.get('mrp.production')
@@ -56,6 +46,6 @@
if picking_id:
self.action_cancel(cr, uid, picking_id, context=None)
-
Then I cancel The Manufacturing order.
Then cancel The Manufacturing order.
-
!workflow {model: mrp.production, action: button_cancel, ref: mrp_production_mo1}
+5 -19
View File
@@ -33,7 +33,7 @@
!python {model: mrp.production.workcenter.line}: |
from tools.translate import _
order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo0')),('state','=','draft')])
assert order_id, _('No Work order!')
assert order_id, _('No Work order define for this production order!')
-
The scheduler runs.
-
@@ -62,7 +62,7 @@
prod_obj = self.pool.get('mrp.production')
prod_order_ids = prod_obj.search(cr, uid, [('state','=','ready'),('origin','like','%MO/0123456')])
workorder_id = self.search(cr, uid, [('production_id','=', prod_order_ids[0]),('state','=','draft')])
assert workorder_id, _('No Work order!')
assert workorder_id, _('No Work order define for this production order!')
-
I start the second production order of the CPU_GEN product.
-
@@ -103,14 +103,8 @@
-
!python {model: mrp.production}: |
from tools.translate import _
import netsvc
wf_service = netsvc.LocalService("workflow")
prod_ids = self.search(cr, uid, [('id','=',ref('mrp_production_mo0')),('state','=','ready')])
order_data = self.browse(cr, uid, prod_ids[0])
if order_data:
wf_service.trg_validate(uid, 'mrp.production', order_data.id, 'button_produce', cr)
else:
assert prod_ids, _('Production order is not ready!')
assert prod_ids, _('Production order is not ready!')
-
I check that both internal pickings are done.
-
@@ -127,14 +121,8 @@
-
!python {model: mrp.production.workcenter.line}: |
from tools.translate import _
import netsvc
wf_service = netsvc.LocalService("workflow")
order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo0')),('state','=','startworking')])
order_data = self.browse(cr, uid, order_id[0])
if order_data:
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order_data.id, 'button_start_working', cr)
else:
assert order_id, _('Work order not started yet!')
assert order_id, _('Work order not started yet!')
-
I am creating a mrp.product.produce record.
-
@@ -167,6 +155,4 @@
-
!python {model: mrp.production}: |
mo = self.browse(cr, uid, ref("mrp_production_mo0"))
prop=mo.date_planned
unknow_none=False
self._production_date_end(cr, uid, [ref("mrp_production_mo0")], prop, unknow_none, context=None)
self._production_date_end(cr, uid, [ref("mrp_production_mo0")], mo.date_planned, False, context=None)