Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.
Module: Inventory
Entity: stock.warehouse.orderpoint
Compute Method: _compute_qty_to_order
| Inputs | Method | Outputs |
|---|---|---|
|
for orderpoint in self: - if not orderpoint.product_id or not orderpoint.location_id: - orderpoint.qty_to_order = False - continue - qty_to_order = 0.0 - rounding = orderpoint.product_uom.rounding - # The check is on purpose. We only want to consider the visibility days if the forecast is negative and - # there is a already something to ressuply base on lead times. - if float_compare(orderpoint.qty_forecast, orderpoint.product_min_qty, precision_rounding=rounding) < 0: - # We want to know how much we should order to also satisfy the needs that gonna appear in the next (visibility) days - product_context = orderpoint._get_product_context(visibility_days=orderpoint.visibility_days) - qty_forecast_with_visibility = orderpoint.product_id.with_context(product_context).read(['virtual_available'])[0]['virtual_available'] + orderpoint._quantity_in_progress()[orderpoint.id] - qty_to_order = max(orderpoint.product_min_qty, orderpoint.product_max_qty) - qty_forecast_with_visibility - remainder = orderpoint.qty_multiple > 0.0 and qty_to_order % orderpoint.qty_multiple or 0.0 - if (float_compare(remainder, 0.0, precision_rounding=rounding) > 0 - and float_compare(orderpoint.qty_multiple - remainder, 0.0, precision_rounding=rounding) > 0): - qty_to_order += orderpoint.qty_multiple - remainder - orderpoint.qty_to_order = qty_to_order + orderpoint.qty_to_order = orderpoint.qty_to_order_manual if orderpoint.qty_to_order_manual else orderpoint.qty_to_order_computed |
|
