diff --git a/addons/mrp/__openerp__.py b/addons/mrp/__openerp__.py
index 49b62004a36..d635eedea33 100644
--- a/addons/mrp/__openerp__.py
+++ b/addons/mrp/__openerp__.py
@@ -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',
diff --git a/addons/mrp/mrp_demo.xml b/addons/mrp/mrp_demo.xml
index 792867be7f6..be13e64fa41 100644
--- a/addons/mrp/mrp_demo.xml
+++ b/addons/mrp/mrp_demo.xml
@@ -709,28 +709,5 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/addons/mrp/mrp_production_order_demo.yml b/addons/mrp/mrp_production_order_demo.yml
new file mode 100644
index 00000000000..d9f117092dd
--- /dev/null
+++ b/addons/mrp/mrp_production_order_demo.yml
@@ -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
diff --git a/addons/mrp/test/mrp_packs.yml b/addons/mrp/test/mrp_packs.yml
index b5c4065652e..9816ac856f9 100644
--- a/addons/mrp/test/mrp_packs.yml
+++ b/addons/mrp/test/mrp_packs.yml
@@ -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
diff --git a/addons/mrp/test/mrp_production_cancel.yml b/addons/mrp/test/mrp_production_cancel.yml
index 7063fa94227..76f3a9cec3c 100644
--- a/addons/mrp/test/mrp_production_cancel.yml
+++ b/addons/mrp/test/mrp_production_cancel.yml
@@ -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}
diff --git a/addons/mrp/test/mrp_production_order.yml b/addons/mrp/test/mrp_production_order.yml
index 237da35ab06..ffa9280d249 100644
--- a/addons/mrp/test/mrp_production_order.yml
+++ b/addons/mrp/test/mrp_production_order.yml
@@ -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'
diff --git a/addons/mrp/test/mrp_report.yml b/addons/mrp/test/mrp_report.yml
index 48126b5edcd..c9712e67398 100644
--- a/addons/mrp/test/mrp_report.yml
+++ b/addons/mrp/test/mrp_report.yml
@@ -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)
diff --git a/addons/mrp/test/production_order_consume.yml b/addons/mrp/test/production_order_consume.yml
index 605929640e7..9cd010a63a2 100644
--- a/addons/mrp/test/production_order_consume.yml
+++ b/addons/mrp/test/production_order_consume.yml
@@ -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'