修复齐套检查产品制造完成,坯料的状态又变成了未齐套

This commit is contained in:
guanhuan
2025-07-10 14:20:15 +08:00
parent 1f93ba3b42
commit ac0966f3bf
2 changed files with 7 additions and 2 deletions

View File

@@ -282,9 +282,14 @@ class SfProductionDemandPlan(models.Model):
def _compute_material_check(self):
for record in self:
if record.mrp_production_ids and record.mrp_production_ids.move_raw_ids:
# 获取完成的制造订单
done_manufacturing = record.mrp_production_ids.filtered(lambda mo: mo.state == 'done')
product_qty = sum(done_manufacturing.mapped('product_qty'))
# 需求数量-完成数量
product_uom_qty = record.plan_uom_qty - product_qty
total_reserved_availability = sum(
record.mrp_production_ids.mapped('move_raw_ids.reserved_availability'))
if float_compare(total_reserved_availability, record.plan_uom_qty,
if float_compare(total_reserved_availability, product_uom_qty,
precision_rounding=record.product_id.uom_id.rounding) >= 0:
record.material_check = '1' # 已齐套
else: