diff --git a/addons/stock/models/stock_move.py b/addons/stock/models/stock_move.py index 363687d6f3d..54b398dae7b 100644 --- a/addons/stock/models/stock_move.py +++ b/addons/stock/models/stock_move.py @@ -431,8 +431,8 @@ class StockMove(models.Model): [('id', 'child_of', warehouse.view_location_id.id)], ['id'], )] - forecast_lines = self.env['report.stock.report_product_product_replenishment']\ - ._get_report_lines(None, product_variant_ids, wh_location_ids) + ForecastedReport = self.env['report.stock.report_product_product_replenishment'] + forecast_lines = ForecastedReport.with_context(warehouse=warehouse.id)._get_report_lines(None, product_variant_ids, wh_location_ids) for move in moves: lines = [l for l in forecast_lines if l["move_out"] == move._origin and l["replenishment_filled"] is True] if lines: diff --git a/addons/stock/report/report_stock_forecasted.py b/addons/stock/report/report_stock_forecasted.py index 88576a58035..47d7be945b1 100644 --- a/addons/stock/report/report_stock_forecasted.py +++ b/addons/stock/report/report_stock_forecasted.py @@ -144,7 +144,7 @@ class ReplenishmentReport(models.AbstractModel): ins_per_product = defaultdict(lambda: []) for in_ in ins: ins_per_product[in_.product_id.id].append([in_.product_qty, in_]) - currents = {c['id']: c['qty_available'] for c in outs.product_id.with_context(location=wh_location_ids).read(['qty_available'])} + currents = {c['id']: c['qty_available'] for c in outs.product_id.read(['qty_available'])} lines = [] for product in (ins | outs).product_id: