diff --git a/addons/stock/models/stock_orderpoint.py b/addons/stock/models/stock_orderpoint.py index c975fd4b2c4..28890671c27 100644 --- a/addons/stock/models/stock_orderpoint.py +++ b/addons/stock/models/stock_orderpoint.py @@ -345,7 +345,7 @@ class StockWarehouseOrderpoint(models.Model): orderpoints = orderpoints - orderpoints_removed to_refill = defaultdict(float) all_product_ids = self._get_orderpoint_products() - all_replenish_location_ids = self.env['stock.location'].search([('replenish_location', '=', True)]) + all_replenish_location_ids = self._get_orderpoint_locations() ploc_per_day = defaultdict(set) # For each replenish location get products with negative virtual_available aka forecast for loc in all_replenish_location_ids: @@ -585,3 +585,6 @@ class StockWarehouseOrderpoint(models.Model): def _get_orderpoint_products(self): return self.env['product.product'].search([('type', '=', 'product'), ('stock_move_ids', '!=', False)]) + + def _get_orderpoint_locations(self): + return self.env['stock.location'].search([('replenish_location', '=', True)])