104 lines
3.3 KiB
YAML
104 lines
3.3 KiB
YAML
-
|
|
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
|
|
seller_ids:
|
|
- delay: 1
|
|
name: base.res_partner_agrolait
|
|
min_qty: 2.0
|
|
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
|
|
seller_ids:
|
|
- delay: 1
|
|
name: base.res_partner_asus
|
|
min_qty: 2.0
|
|
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: product_product_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("picking_out")], {
|
|
"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" has 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: picking_out, string: pack_of_beer_splitted}:
|
|
- len(move_lines) >= 2
|
|
- move_lines[0].product_id.id <> move_lines[1].product_id.id
|
|
- move_lines[0].product_id.id in (ref('product_product_beers0'), ref('product_product_beerspack0'))
|
|
- move_lines[1].product_id.id in (ref('product_product_beers0'), ref('product_product_beerspack0'))
|
|
|