diff --git a/app/services/projects/copy_service.rb b/app/services/projects/copy_service.rb index 1f62f8ad766..a69e98441ec 100644 --- a/app/services/projects/copy_service.rb +++ b/app/services/projects/copy_service.rb @@ -126,7 +126,7 @@ module Projects end def skipped_attributes - %w[id created_at updated_at name identifier active templated lft rgt] + %w[id created_at updated_at name identifier active templated lft rgt wp_sequence_counter] end def source_attributes diff --git a/spec/services/projects/copy_service_integration_spec.rb b/spec/services/projects/copy_service_integration_spec.rb index 94e427e2825..4ab88821438 100644 --- a/spec/services/projects/copy_service_integration_spec.rb +++ b/spec/services/projects/copy_service_integration_spec.rb @@ -381,6 +381,18 @@ RSpec.describe( end end + context "when source project has a non-zero wp_sequence_counter", + with_settings: { work_packages_identifier: "semantic" } do + before do + source.update_column(:wp_sequence_counter, 5) + end + + it "succeeds and resets wp_sequence_counter to 0 on the copy" do + expect(subject).to be_success + expect(project_copy.wp_sequence_counter).to eq(0) + end + end + context "with all modules selected" do let(:only_args) { all_modules } let(:storage1) { source_automatic_project_storage.storage }