Copy notes (#5546)

* Add option to copy notes when duplicating a part

* Update front-end forms
This commit is contained in:
Oliver 2023-09-15 14:52:47 +10:00 committed by GitHub
parent 9deec91ec2
commit 17d227443d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -380,6 +380,11 @@ class DuplicatePartSerializer(serializers.Serializer):
required=False, default=False,
)
copy_notes = serializers.BooleanField(
label=_('Copy Notes'), help_text=_('Copy notes from original part'),
required=False, default=True,
)
class InitialStockSerializer(serializers.Serializer):
"""Serializer for creating initial stock quantity."""
@ -739,6 +744,10 @@ class PartSerializer(InvenTree.serializers.RemoteImageMixin, InvenTree.serialize
if duplicate['copy_bom']:
instance.copy_bom_from(original)
if duplicate['copy_notes']:
instance.notes = original.notes
instance.save()
if duplicate['copy_image']:
instance.image = original.image
instance.save()

View File

@ -275,6 +275,10 @@ function partFields(options={}) {
value: global_settings.PART_COPY_BOM,
};
fields.duplicate__copy_notes = {
value: true,
}
fields.duplicate__copy_parameters = {
value: global_settings.PART_COPY_PARAMETERS,
};