Odoo Help


BOM cost is calculated incorrectly when product includes sub BOMs

on 5/23/13, 11:56 AM 5,238 views

I installed the modules (product_cost_incl_bom and product_get_cost_field). When I go to the top level BOM, which includes an other BOM within it, then on the PRODUCT COST STRUCTURE print out the cost is listed as 0.00 GBP for each of the sub BOMs. This seems to be an error as the cost field in each individual sub BOM is populated correctly.

The module appears to fail to transfer the costs into the BOM cost structure.

This leads to that the cost price for a BOM, which includes as sub-BOM, is calculated incorrectly. The final cost price only includes items that are not in any sub BOM. Is it possible to calculate the final cost price of a product including all sub BOMs without having to manually add them up?


Baiju KS

--Baiju KS--
| 5 5 8
Kochi, India
--Baiju KS--
ODOO technical

        I like learning new thing, especially technical thing. I am a quick learner, I can learn technical things very fast. I have good logical skill,  I have immense interest in programming.

e-mail id : baijuks@hotmail.com

Baiju KS
On 12/7/14, 11:35 PM

You can build your own custom module for this requirement instead of using those  modules for just one thing. You can proceed in these ways: You should first inherit mrp.bom and add a new field 'price_unit': fields.float('Unit Price') and redefine the onchange_product_id function define compute_price and compute_total function to calculate "line price" and "total price" Then you have to inherit mrp.production and define compute_production_cost function to update cost_price from BOM. We have created this custom module and it works perfect , in my module it takes avg purcahse price in BOM and we added an extra tab to manufactring form to compute Production Cost , in that tab you can add extra charges like electicity etc.. , that charges also added to cost by calculating per_unit charge depending on UOM. for any help you can contact us baijuks@hotmail.com, akhil.p.sivan007@gmail.com

On 7/4/13, 3:41 AM

I meet a new problem, when I defined product A、B、C、D。

The BOM Struct is Like: A<--2B+C C<--0.2D (that means one D can produce five C)

If the cost price of D is 10$, I hope see the cost price of C is 2$, but I see "Cost Price (incl. BoM)" is 0. why ?And the bom cost of report is also wrong, you can see the cost price of sub-product C is 0 in the report.

I find this bug only happens when I try to define a sub-material that it's quantity is float. ( C<--0.2D) , That is, if i define like C<--2D, all things looks fine!

Yes, that's when the "Unit of Measure" is set to another type as reference.

Metrolux Gmbh, Andreas Marpmann
on 2/12/14, 3:09 AM
On 5/29/13, 1:01 PM

The real problem is not the module itself, but the fact that this report "Product cost structure" isn't modified by the module. So you have to modify mrp/report/price.py and change two things:

line 68 "std_price = product_uom_pool._compute_price(cr, uid, prod.uom_id.id, prod.standard_price, to_uom_id=product_uom.id)" by "std_price = product_uom_pool._compute_price(cr, uid, prod.uom_id.id, prod.cost_price, to_uom_id=product_uom.id)"

line 150 "total_strd = number * product.standard_price" by "total_strd = number * product.cost_price"

The module product_cost_incl_bom also have to be modified (!) by changing line 62 "std_price = sub_product.standard_price" by "std_price = sub_product.cost_price" Hope this help.

Thank you for the effort. I tried the two changes you were suggesting but unfortunately the cost for the a product (consisting of a BOM) is still shown as 0.00 within the cost price structure print out.

Forsberg Services Ltd, Raphael
on 5/30/13, 6:11 AM

I modified my answer, you also have to modify line 68, it should work now !

iMaugis, Julius
on 5/30/13, 6:23 AM

This solved the problem in the sense that the correct cost price is created at the end of the report. However the "supplier price per unit of measure" is displayed. This is the only things that is still a bit awkward.

Forsberg Services Ltd, Raphael
on 5/30/13, 7:43 AM

You're right, you have to modify the report to make those values reach the real cost price of sub-products/sub-boms.

iMaugis, Julius
on 5/30/13, 8:21 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 5/23/13, 11:56 AM
Seen: 5238 times
Last updated: 3/16/15, 8:10 AM