fix: handover submit need_add

This commit is contained in:
caoqianming 2024-09-06 10:01:47 +08:00
parent ee89b0bded
commit b6b72b2826
1 changed files with 19 additions and 19 deletions

View File

@ -566,7 +566,6 @@ def handover_submit(handover: Handover, user: User, now: Union[datetime.datetime
material = handover.material material = handover.material
if '混料' in material.name: # hard code if '混料' in material.name: # hard code
need_add = False need_add = False
if need_add:
if handoverb_qs.exists(): if handoverb_qs.exists():
handoverb_list = [(item.wm, item.count) for item in handoverb_qs] handoverb_list = [(item.wm, item.count) for item in handoverb_qs]
else: else:
@ -586,6 +585,7 @@ def handover_submit(handover: Handover, user: User, now: Union[datetime.datetime
else: else:
wm_from.count = count_x wm_from.count = count_x
wm_from.save() wm_from.save()
if need_add:
# 开始变动 # 开始变动
if handover.type == Handover.H_NORMAL: if handover.type == Handover.H_NORMAL:
wm_to, _ = WMaterial.objects.get_or_create( wm_to, _ = WMaterial.objects.get_or_create(