Merge pull request #7242 from G-Chubinidze/gc_SCI_10251_v2

Inventory duplicating removes old inventory stock units [SCI-10251]
This commit is contained in:
ajugo 2024-03-08 16:27:32 +01:00 committed by GitHub
commit e7bd0d5764
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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