mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-15 19:45:46 +00:00
More test
This commit is contained in:
@ -265,17 +265,9 @@ class Part(models.Model):
|
||||
|
||||
def set_category(self, category):
|
||||
|
||||
if not type(category) == PartCategory:
|
||||
raise ValidationError({
|
||||
'category': _('Invalid object supplied to part.set_category')
|
||||
})
|
||||
|
||||
try:
|
||||
# Already in this category!
|
||||
if category == self.category:
|
||||
return
|
||||
except PartCategory.DoesNotExist:
|
||||
pass
|
||||
# Ignore if the category is already the same
|
||||
if self.category == category:
|
||||
return
|
||||
|
||||
self.category = category
|
||||
self.save()
|
||||
|
Reference in New Issue
Block a user