[FIX] mrp: PDF of BoM structure

- Create the following BOM for 1 Unit of A:
  B: 55 Units
- Create the following BOM for 728 Units of B:
  C: 1 Unit
- Create the following BOM for 1 Unit of C:
  D: 728 Units
- Go to 'BoM Structure & Cost' of A:
  A: 1 Unit
     B: 55 Units
        C: 0.0755 Units
           D: 58.24 Units
- Print Unfolded:
  A: 1 Unit
     B: 55 Units
        C: 0.0755 Units
           D: 40040 Units

The unfolded PDF structure is incorrect.

The reference quantity taken into account to compute the BoM subline
should be the quantity on the line, not the quantity on the parent line.

opw-1915546

closes odoo/odoo#30726
This commit is contained in:
Nicolas Martinelli
2019-01-31 12:03:44 +00:00
parent cb8fefa899
commit 85ada6ff6d
@@ -225,7 +225,7 @@ class ReportBomStructure(models.AbstractModel):
})
if bom_line['child_bom'] and (unfolded or bom_line['child_bom'] in child_bom_ids):
line = self.env['mrp.bom.line'].browse(bom_line['line_id'])
lines += (get_sub_lines(line.child_bom_id, line.product_id, line.product_qty * data['bom_qty'], line, level + 1))
lines += (get_sub_lines(line.child_bom_id, line.product_id, bom_line['prod_qty'], line, level + 1))
if data['operations']:
lines.append({
'name': _('Operations'),