需齐套检查修改
This commit is contained in:
@@ -278,9 +278,15 @@ class SfProductionDemandPlan(models.Model):
|
|||||||
if record.sale_order_id and record.sale_order_id.mrp_production_ids:
|
if record.sale_order_id and record.sale_order_id.mrp_production_ids:
|
||||||
manufacturing_orders = record.sale_order_id.mrp_production_ids.filtered(
|
manufacturing_orders = record.sale_order_id.mrp_production_ids.filtered(
|
||||||
lambda mo: mo.product_id == record.product_id)
|
lambda mo: mo.product_id == record.product_id)
|
||||||
|
|
||||||
if manufacturing_orders and manufacturing_orders.move_raw_ids:
|
if manufacturing_orders and manufacturing_orders.move_raw_ids:
|
||||||
|
# 获取完成的制造订单
|
||||||
|
done_manufacturing = manufacturing_orders.filtered(lambda mo: mo.state == 'done')
|
||||||
|
product_qty = sum(done_manufacturing.mapped('product_qty'))
|
||||||
|
# 需求数量-完成数量
|
||||||
|
product_uom_qty = record.product_uom_qty - product_qty
|
||||||
total_reserved_availability = sum(manufacturing_orders.mapped('move_raw_ids.reserved_availability'))
|
total_reserved_availability = sum(manufacturing_orders.mapped('move_raw_ids.reserved_availability'))
|
||||||
if float_compare(total_reserved_availability, record.product_uom_qty,
|
if float_compare(total_reserved_availability, product_uom_qty,
|
||||||
precision_rounding=record.product_id.uom_id.rounding) >= 0:
|
precision_rounding=record.product_id.uom_id.rounding) >= 0:
|
||||||
record.material_check = '1' # 已齐套
|
record.material_check = '1' # 已齐套
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user