diff --git a/addons/mrp/__openerp__.py b/addons/mrp/__openerp__.py
index 676e38d2e78..3065516b125 100644
--- a/addons/mrp/__openerp__.py
+++ b/addons/mrp/__openerp__.py
@@ -86,9 +86,10 @@
],
'demo_xml': ['mrp_demo.xml', 'board_manufacturing_demo.xml'],
'test': [
- 'test/mrp_phantom_bom.yml',
- 'test/mrp_production_order.yml',
- 'test/mrp_procurement.yml'
+ 'test/mrp_packs.yml',
+ 'test/mrp_phantom_bom.yml',
+ 'test/mrp_production_order.yml',
+ 'test/mrp_procurement.yml'
],
'installable': True,
'active': False,
diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml
index d6cd8f573ab..ae5572b1d76 100644
--- a/addons/mrp/mrp_view.xml
+++ b/addons/mrp/mrp_view.xml
@@ -634,7 +634,7 @@
-
+
diff --git a/addons/mrp/stock.py b/addons/mrp/stock.py
index 67efd0d2753..ab22f169552 100644
--- a/addons/mrp/stock.py
+++ b/addons/mrp/stock.py
@@ -94,7 +94,6 @@ class StockMove(osv.osv):
'location_id': move.location_id.id,
'procure_method': prodobj.procure_method,
'move_id': mid,
- 'company_id': line['company_id'],
})
wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
move_obj.write(cr, uid, [move.id], {
diff --git a/addons/mrp/test/mrp_packs.yml b/addons/mrp/test/mrp_packs.yml
new file mode 100644
index 00000000000..145b3f7e05f
--- /dev/null
+++ b/addons/mrp/test/mrp_packs.yml
@@ -0,0 +1,94 @@
+- |
+ In order to test the Packs in OpenERP, we will try to sell a "Pack of 24
+ beers" which is composed of 24 "Beers" and a "Beers Pack".
+- |
+ I start by creating the Beers product.
+-
+ !record {model: product.product, id: product_product_beers0}:
+ categ_id: product.cat1
+ name: Beers
+ procure_method: make_to_stock
+ supply_method: buy
+ type: product
+ uom_id: product.product_uom_unit
+ uom_po_id: product.product_uom_unit
+- |
+ I create the "Beers Pack" product.
+-
+ !record {model: product.product, id: product_product_beerspack0}:
+ categ_id: product.cat1
+ name: Beers Pack
+ procure_method: make_to_stock
+ supply_method: buy
+ type: product
+ uom_id: product.product_uom_unit
+ uom_po_id: product.product_uom_unit
+- |
+ I create the "Pack of 24 beers" product
+-
+ !record {model: product.product, id: product_product_packofbeers0}:
+ categ_id: product.cat1
+ name: Pack of 24 Beers
+ procure_method: make_to_order
+ supply_method: produce
+ type: product
+ uom_id: product.product_uom_unit
+ uom_po_id: product.product_uom_unit
+- |
+ I define the Phantom Bill of Material for the "Pack of 24 beers"
+-
+ !record {model: mrp.bom, id: mrp_bom_packofbeers0}:
+ bom_lines:
+ - company_id: base.main_company
+ name: Beers
+ product_id: product_product_beers0
+ product_qty: 24.0
+ product_uom: product.product_uom_unit
+ type: normal
+ - company_id: base.main_company
+ name: Beers Pack
+ product_id: product_product_beerspack0
+ product_qty: 1.0
+ product_uom: product.product_uom_unit
+ type: normal
+ name: Pack of 24 Beers
+ product_id: product_product_packofbeers0
+ product_qty: 1.0
+ product_uom: product.product_uom_unit
+ type: phantom
+- |
+ As all my data are created, I will create an outgoing order picking for a
+ "Pack of 24 Beers"
+-
+ !record {model: stock.picking, id: picking_out}:
+ address_id: base.res_partner_address_tang
+ company_id: base.main_company
+ invoice_state: none
+ move_lines:
+ - company_id: base.main_company
+ location_dest_id: stock.stock_location_customers
+ location_id: stock.stock_location_stock
+ name: Pack of 24 Beers
+ product_id: mrp_bom_packofbeers0
+ product_qty: 2.0
+ product_uom: product.product_uom_unit
+ move_type: direct
+ type: out
+- |
+ I validate the newly created picking.
+-
+ !python {model: stock.picking}
+ self.draft_validate(cr, uid, [ref("stock_picking_out0")], {
+ "active_ids": [ref("stock.menu_action_picking_tree")],
+ "active_id": ref("stock.menu_action_picking_tree"), }
+ )
+- |
+ I check that my Picking of a "PAck of 24 beers" as been automatically
+ converted to a picking of 24 beers and a pack of beer, so that my
+ stock of beers remains exact.
+-
+ !assert {model: stock.picking, id: stock_picking_out0}:
+ - len(move_ids) == 2
+ - move_ids[0].product_id.id <> move_ids[1].product_id.id
+ - move_ids[0].product_id.id in (ref('product_product_beers0'), ref('product_product_beerspack0'))
+ - move_ids[1].product_id.id in (ref('product_product_beers0'), ref('product_product_beerspack0'))
diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml
index 3128b3592ed..7cdcec6e281 100644
--- a/addons/stock/stock_view.xml
+++ b/addons/stock/stock_view.xml
@@ -626,7 +626,7 @@
-
+
@@ -797,7 +797,7 @@
-
+
@@ -1000,7 +1000,7 @@
-
+
@@ -1200,7 +1200,7 @@
-
+