|
59 | 59 | from product_portfolio.importers import CodebaseResourceImporter |
60 | 60 | from product_portfolio.importers import ProductComponentImporter |
61 | 61 | from product_portfolio.importers import ProductPackageImporter |
| 62 | +from product_portfolio.importers import paused_product_package_reevaluation |
| 63 | +from product_portfolio.importers import reevaluate_products |
62 | 64 | from product_portfolio.inlines import CodebaseResourceUsageDeployedFromInline |
63 | 65 | from product_portfolio.inlines import CodebaseResourceUsageDeployedToInline |
64 | 66 | from product_portfolio.inlines import ProductComponentInline |
|
72 | 74 | from product_portfolio.models import ProductRelationStatus |
73 | 75 | from product_portfolio.models import ProductStatus |
74 | 76 | from reporting.filters import ReportingQueryListFilter |
| 77 | +from vulnerabilities.triage.models import ProductTriageRuleset |
75 | 78 |
|
76 | 79 |
|
77 | 80 | @admin.register(ProductStatus, site=dejacode_site) |
@@ -240,12 +243,14 @@ def save_model(self, request, obj, form, change): |
240 | 243 | if "_saveasnew" in request.POST: |
241 | 244 | old_product_id = request.resolver_match.kwargs.get("object_id") |
242 | 245 | old_product = self.get_object(request, old_product_id) |
243 | | - for model_class in [ProductComponent, ProductPackage]: |
244 | | - for relationship in model_class.objects.filter(product=old_product): |
245 | | - relationship.id = None |
246 | | - relationship.uuid = uuid.uuid4() |
247 | | - relationship.product = obj |
248 | | - relationship.save() |
| 246 | + with paused_product_package_reevaluation(): |
| 247 | + for model_class in [ProductComponent, ProductPackage, ProductTriageRuleset]: |
| 248 | + for relationship in model_class.objects.filter(product=old_product): |
| 249 | + relationship.id = None |
| 250 | + relationship.uuid = uuid.uuid4() |
| 251 | + relationship.product = obj |
| 252 | + relationship.save() |
| 253 | + reevaluate_products([obj]) |
249 | 254 |
|
250 | 255 | def get_obj_perms_user_select_form(self, request): |
251 | 256 | """ |
|
0 commit comments