Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Coopdevs OCB mirror
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coopdevs
Odoo
Coopdevs OCB mirror
Commits
ee4b1ee3
Commit
ee4b1ee3
authored
14 years ago
by
Ujjvala Collins
Browse files
Options
Downloads
Patches
Plain Diff
[ADD] mrp_subproduct: Added yaml.
bzr revid: uco@tinyerp.com-20100806085112-vym0raztj8tbor3h
parent
688a010d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
addons/mrp_subproduct/__openerp__.py
+1
-0
1 addition, 0 deletions
addons/mrp_subproduct/__openerp__.py
addons/mrp_subproduct/test/mrp_subproduct.yml
+169
-0
169 additions, 0 deletions
addons/mrp_subproduct/test/mrp_subproduct.yml
with
170 additions
and
0 deletions
addons/mrp_subproduct/__openerp__.py
+
1
−
0
View file @
ee4b1ee3
...
...
@@ -38,6 +38,7 @@ With this module:
'
init_xml
'
:
[],
'
update_xml
'
:
[
'
security/ir.model.access.csv
'
,
'
mrp_subproduct_view.xml
'
],
'
demo_xml
'
:
[],
'
test
'
:
[
'
test/mrp_subproduct.yml
'
],
'
installable
'
:
True
,
'
active
'
:
False
,
'
certificate
'
:
'
0050060616733
'
,
...
...
This diff is collapsed.
Click to expand it.
addons/mrp_subproduct/test/mrp_subproduct.yml
0 → 100644
+
169
−
0
View file @
ee4b1ee3
-
In order to test mrp_subproduct with OpenERP, I create a bill of material with subproducts.
I make a production order, confirm it so stock moves for subproducts are generated.
-
I create a record for the product Chair.
-
!record
{
model
:
product.product
,
id
:
product_product_woodenchair0
}
:
categ_id
:
product.cat1
name
:
Wooden Chair
procure_method
:
make_to_stock
supply_method
:
produce
type
:
product
uom_id
:
product.product_uom_unit
uom_po_id
:
product.product_uom_unit
property_stock_inventory
:
stock.location_inventory
property_stock_procurement
:
stock.location_procurement
property_stock_production
:
stock.location_production
-
I create a record for the product Wood.
-
!record
{
model
:
product.product
,
id
:
product_product_wood0
}
:
categ_id
:
product.cat1
name
:
Wood
procure_method
:
make_to_order
supply_method
:
buy
property_stock_inventory
:
stock.location_inventory
property_stock_procurement
:
stock.location_procurement
property_stock_production
:
stock.location_production
seller_ids
:
-
delay
:
1
name
:
base.res_partner_maxtor
min_qty
:
300.0
type
:
product
uom_id
:
product.product_uom_unit
uom_po_id
:
product.product_uom_unit
-
I create a record for the product Nails.
-
!record
{
model
:
product.product
,
id
:
product_product_nails0
}
:
categ_id
:
product.cat1
name
:
Nails
procure_method
:
make_to_order
supply_method
:
buy
property_stock_inventory
:
stock.location_inventory
property_stock_procurement
:
stock.location_procurement
property_stock_production
:
stock.location_production
seller_ids
:
-
delay
:
1
name
:
base.res_partner_asus
min_qty
:
500.0
type
:
product
uom_id
:
product.product_uom_unit
uom_po_id
:
product.product_uom_unit
-
I create a record for the product Table.
-
!record
{
model
:
product.product
,
id
:
product_product_woodentable0
}
:
categ_id
:
product.cat1
name
:
Wooden Table
procure_method
:
make_to_stock
supply_method
:
produce
type
:
product
uom_id
:
product.product_uom_unit
uom_po_id
:
product.product_uom_unit
property_stock_inventory
:
stock.location_inventory
property_stock_procurement
:
stock.location_procurement
property_stock_production
:
stock.location_production
-
Now I create a bill of material for the product Wooden Chair.
-
!record
{
model
:
mrp.bom
,
id
:
mrp_bom_woodenchair0
}
:
company_id
:
base.main_company
name
:
Wooden Chair
product_efficiency
:
1.0
product_id
:
product_product_woodenchair0
product_qty
:
1.0
product_uom
:
product.product_uom_unit
product_uos_qty
:
0.0
type
:
normal
bom_lines
:
-
company_id
:
base.main_company
name
:
Wood
product_efficiency
:
1.0
product_id
:
product_product_wood0
product_qty
:
10.0
product_uom
:
product.product_uom_unit
product_uos_qty
:
0.0
sequence
:
0.0
type
:
normal
-
company_id
:
base.main_company
name
:
Nails
product_efficiency
:
1.0
product_id
:
product_product_nails0
product_qty
:
35.0
product_uom
:
product.product_uom_unit
product_uos_qty
:
0.0
sequence
:
0.0
type
:
normal
sub_products
:
-
product_id
:
product_product_woodentable0
product_uom
:
product.product_uom_unit
product_qty
:
1.0
subproduct_type
:
fixed
-
I create a production order for Wooden Chair.
-
!record
{
model
:
mrp.production
,
id
:
mrp_production_mo0
}
:
bom_id
:
mrp_bom_woodenchair0
company_id
:
base.main_company
date_planned
:
'
2010-08-06
14:55:52'
location_dest_id
:
stock.stock_location_stock
location_src_id
:
stock.stock_location_stock
name
:
MO/00004
product_id
:
product_product_woodenchair0
product_qty
:
10.0
product_uom
:
product.product_uom_unit
product_uos_qty
:
0.0
-
I compute the data of production order.
-
!python
{
model
:
mrp.production
}
:
|
self.action_compute(cr, uid, [ref("mrp_production_mo0")], {"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"), })
-
I confirm the production order.
-
!workflow
{
model
:
mrp.production
,
action
:
button_confirm
,
ref
:
mrp_production_mo0
}
-
Now I check the stock moves for the subproduct I created in the bill of material.
This move is created automatically when I confirmed the production order.
-
!python
{
model
:
stock.move
}
:
|
move_id = self.search(cr, uid, [('product_id','=',ref('product_product_woodentable0'))])
assert move_id, 'No moves are created !'
-
I want to start the production so I force the reservation of products.
-
!python
{
model
:
mrp.production
}
:
|
self.force_production(cr, uid, [ref("mrp_production_mo0")], {"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"),
})
-
I start the production.
-
!workflow
{
model
:
mrp.production
,
action
:
button_produce
,
ref
:
mrp_production_mo0
}
-
I consume and produce the Production of products.
-
I create record for selecting mode and quantity of products to produce.
-
!record
{
model
:
mrp.product.produce
,
id
:
mrp_product_produce0
}
:
product_qty
:
10.00
mode
:
'
consume_produce'
-
I finish the production order.
-
!python
{
model
:
mrp.product.produce
}
:
|
self.do_produce(cr, uid, [ref("mrp_product_produce0")], {"lang": "en_US", "tz":
False, "search_default_Current": 1, "active_model": "mrp.production", "active_ids":
[ref("mrp_production_mo0")], "active_id": ref("mrp_production_mo0"), })
-
I see that stock moves of Wood and Nails including Wooden Table are done now.
-
!python
{
model
:
stock.move
}
:
|
move_ids = self.search(cr, uid, [('product_id','in',[ref("product_product_woodenchair0"),ref("product_product_woodentable0"),ref("product_product_wood0"),ref("product_product_nails0")])])
moves = self.browse(cr, uid, move_ids)
assert all(move.state == 'done' for move in moves), 'Moves are not done!'
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment