odoo/odoo — pull request #1421 by han-odoo (2014-07-29 06:44:44+00:00)
Title: [FIX] mrp: Improved domain in _bom_find method that finds the bom for product variant

Removed ('product_tmpl_id.product_variant_ids', '=', product_id) from domain as it was leading product to brings all BOM having same product_tmpl_id as a result it was always consideting first BOM in list when processing MO.

Issue can be produced with following scenario.

Create a Product A having varian large, small, black, white.

It will create 4 products Product A(large,black), Product A(large, white), Product A(small, black) and Product A(small, white).

Create a 4 separate products for component, lets say comp1, comp2, comp3, comp4.

Create BOM for all variants: Product A(large, black) have component comp1, Product A(large, white) have component comp2 and so on.

Now create MO for Product A(small, black), we should have comp3 as product in "Products to consume" but you will see always comp1 because first BOM have component comp1 and it will return once have bom id.

for bom in self.pool.get('mrp.bom').browse(cr, uid, ids):
if not set(map(int,bom.property_ids or [])) - set(properties or []):
return bom.id