From dae6efa9a5d38589e5dd7265864a33c7c9f460d4 Mon Sep 17 00:00:00 2001
From: Nicolas Martinelli <nim@odoo.com>
Date: Fri, 1 Jun 2018 14:32:28 +0200
Subject: [PATCH] [FIX] stock: Stock Level Forecast

- Create the following BOM for Product A:
  Comp 1: 1 Unit(s)
  Comp 2: 5 Unit(s)
- Update on-hand quantity:
  Comp 1: 10 Unit(s)
  Comp 2: 30 Unit(s)
- Create a MO for 10 Unit(s) of A
- Check the Quantity on report 'Stock Level Forecast':
  Comp 1:   0 Unit(s)
  Comp 2: -20 Unit(s)
- 'Check Availability' on the MO
- Check the Quantity on report 'Stock Level Forecast':
  Comp 1:  0 Unit(s)
  Comp 2: 30 Unit(s)

The `partially_available` state has been added with Inventory
refactoring in v11, and needs to be taken into account.

opw-1849556
---
 addons/stock/report/report_stock_forecast.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/addons/stock/report/report_stock_forecast.py b/addons/stock/report/report_stock_forecast.py
index a6ecea78c6ba..de3846467ca8 100644
--- a/addons/stock/report/report_stock_forecast.py
+++ b/addons/stock/report/report_stock_forecast.py
@@ -61,7 +61,7 @@ class ReportStockForecat(models.Model):
             LEFT JOIN
             stock_location source_location ON sm.location_id = source_location.id
             WHERE
-            sm.state IN ('confirmed','assigned','waiting') and
+            sm.state IN ('confirmed','partially_available','assigned','waiting') and
             source_location.usage != 'internal' and dest_location.usage = 'internal'
             GROUP BY sm.date_expected,sm.product_id
             UNION ALL
@@ -82,7 +82,7 @@ class ReportStockForecat(models.Model):
             LEFT JOIN
                stock_location dest_location ON sm.location_dest_id = dest_location.id
             WHERE
-                sm.state IN ('confirmed','assigned','waiting') and
+                sm.state IN ('confirmed','partially_available','assigned','waiting') and
             source_location.usage = 'internal' and dest_location.usage != 'internal'
             GROUP BY sm.date_expected,sm.product_id)
          as MAIN
-- 
GitLab