Report "product cost structure" doesnt calculate components costs
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Addons (MOVED TO GITHUB) |
New
|
Undecided
|
OpenERP Publisher's Warranty Team |
Bug Description
Products A, B, C and D.
standard prices are 1€.
BoM for Product A: 1B + 4C
BoM for product B: 10D
(so one A should be composed of 10D + 4B, and in fact that's what the procurement orders do)
When calculating A's "product cost structure" report,
------------ I'm awaiting:
Costs A :
1 x costs B
10 x costs D = 10 x 1€
4 x costs C = 4 x 1 €
Total costs for one A : 14€
------------ BUT INSTEAD OF THIS, IT ...
... calculates A costs using A's BoM (A= 1B + 4C)
... doesn't calculate B's costs using B's BoM (B=10D).
Instead of this, creates a new B's "BoM components", with no other products in it.
Cost of one B = 1 x standard price of B = 1€
Costs A = 1x standard price of B + 4x standard price of C = 1€ + 4€ = 5€
------------ Note:
The report "BoM structure" is correct, it gives :
A
1B
10D
4C
Thanks in advance for correcting this bug (or for explanation if I'm understanding something wrong)
Changed in openobject-addons: | |
assignee: | nobody → OpenERP Publisher's Warranty Team (openerp-opw) |
status: | Invalid → New |
tags: | added: maintenance |
Naive remarks after analysing some files (I don't speak python fluently, and never developed anything around OpenErp, so don't be too hard if it's stupid!).
The data for the report seems to be assembled in addons\ mrp\report\ price.py
There I can read:
for prod_id in ids: get_pool( cr.dbname) .get('mrp. bom').search( cr, uid, [('product_ id','=' ,prod_id) ]) get_pool( cr.dbname) .get('product. product' ).browse( cr, uid, prod_id)
bom_ids = pooler.
prod = pooler.
for bom_id in bom_ids: get_pool( cr.dbname) .get('mrp. bom').browse( cr, uid, bom_id)
bom = pooler.
From the last line above, it seems to me it just checks the sub-boms (bom components?) included in the first bom, but NOT the boms of the included products that would have their own boms independantly and not as sub_boms. used=pooler. get.... ...(products in the bom) of_used_ products = pooler.get (boms of used products) boms_to_ consider = sub_boms + boms_of_ used_products
Would it be possible here to complete this "sub_boms" array, with the boms of the products included in the first bom?
Something like
products_
boms_
all_
I really think the problem is here, even if I fairly doubt the solution can look like this... once again, don't be too hard with a nondevelopper newcomer looking forward to help solving his own problem... ;-)