diff --git a/app/services/repository_datatable_service.rb b/app/services/repository_datatable_service.rb index dc4a834b1..ac47b2365 100644 --- a/app/services/repository_datatable_service.rb +++ b/app/services/repository_datatable_service.rb @@ -57,7 +57,7 @@ class RepositoryDatatableService .where(my_module_repository_rows: { my_module_id: @my_module }) if @repository.has_stock_management? repository_rows = repository_rows - .select('SUM(my_module_repository_rows.stock_consumption) AS "consumed_stock"') + .select('SUM(DISTINCT my_module_repository_rows.stock_consumption) AS "consumed_stock"') end else repository_rows = repository_rows