diff --git a/addons/stock/report/report_stock_forecasted.py b/addons/stock/report/report_stock_forecasted.py
index f9ffe29e46c..bb4dcc5c9a6 100644
--- a/addons/stock/report/report_stock_forecasted.py
+++ b/addons/stock/report/report_stock_forecasted.py
@@ -109,7 +109,7 @@ class ReplenishmentReport(models.AbstractModel):
res['lines'] = self._get_report_lines(product_template_ids, product_variant_ids, wh_location_ids)
return res
- def _prepare_report_line(self, quantity, move_out=None, move_in=None, replenishment_filled=True, product=False):
+ def _prepare_report_line(self, quantity, move_out=None, move_in=None, replenishment_filled=True, product=False, reservation=False):
timezone = self._context.get('tz')
product = product or (move_out.product_id if move_out else move_in.product_id)
is_late = move_out.date < move_in.date if (move_out and move_in) else False
@@ -128,6 +128,7 @@ class ReplenishmentReport(models.AbstractModel):
'quantity': quantity,
'move_out': move_out,
'move_in': move_in,
+ 'reservation': reservation,
}
def _get_report_lines(self, product_template_ids, product_variant_ids, wh_location_ids):
@@ -146,10 +147,21 @@ class ReplenishmentReport(models.AbstractModel):
lines = []
for product in (ins | outs).product_id:
+ for out in outs_per_product[product.id]:
+ if out.state not in ('partially_available', 'assigned'):
+ continue
+ current = currents[out.product_id.id]
+ reserved = out.product_uom._compute_quantity(out.reserved_availability, product.uom_id)
+ currents[product.id] -= reserved
+ lines.append(self._prepare_report_line(reserved, move_out=out, reservation=True))
+
for out in outs_per_product[product.id]:
# Reconcile with the current stock.
current = currents[out.product_id.id]
- demand = out.product_qty
+ reserved = 0.0
+ if out.state in ('partially_available', 'assigned'):
+ reserved = out.product_uom._compute_quantity(out.reserved_availability, product.uom_id)
+ demand = out.product_qty - reserved
taken_from_stock = min(demand, current)
if not float_is_zero(taken_from_stock, precision_rounding=product.uom_id.rounding):
currents[product.id] -= taken_from_stock
diff --git a/addons/stock/report/report_stock_forecasted.xml b/addons/stock/report/report_stock_forecasted.xml
index 0bbe734791b..61748f6c020 100644
--- a/addons/stock/report/report_stock_forecasted.xml
+++ b/addons/stock/report/report_stock_forecasted.xml
@@ -117,6 +117,9 @@
class="font-weight-bold" view-type="form"
t-att-res-model="line['document_in']._name"
t-att-res-id="line['document_in'].id"/>
+
+ Reserved from stock
+
Inventory On Hand
Free Stock