[FIX] mrp: fix BoM Structure & Cost Report print
Create some attributes with "create dynamically" set Create a product template using these attributes (=> product variants should not be created) Set this product as manufactured, and create an associated BOM with some components Try to print the BOM User will face a traceback due to the product_id being non existant opw-2283649 closes odoo/odoo#53872 X-original-commit: 4d77ada68fb4d8113a5fbf95f20ccb49d0611fc5 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
@@ -208,8 +208,6 @@ class ReportBomStructure(models.AbstractModel):
|
||||
|
||||
def _get_pdf_line(self, bom_id, product_id=False, qty=1, child_bom_ids=[], unfolded=False):
|
||||
|
||||
data = self._get_bom(bom_id=bom_id, product_id=product_id.id, line_qty=qty)
|
||||
|
||||
def get_sub_lines(bom, product_id, line_qty, line_id, level):
|
||||
data = self._get_bom(bom_id=bom.id, product_id=product_id.id, line_qty=line_qty, line_id=line_id, level=level)
|
||||
bom_lines = data['components']
|
||||
@@ -253,6 +251,7 @@ class ReportBomStructure(models.AbstractModel):
|
||||
|
||||
bom = self.env['mrp.bom'].browse(bom_id)
|
||||
product = product_id or bom.product_id or bom.product_tmpl_id.product_variant_id
|
||||
data = self._get_bom(bom_id=bom_id, product_id=product.id, line_qty=qty)
|
||||
pdf_lines = get_sub_lines(bom, product, qty, False, 1)
|
||||
data['components'] = []
|
||||
data['lines'] = pdf_lines
|
||||
|
||||
Reference in New Issue
Block a user