Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Purchase Stock

Entity: purchase.order.line

Compute Method: _compute_forecasted_issue

Inputs Method Outputs
  • order_id
  • product_id
  • date_planned
  • state
  • product_uom_qty
for line in self:
            warehouse = line.order_id.sudo().picking_type_id.warehouse_id  # sudo() in case of multi-company
            line.forecasted_issue = False
            if line.product_id:
                virtual_available = line.product_id.sudo().with_context(warehouse_id=warehouse.id, to_date=line.date_planned).virtual_available
                if line.state == 'draft':
                    virtual_available += line.product_uom_qty
                if virtual_available < 0:
                    line.forecasted_issue = True

Back to entity