From ac47dcf0a5d111541ccefa8ef94971b273173380 Mon Sep 17 00:00:00 2001 From: Giga Chubinidze Date: Fri, 8 Mar 2024 18:33:13 +0400 Subject: [PATCH] Inventory duplicating removes old inventory stock units [SCI-10251] --- app/controllers/repositories_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index e5085d7a2..55ed0e2be 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -240,7 +240,10 @@ class RepositoriesController < ApplicationController copied_repo_stock_column = copied_repository.repository_columns.find_by(data_type: 'RepositoryStockValue') if old_repo_stock_column && copied_repo_stock_column - copied_repo_stock_column.repository_stock_unit_items = old_repo_stock_column.repository_stock_unit_items + old_repo_stock_column.repository_stock_unit_items.each do |item| + copied_item = item.dup + copied_repo_stock_column.repository_stock_unit_items << copied_item + end copied_repository.save! end