@@ -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,
|
||||
|
||||
@@ -634,7 +634,7 @@
|
||||
<field name="state"/>
|
||||
<button name="action_compute" states="draft" string="Compute Data" type="object" icon="gtk-execute"/>
|
||||
<button name="button_confirm" states="draft" string="Confirm Production" icon="gtk-apply"/>
|
||||
<button name="button_produce" states="ready" string="Mark as Started" icon="gtk-execute"/>
|
||||
<button name="button_produce" states="ready" string="Start Production" icon="gtk-execute"/>
|
||||
<button name="%(act_mrp_product_produce)d" states="in_production" string="Produce" icon="gtk-ok" type="action"/>
|
||||
<button name="force_production" states="confirmed,picking_except" string="Force Reservation" type="object" icon="gtk-jump-to"/>
|
||||
<button name="button_cancel" states="draft,ready,confirmed,in_production,picking_except" string="Cancel" icon="gtk-cancel"/>
|
||||
|
||||
@@ -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], {
|
||||
|
||||
@@ -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'))
|
||||
@@ -626,7 +626,7 @@
|
||||
<notebook colspan="4">
|
||||
<page string="General Information">
|
||||
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_out_id': address_id}">
|
||||
<tree colors="grey:scraped == True" string="Stock Moves" editable="top">
|
||||
<tree colors="grey:scraped == True" string="Stock Moves">
|
||||
<field name="name" string="Move Name"/>
|
||||
<field name="product_id"/>
|
||||
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
|
||||
@@ -797,7 +797,7 @@
|
||||
<notebook colspan="4">
|
||||
<page string="General Information">
|
||||
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_out_id': address_id}" >
|
||||
<tree colors="grey:scraped == True" string="Stock Moves" editable="top">
|
||||
<tree colors="grey:scraped == True" string="Stock Moves">
|
||||
<field name="name" string="Move Name"/>
|
||||
<field name="product_id"/>
|
||||
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
|
||||
@@ -1000,7 +1000,7 @@
|
||||
<notebook colspan="4">
|
||||
<page string="General Information">
|
||||
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_out_id': address_id}" >
|
||||
<tree colors="grey:scraped=True" string="Stock Moves" editable="top">
|
||||
<tree colors="grey:scraped==True" string="Stock Moves">
|
||||
<field name="product_id"/>
|
||||
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
|
||||
<field name="product_uom" string="UOM"/>
|
||||
@@ -1200,7 +1200,7 @@
|
||||
<notebook colspan="4">
|
||||
<page string="General Information">
|
||||
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_in_id': address_id}" >
|
||||
<tree colors="grey:scraped==True" string="Stock Moves" editable="top">
|
||||
<tree colors="grey:scraped==True" string="Stock Moves">
|
||||
<field name="product_id" readonly="1"/>
|
||||
<field name="product_qty" readonly="1"/>
|
||||
<field name="product_uom" string="UOM" readonly="1"/>
|
||||
|
||||
Reference in New Issue
Block a user