fix: mlogbw delete bug

This commit is contained in:
caoqianming 2025-03-12 14:21:37 +08:00
parent 90e0e7ad3b
commit d847b84fd8
1 changed files with 4 additions and 3 deletions

View File

@ -800,10 +800,9 @@ class MlogbwViewSet(CustomModelViewSet):
if mlogb.material_out is not None and mlogb.wpr is not None: if mlogb.material_out is not None and mlogb.wpr is not None:
raise ParseError("不能删除该产出明细") raise ParseError("不能删除该产出明细")
ftest = instance.ftest ftest = instance.ftest
instance.delete()
if ftest: if ftest:
ftest.delete() ftest.delete()
Mlogbw.cal_count_notok(mlogb)
# 如果是输入且输出追踪到个,需同步删除 # 如果是输入且输出追踪到个,需同步删除
material_in: Material = mlogb.material_in material_in: Material = mlogb.material_in
if material_in is not None: if material_in is not None:
@ -812,4 +811,6 @@ class MlogbwViewSet(CustomModelViewSet):
if instance.mlogbw_to: if instance.mlogbw_to:
instance.mlogbw_to.delete() instance.mlogbw_to.delete()
instance.delete() instance.delete()
Mlogbw.cal_count_notok(mlogb) Mlogbw.cal_count_notok(instance.mlogbw_to.mlogb)
instance.delete()
Mlogbw.cal_count_notok(mlogb)