From e853fe33b1564706e2031031996c4fbf1ddb7a12 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Mon, 29 Jul 2024 17:24:25 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20gen=5Fmaterial=5Fout=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=B9=B6=E5=8F=98=E6=9B=B4=E7=89=A9=E6=96=99=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/mtm/serializers.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/mtm/serializers.py b/apps/mtm/serializers.py index a26fb98a..0af18d05 100644 --- a/apps/mtm/serializers.py +++ b/apps/mtm/serializers.py @@ -181,6 +181,10 @@ class RouteSerializer(CustomModelSerializer): material_out = Material.objects.get_queryset(all=True).filter(type=Material.MA_TYPE_HALFGOOD, parent=material, process=process).first() if material_out: material_out.is_deleted = False + if material_out.parent == material: + material_out.name = material.name + material_out.model = material.model + material_out.specification = material.specification material_out.save() instance.material_out = material_out instance.save() @@ -188,6 +192,8 @@ class RouteSerializer(CustomModelSerializer): material_out = Material.objects.get_queryset(all=True).filter(name=material.name, model=material.model, process=process, specification=material.specification).first() if material_out: material_out.is_deleted = False + if material_out.parent is None: + material_out.parent = material material_out.save() instance.material_out = material_out instance.save()