diff --git a/hb_server/apps/inm/signals.py b/hb_server/apps/inm/signals.py index 26809eb..bbc9ec3 100644 --- a/hb_server/apps/inm/signals.py +++ b/hb_server/apps/inm/signals.py @@ -5,14 +5,14 @@ from apps.inm.models import FIFODetail, Inventory, MaterialBatch @receiver(post_save, sender=FIFODetail) -def create_user(sender, instance, created, **kwargs): +def update_by_fifodetail(sender, instance, created, **kwargs): if created: fifo = instance.fifo material = instance.material warehouse = fifo.warehouse if fifo.type in [3]: # 采购入库 # 更新相关表 - o1 = Inventory.objects.get_or_create(material=material, warehouse=warehouse, \ + o1, _ = Inventory.objects.get_or_create(material=material, warehouse=warehouse, \ defaults={'material':material, 'warehouse':warehouse, 'count':0}) o1.count = o1.count + instance.count o1.save()