diff --git a/stock_inventory/models/stock_inventory.py b/stock_inventory/models/stock_inventory.py
index 113f8c9de..54c73d3f8 100644
--- a/stock_inventory/models/stock_inventory.py
+++ b/stock_inventory/models/stock_inventory.py
@@ -256,19 +256,28 @@ class InventoryAdjustmentsGroup(models.Model):
search_filter.append(("product_id", "in", self.product_ids.ids))
error_field = "product_id"
error_message = _(
- "There are active adjustments for the requested products: %s"
+ "There are active adjustments for the requested products: %(names)s. "
+ "Blocking adjustments: %(blocking_names)s"
)
else:
error_field = "location_id"
error_message = _(
- "There's already an Adjustment in Process using one "
- "requested Location: %s"
+ "There's already an Adjustment in Process "
+ "using one requested Location: %(names)s. "
+ "Blocking adjustments: %(blocking_names)s"
)
quants = self.env["stock.quant"].search(search_filter)
if quants:
- names = self._get_quant_joined_names(quants, error_field)
- raise ValidationError(error_message % names)
+ inventory_ids = self.env["stock.inventory"].search(
+ [("stock_quant_ids", "in", quants.ids), ("state", "=", "in_progress")]
+ )
+ if inventory_ids:
+ blocking_names = ", ".join(inventory_ids.mapped("name"))
+ names = self._get_quant_joined_names(quants, error_field)
+ raise ValidationError(
+ error_message % {"names": names, "blocking_names": blocking_names}
+ )
quants = self._get_quants(self.location_ids)
self.write(
diff --git a/stock_inventory/views/stock_inventory.xml b/stock_inventory/views/stock_inventory.xml
index 2b0de4382..b94e1ca2d 100644
--- a/stock_inventory/views/stock_inventory.xml
+++ b/stock_inventory/views/stock_inventory.xml
@@ -175,6 +175,7 @@
+