mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 04:26:44 +00:00
Catch recursive tree error for part / variant relationship
This commit is contained in:
parent
dad9239a1c
commit
df48df8119
@ -27,6 +27,7 @@ from markdownx.models import MarkdownxField
|
|||||||
from django_cleanup import cleanup
|
from django_cleanup import cleanup
|
||||||
|
|
||||||
from mptt.models import TreeForeignKey, MPTTModel
|
from mptt.models import TreeForeignKey, MPTTModel
|
||||||
|
from mptt.exceptions import InvalidMove
|
||||||
from mptt.managers import TreeManager
|
from mptt.managers import TreeManager
|
||||||
|
|
||||||
from stdimage.models import StdImageField
|
from stdimage.models import StdImageField
|
||||||
@ -426,7 +427,12 @@ class Part(MPTTModel):
|
|||||||
|
|
||||||
self.full_clean()
|
self.full_clean()
|
||||||
|
|
||||||
|
try:
|
||||||
super().save(*args, **kwargs)
|
super().save(*args, **kwargs)
|
||||||
|
except InvalidMove:
|
||||||
|
raise ValidationError({
|
||||||
|
'variant_of': _('Invalid choice for parent part'),
|
||||||
|
})
|
||||||
|
|
||||||
if add_category_templates:
|
if add_category_templates:
|
||||||
# Get part category
|
# Get part category
|
||||||
|
@ -350,6 +350,12 @@ function constructFormBody(fields, options) {
|
|||||||
for(field in fields) {
|
for(field in fields) {
|
||||||
fields[field].name = field;
|
fields[field].name = field;
|
||||||
|
|
||||||
|
|
||||||
|
// If any "instance_filters" are defined for the endpoint, copy them across (overwrite)
|
||||||
|
if (fields[field].instance_filters) {
|
||||||
|
fields[field].filters = Object.assign(fields[field].filters || {}, fields[field].instance_filters);
|
||||||
|
}
|
||||||
|
|
||||||
var field_options = displayed_fields[field];
|
var field_options = displayed_fields[field];
|
||||||
|
|
||||||
// Copy custom options across to the fields object
|
// Copy custom options across to the fields object
|
||||||
|
Loading…
x
Reference in New Issue
Block a user