|
|
@@ -572,9 +572,11 @@ class AbstractProduct(models.Model):
|
|
572
|
572
|
"""
|
|
573
|
573
|
Validates a child product
|
|
574
|
574
|
"""
|
|
575
|
|
- if not self.parent_id:
|
|
|
575
|
+ has_parent = self.parent or self.parent_id
|
|
|
576
|
+
|
|
|
577
|
+ if not has_parent:
|
|
576
|
578
|
raise ValidationError(_("A child product needs a parent."))
|
|
577
|
|
- if self.parent_id and not self.parent.is_parent:
|
|
|
579
|
+ if has_parent and not self.parent.is_parent:
|
|
578
|
580
|
raise ValidationError(
|
|
579
|
581
|
_("You can only assign child products to parent products.")
|
|
580
|
582
|
)
|