feat:出入库明细创建/导入时未传单价自动取物料主数据单价
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
3be0b09cd9
commit
fb5f1d072d
|
|
@ -184,6 +184,9 @@ class MIOItemCreateSerializer(CustomModelSerializer):
|
|||
|
||||
count = validated_data["count"]
|
||||
batch = validated_data["batch"]
|
||||
# 未给定单价时用物料主数据单价固化到明细上
|
||||
if validated_data.get('unit_price') is None and material.unit_price is not None:
|
||||
validated_data['unit_price'] = material.unit_price
|
||||
mioitemw = validated_data.pop('mioitemw', [])
|
||||
instance:MIOItem = super().create(validated_data)
|
||||
assemb_dict = {}
|
||||
|
|
|
|||
|
|
@ -170,7 +170,8 @@ def daoru_mioitems(path:str, mio:MIO):
|
|||
warehouse = WareHouse.objects.get(name=warehouse_name)
|
||||
except Exception as e:
|
||||
raise ParseError(f"未找到仓库:{warehouse_name} {e}")
|
||||
mioitems.append(MIOItem(mio=mio, warehouse=warehouse, material=material, batch=batch, count=count, id=idWorker.get_id()))
|
||||
mioitems.append(MIOItem(mio=mio, warehouse=warehouse, material=material, batch=batch, count=count,
|
||||
unit_price=material.unit_price, id=idWorker.get_id()))
|
||||
ind = ind + 1
|
||||
|
||||
MIOItem.objects.bulk_create(mioitems)
|
||||
Loading…
Reference in New Issue