[FIX] mrp: improve mrp BOM report

Steps to reproduce the bug:
- Create a BOM:
    - set the quantity of the finished product and component as more than 1
    - save > print > BOM Structure

Problem:
The report generated shows the qty and cost for production of 1 unit of product, regardless of the BOM quantity

opw-2691632

closes odoo/odoo#80145

X-original-commit: d08b0abd56a04a23e155b345bf1796a031321f2f
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
This commit is contained in:
Touati Djamel (otd)
2021-11-22 07:49:55 +00:00
parent 1132e2b395
commit 5646476dbf
@@ -16,7 +16,7 @@ class ReportBomStructure(models.AbstractModel):
bom = self.env['mrp.bom'].browse(bom_id)
variant = data.get('variant')
candidates = variant and self.env['product.product'].browse(variant) or bom.product_id or bom.product_tmpl_id.product_variant_ids
quantity = float(data.get('quantity', 1))
quantity = float(data.get('quantity', bom.product_qty))
for product_variant_id in candidates.ids:
if data and data.get('childs'):
doc = self._get_pdf_line(bom_id, product_id=product_variant_id, qty=quantity, child_bom_ids=set(json.loads(data.get('childs'))))