Devishree Brahmbhatt (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-coverage-mrp_subproduct-dbr into
lp:openobject-addons.
Requested reviews:
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-coverage-mrp_subproduct-dbr/+merge/86502
Hello,
Improve YML for mrp_subproduct module as follows:
Add demo data record for product and Bill or material.
Improve the test cases.
So,kindly review it.
Thanks,
DBR
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-coverage-mrp_subproduct-dbr/+merge/86502
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-coverage-mrp_subproduct-dbr.
=== modified file 'mrp/mrp_demo.xml'
--- mrp/mrp_demo.xml 2011-12-12 12:25:01 +0000
+++ mrp/mrp_demo.xml 2011-12-21 07:11:26 +0000
@@ -11,7 +11,7 @@
<field name="code">ASML - HOUR</field>
<field name="name">Costing Account For Hours of Assembly.</field>
</record>
-
+
<record id="account_assembly_cycle" model="account.analytic.account">
<field name="type">normal</field>
<field name="code">ASML - Cycle</field>
@@ -31,8 +31,8 @@
<field name="name">Assembly Service Cost</field>
<field name="categ_id" ref="product.product_category_assembly"/>
</record>
-
-
+
+
<!--
Resource: mrp.workcenter
-->
@@ -209,7 +209,7 @@
<field name="hour_nbr">1</field>
<field name="sequence">10</field>
</record>
-
+
<record id="mrp_routing_workcenter_4" model="mrp.routing.workcenter">
<field name="routing_id" ref="mrp_routing_1"/>
<field name="workcenter_id" ref="mrp_workcenter_1"/>
@@ -329,10 +329,18 @@
<field model="product.product" name="product_id" ref="product.product_product_cpu3"/>
</record>
+ <record id="mrp_bom_arm1" model="mrp.bom">
+ <field name="name">ARM100 + Subproduct</field>
+ <field name="sequence">40</field>
+ <field name="product_uom" ref="product.product_uom_unit"/>
+ <field name="product_qty">1.0</field>
+ <field model="product.product" name="product_id" ref="product.product_product_arm" />
+ </record>
+
<record id="mrp_bom_kit3" model="mrp.bom">
<field name="code">KIT</field>
<field name="name">Kit Keyboard + Mouse</field>
- <field name="sequence">40</field>
+ <field name="sequence">42</field>
<field name="product_uom" ref="product.product_uom_unit"/>
<field name="product_qty">1.0</field>
<field name="type">phantom</field>
@@ -574,7 +582,7 @@
<field name="bom_id" ref="mrp_bom_kit1"/>
<field model="product.product" name="product_id" ref="product.product_product_24"/>
</record>
-
+
<record id="mrp_bom_41" model="mrp.bom">
<field name="name">Regular processor config</field>
<field name="sequence">111</field>
@@ -602,7 +610,6 @@
<field name="bom_id" ref="mrp_bom_9"/>
<field model="product.product" name="product_id" ref="product.product_product_tow1"/>
</record>
-
<record id="mrp_bom_kit2" model="mrp.bom">
<field name="code">KIT</field>
<field name="sequence">118</field>
@@ -613,11 +620,19 @@
<field name="bom_id" ref="mrp_bom_9"/>
<field model="product.product" name="product_id" ref="product.product_product_26"/>
</record>
-
+ <record id="mrp_bom_34" model="mrp.bom">
+ <field name="name">SIDEPAN</field>
+ <field name="sequence">121</field>
+ <field name="product_uom" ref="product.product_uom_unit"/>
+ <field name="product_qty">1.0</field>
+ <field name="type">normal</field>
+ <field name="bom_id" ref="mrp_bom_arm1"/>
+ <field model="product.product" name="product_id" ref="product.product_product_sidepanel0"/>
+ </record>
<!--
Resource: mrp.bom new EVV
-->
-
+
<record id="mrp_bom_defaultbomforshelfofcm0" model="mrp.bom">
<field name="name">Default BOM for Shelf of 100cm</field>
<field name="code">SHE100</field>
@@ -662,7 +677,7 @@
<field name="bom_id" ref="mrp_bom_defaultbomforshelfofcm0"/>
<field name="product_qty">1.0</field>
<field name="name">Rear panel SHE100</field>
- <field name="type">phantom</field>
+ <field name="type">phantom</field>
</record>
<record id="mrp_bom_shelf0" model="mrp.bom">
@@ -672,11 +687,11 @@
<field name="bom_id" ref="mrp_bom_defaultbomforshelfofcm0"/>
<field name="product_qty">3.0</field>
<field name="name">RCK100</field>
- <field name="type">phantom</field>
+ <field name="type">phantom</field>
</record>
<!--
- BOMs for 1 RCK100 PCE
+ BOMs for 1 RCK100 PCE
Product Ref Qty UoM Type of BoM
SPAN100 1 PCE phantom
METC000 4 PCE normal
@@ -706,7 +721,7 @@
<field name="name">METC000</field>
</record>
<!--
- Bill of Materials for 1 SPAN100 PCE
+ Bill of Materials for 1 SPAN100 PCE
Product Code Quantity Unit of Measure
WOOD010 0.083 m
-->
@@ -726,9 +741,9 @@
<field name="name">WOOD010</field>
</record>
<!-- BoMs for 1 Assembly Section PCE
- Product Ref. Qty UoM
- LIN40 0.25 Meter
-
+ Product Ref. Qty UoM
+ LIN40 0.25 Meter
+
-->
<record id="mrp_bom_assemblysection1" model="mrp.bom">
<field name="name">Assembly Section</field>
@@ -737,7 +752,7 @@
<field name="product_uom" ref="product.product_uom_unit"/>
<field name="product_qty">1.0</field>
<field name="routing_id" ref="mrp.mrp_routing_0"/>
-
+
</record>
<record id="mrp_bom_woodlintelm0" model="mrp.bom">
@@ -749,7 +764,7 @@
<field name="name">Wood Lintel 0.25m</field>
</record>
<!--
- Bill of Materials for 1 RPAN100 PCE
+ Bill of Materials for 1 RPAN100 PCE
Product Code Quantity Unit of Measure
WOOD002 0.25 m
-->
@@ -785,8 +800,8 @@
RPAN200 1 PCE normal
PROFIL 4 PCE normal
SIDEPAN 2 PCE normal
- METC000 12 PCE normal
- RCK200 3 PCE normal
+ METC000 12 PCE normal
+ RCK200 3 PCE normal
-->
<record id="mrp_bom_rearpanelarm2" model="mrp.bom">
<field name="sequence">147</field>
@@ -867,7 +882,7 @@
<field name="bom_id" ref="mrp_bom_defaultbomforkitshelfofcm0"/>
</record>
-
+
<record id="product.product_uom_dozen" model="product.uom">
<field name="category_id" ref="product.product_uom_categ_unit"/>
@@ -886,7 +901,7 @@
<field name="bom_id" ref="mrp_bom_defaultbomforshelfofcm0"/>
</record>
-
+
<record id="product_uom_categ_fluid" model="product.uom.categ">
<field name="name">Fluid</field>
@@ -995,7 +1010,7 @@
<field name="qty_multiple">1</field>
<field name="warehouse_id" ref="stock.warehouse0"/>
<field name="location_id" ref="stock.stock_location_stock"/>
-
+
</record>
<record id="stock_rule_sugar" model="stock.warehouse.orderpoint">
<field name="product_id" ref="product_sugar"/>
@@ -1015,7 +1030,7 @@
<field name="bom_id" ref="mrp_bom_orangejuice"/>
<field name="product_qty">100.00</field>
</record>
-
+
<record id="product_shirt" model="product.product">
<field name="categ_id" ref="product.cat1"/>
<field name="name">Shirt</field>
@@ -1081,7 +1096,7 @@
<field name="type">normal</field>
<field name="bom_id" ref="mrp_bom_shirt"/>
</record>
-
+
<record id="stock_shirt_buttons" model="stock.warehouse.orderpoint">
<field name="product_id" ref="product_buttons"/>
<field name="product_uom" ref="product.product_uom_unit"/>
@@ -1108,7 +1123,7 @@
<field name="routing_id" ref="mrp.mrp_routing_0"/>
</record>
<workflow action="button_confirm" model="mrp.production" ref="mrp_production_order1"/>
-
+
<!-- Run Scheduler -->
<function model="procurement.order" name="run_scheduler"/>
</data>
=== modified file 'mrp_subproduct/test/mrp_subproduct.yml'
--- mrp_subproduct/test/mrp_subproduct.yml 2011-11-17 19:06:29 +0000
+++ mrp_subproduct/test/mrp_subproduct.yml 2011-12-21 07:11:26 +0000
@@ -1,149 +1,61 @@
-
- In order to test mrp_subproduct with OpenERP, I create a bill of material with subproducts.
+ In order to test mrp_subproduct with OpenERP, I add subproduct in bill of material.
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
+ I add a sub product in Bill of material for product Cabinet.
+-
+ !record {model: mrp.bom, id: mrp_bom_arm1}:
+ product_id: product.product_product_arm
+ name: ARM100 + Subproduct
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_id: product.product_product_woodentable0
product_uom: product.product_uom_unit
- product_qty: 1.0
+ product_qty: 2.0
subproduct_type: fixed
-
- I create a production order for Wooden Chair.
+ I create a production order for Cabinet.
-
!record {model: mrp.production, id: mrp_production_mo0}:
- bom_id: mrp_bom_woodenchair0
- date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S")
- location_dest_id: stock.stock_location_stock
+ product_id: product.product_product_arm
+ product_qty: 10.0
+ product_uom: product.product_uom_unit
+ bom_id: mrp_bom_arm1
location_src_id: stock.stock_location_stock
- product_id: product_product_woodenchair0
- product_qty: 10.0
- 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"), })
+ self.action_compute(cr, uid, [ref("mrp_production_mo0")], {"active_ids": [ref("mrp_production_mo0")],"active_id": ref("mrp_production_mo0")})
-
I confirm the production order.
-
- !workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo0}
+ !python {model: mrp.production}: |
+ self.action_confirm(cr, uid, [ref('mrp_production_mo0')])
+-
+ I check production order state.
+-
+ !python {model: mrp.production}: |
+ order = self.browse(cr, uid, ref('mrp_production_mo0'))
+ assert order.state == 'confirmed','Production order state should be in confirm state.'
-
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'))])
+ move_id = self.search(cr, uid, [('product_id','=',ref('product.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"),
- })
+ self.force_production(cr, uid, [ref("mrp_production_mo0")], {"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 consume and produce the production of products.
-
I create record for selecting mode and quantity of products to produce.
-
@@ -154,13 +66,12 @@
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"), })
+ self.do_produce(cr, uid, [ref("mrp_product_produce0")], {"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.
+ I see that stock moves of Cabinet including Wooden Table are done now.
-
!python {model: stock.move}: |
- move_ids = self.search(cr, uid, [('product_id','in',[ref("product_product_woodentable0"),ref("product_product_wood0"),ref("product_product_nails0")])])
+ move_ids = self.search(cr, uid, [('product_id','in',[ref("product.product_product_arm"),ref("product.product_product_sidepanel0")])])
moves = self.browse(cr, uid, move_ids)
assert all(move.state == 'done' for move in moves), 'Moves are not done!'
+
=== modified file 'product/product_demo.xml'
--- product/product_demo.xml 2011-12-09 11:21:31 +0000
+++ product/product_demo.xml 2011-12-21 07:11:26 +0000
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
-
+
<record id="base.user_demo" model="res.users">
<field eval="[(4, ref('base.group_sale_salesman'))]" name="groups_id"/>
</record>
-
+
<!--
Resource: product.category
-->
@@ -413,7 +413,19 @@
<field name="type">product</field>
<field name="categ_id" ref="product_category_11"/>
</record>
-
+ <record id="product_product_arm" model="product.product">
+ <field name="default_code">ARM100</field>
+ <field name="supply_method">produce</field>
+ <field name="list_price">450.0</field>
+ <field name="standard_price">300.0</field>
+ <field name="uom_id" ref="product_uom_unit"/>
+ <field name="uom_po_id" ref="product_uom_unit"/>
+ <field name="procure_method">make_to_order</field>
+ <field name="sale_delay">3.0</field>
+ <field name="name">Cabinet</field>
+ <field name="type">product</field>
+ <field name="categ_id" ref="product_category_misc0"/>
+ </record>
<!--
Resource: product.product NEW EVV
-->
@@ -464,6 +476,19 @@
<field name="type">product</field>
<field name="categ_id" ref="product_category_rawmaterial0"/>
</record>
+ <record id="product_product_woodentable0" model="product.product">
+ <field name="default_code">WOODTAB</field>
+ <field name="supply_method">produce</field>
+ <field eval="'make_to_stock'" name="procure_method"/>
+ <field name="standard_price">5.0</field>
+ <field name="uom_id" ref="product_uom_unit"/>
+ <field name="uom_po_id" ref="product_uom_unit"/>
+ <field name="name">Wooden Table</field>
+ <field eval="2" name="seller_delay"/>
+ <field eval="7.0" name="sale_delay"/>
+ <field name="type">product</field>
+ <field name="categ_id" ref="cat1"/>
+ </record>
<record id="product_product_woodmm10" model="product.product">
<field name="default_code">WOOD010</field>
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp