diff options
Diffstat (limited to 'addons/sale_mrp')
| -rw-r--r-- | addons/sale_mrp/models/sale.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/addons/sale_mrp/models/sale.py b/addons/sale_mrp/models/sale.py index 22894b08b30..8e1c9704287 100644 --- a/addons/sale_mrp/models/sale.py +++ b/addons/sale_mrp/models/sale.py @@ -46,6 +46,18 @@ class SaleOrderLine(models.Model): """The inventory widget should now be visible in more cases if the product is consumable.""" super(SaleOrderLine, self)._compute_qty_to_deliver() for line in self: + # Hide the widget for kits since forecast doesn't support them. + boms = self.env['mrp.bom'] + if line.state == 'sale': + boms = line.move_ids.mapped('bom_line_id.bom_id') + elif line.state in ['draft', 'sent'] and line.product_id: + boms = boms._bom_find(product=line.product_id, company_id=line.company_id.id, bom_type='phantom') + relevant_bom = boms.filtered(lambda b: b.type == 'phantom' and + (b.product_id == line.product_id or + (b.product_tmpl_id == line.product_id.product_tmpl_id and not b.product_id))) + if relevant_bom: + line.display_qty_widget = False + continue if line.state == 'draft' and line.product_type == 'consu': components = line.product_id.get_components() if components and components != [line.product_id.id]: |
