mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 12:06:44 +00:00
Merge pull request #2978 from SchrodingersGat/convert-to-variant-fix
Convert to variant fix
This commit is contained in:
commit
a68db90240
@ -2233,7 +2233,7 @@ class Part(MPTTModel):
|
|||||||
for child in children:
|
for child in children:
|
||||||
parts.append(child)
|
parts.append(child)
|
||||||
|
|
||||||
# Immediate parent
|
# Immediate parent, and siblings
|
||||||
if self.variant_of:
|
if self.variant_of:
|
||||||
parts.append(self.variant_of)
|
parts.append(self.variant_of)
|
||||||
|
|
||||||
|
@ -556,7 +556,14 @@ class StockItem(MPTTModel):
|
|||||||
|
|
||||||
# If the item points to a build, check that the Part references match
|
# If the item points to a build, check that the Part references match
|
||||||
if self.build:
|
if self.build:
|
||||||
if not self.part == self.build.part:
|
|
||||||
|
if self.part == self.build.part:
|
||||||
|
# Part references match exactly
|
||||||
|
pass
|
||||||
|
elif self.part in self.build.part.get_conversion_options():
|
||||||
|
# Part reference is one of the valid conversion options for the build output
|
||||||
|
pass
|
||||||
|
else:
|
||||||
raise ValidationError({
|
raise ValidationError({
|
||||||
'build': _("Build reference does not point to the same part object")
|
'build': _("Build reference does not point to the same part object")
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user