-
Notifications
You must be signed in to change notification settings - Fork 2.9k
[#68705] When project is copied, work packages with empty mandatory custom fields are not copied #20957
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
toy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to change the copy project succeeds with errors to fail for some other reason (for example create(:work_package, :skip_validations, subject: "", …) to keep the error test and localised error test, and add a separate test that doesn't fail for required custom field.
6d08938 to
a25c708
Compare
| type.custom_fields << custom_field | ||
| end | ||
|
|
||
| it "copies the project", :aggregate_failures do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be a check that work package copying failed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The work package copying should succeed even if the work package is invalid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The work package, not project
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The work package also.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understood that when copying a project and one of the work packages fails to be copied, it does copy the project, doesn't copy problematic work packages and reports errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is true only in certain cases, ie. if the validation fails on the work package contract, then the error is reported and the problematic work package is not copied.
However the validations on the work package model itself are skipped (due to the def validate_model? = false). Since the custom fields are validated on the model level, they are skipped too, thus the work package copying will succeed.
Ticket
https://community.openproject.org/work_packages/68705
What are you trying to accomplish?
Bypass work package custom field validation when copying projects.
What approach did you choose and why?
Disable model validation in the
WorkPackage::CopyProjectContract.Merge checklist