2
0
mirror of https://github.com/inventree/InvenTree.git synced 2026-04-06 11:31:04 +00:00

Updates to part revision support (#11670)

* Update revision validation

* Refactor UI display

* Fix for usePartFields

* Rearrange part settings

* Better visuals

* Update docs

* use 'full_name' field

* Update playwright tests

* Adjust unit test

* Fix playwright tests
This commit is contained in:
Oliver
2026-04-04 00:10:25 +11:00
committed by GitHub
parent 9c1d8c1b1d
commit bb3293ef31
7 changed files with 73 additions and 113 deletions

View File

@@ -776,18 +776,12 @@ class Part(
'revision_of': _('Part cannot be a revision of itself')
})
# Part cannot be a revision of a part which is itself a revision
if self.revision_of.revision_of:
raise ValidationError({
'revision_of': _(
'Cannot make a revision of a part which is already a revision'
)
})
# If this part is a revision, it must have a revision code
if not self.revision:
raise ValidationError({
'revision': _('Revision code must be specified')
'revision': _(
'Revision code must be specified for a part marked as a revision'
)
})
if get_global_setting('PART_REVISION_ASSEMBLY_ONLY'):

View File

@@ -412,15 +412,11 @@ class PartTest(TestCase):
name='Master Part', description='Master part (revision B)'
)
with self.assertRaises(ValidationError) as exc:
rev_b.revision_of = rev_a
rev_b.revision = 'B'
rev_b.save()
self.assertIn(
'Cannot make a revision of a part which is already a revision',
str(exc.exception),
)
# Ensure we can make a revision of a revision
rev_b.revision_of = rev_a
rev_b.variant_of = template
rev_b.revision = 'B'
rev_b.save()
rev_b.variant_of = template
rev_b.revision_of = part