diff --git a/frontend/app/components/api/api-v3/hal-resources/work-package-resource.service.ts b/frontend/app/components/api/api-v3/hal-resources/work-package-resource.service.ts index b613ef39dd..0272fcb4e2 100644 --- a/frontend/app/components/api/api-v3/hal-resources/work-package-resource.service.ts +++ b/frontend/app/components/api/api-v3/hal-resources/work-package-resource.service.ts @@ -124,6 +124,7 @@ export class WorkPackageResource extends HalResource { public attachments:AttachmentCollectionResourceInterface; public pendingAttachments:UploadFile[] = []; + public overriddenSchema?:SchemaResource; public get id():string { return this.$source.id || this.idFromLink; diff --git a/frontend/app/components/wp-edit-form/work-package-changeset.ts b/frontend/app/components/wp-edit-form/work-package-changeset.ts index 3ec37fbd35..5e588f9b2d 100644 --- a/frontend/app/components/wp-edit-form/work-package-changeset.ts +++ b/frontend/app/components/wp-edit-form/work-package-changeset.ts @@ -61,9 +61,14 @@ export class WorkPackageChangeset { 'wpCacheService', 'wpCreate' ); - // Start with a resource from the current work package knowledge. - const payload = this.mergeWithPayload(workPackage.$plain); - this.buildResource(payload); + if (this.workPackage.isNew) { + // New work packages have no schema set yet, so update the form immediately to get one + this.updateForm(); + } else { + // Start with a resource from the current work package knowledge. + const payload = this.mergeWithPayload(workPackage.$plain); + this.buildResource(payload); + } } public startEditing(key:string) { @@ -185,6 +190,7 @@ export class WorkPackageChangeset { this.workPackage.updateActivities(); if (wasNew) { + this.workPackage.overriddenSchema = undefined; this.workPackage.uploadAttachmentsAndReload(); this.wpCreate.newWorkPackageCreated(this.workPackage); }