采购入库bug
This commit is contained in:
parent
2999ebb5f0
commit
1ab3b4eb7a
|
@ -5,14 +5,14 @@ from apps.inm.models import FIFODetail, Inventory, MaterialBatch
|
||||||
|
|
||||||
|
|
||||||
@receiver(post_save, sender=FIFODetail)
|
@receiver(post_save, sender=FIFODetail)
|
||||||
def create_user(sender, instance, created, **kwargs):
|
def update_by_fifodetail(sender, instance, created, **kwargs):
|
||||||
if created:
|
if created:
|
||||||
fifo = instance.fifo
|
fifo = instance.fifo
|
||||||
material = instance.material
|
material = instance.material
|
||||||
warehouse = fifo.warehouse
|
warehouse = fifo.warehouse
|
||||||
if fifo.type in [3]: # 采购入库
|
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})
|
defaults={'material':material, 'warehouse':warehouse, 'count':0})
|
||||||
o1.count = o1.count + instance.count
|
o1.count = o1.count + instance.count
|
||||||
o1.save()
|
o1.save()
|
||||||
|
|
Loading…
Reference in New Issue