Merge branch 'develop' of https://e.coding.net/ctcdevteam/hberp/hberp into develop
This commit is contained in:
commit
dbe37339fb
|
@ -192,7 +192,7 @@ class FIFOInPurSerializer(serializers.ModelSerializer):
|
|||
|
||||
def create(self, validated_data):
|
||||
pu_order = validated_data['pu_order']
|
||||
if pu_order.is_audited:
|
||||
if not pu_order.is_audited:
|
||||
raise ValidationError('该采购订单未审核')
|
||||
validated_data['vendor'] = pu_order.vendor
|
||||
validated_data['number'] = 'RK' + ranstr(7)
|
||||
|
|
|
@ -25,10 +25,11 @@ class InmService:
|
|||
|
||||
iv, _= Inventory.objects.get_or_create(material=material, warehouse=warehouse, \
|
||||
defaults={'material':material, 'warehouse':warehouse, 'count':0})
|
||||
iv.count = MaterialBatch.objects.filter(material=material, warehouse=warehouse).count()
|
||||
iv.count = MaterialBatch.objects.filter(material=material,
|
||||
warehouse=warehouse).aggregate(total=Sum('count')).get('total', 0)
|
||||
iv.save()
|
||||
|
||||
material.count = MaterialBatch.objects.filter(material=material).count()
|
||||
material.count = MaterialBatch.objects.filter(material=material).aggregate(total=Sum('count')).get('total', 0)
|
||||
material.save()
|
||||
|
||||
# 创建IProduct
|
||||
|
@ -66,10 +67,12 @@ class InmService:
|
|||
mb.save()
|
||||
|
||||
iv = Inventory.objects.get(material=material, warehouse=warehouse)
|
||||
iv.count = MaterialBatch.objects.filter(material=material, warehouse=warehouse).count()
|
||||
iv.count = MaterialBatch.objects.filter(material=material,
|
||||
warehouse=warehouse).aggregate(total=Sum('count')).get('total', 0)
|
||||
iv.save()
|
||||
|
||||
material.count = MaterialBatch.objects.filter(material=material).count()
|
||||
material.count = MaterialBatch.objects.filter(material=
|
||||
material).aggregate(total=Sum('count')).get('total', 0)
|
||||
material.save()
|
||||
|
||||
# 删除IProduct
|
||||
|
|
Loading…
Reference in New Issue