This question has been flagged
3 Replies
9712 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?

Avatar
Discard
Best Answer

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

Avatar
Discard
Best Answer

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!

Avatar
Discard

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

Best Answer

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.

Avatar
Discard
Author

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.

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

Author

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.

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