diff --git a/sf_demand_plan/__manifest__.py b/sf_demand_plan/__manifest__.py index 474c1608..ac9c6106 100644 --- a/sf_demand_plan/__manifest__.py +++ b/sf_demand_plan/__manifest__.py @@ -10,7 +10,7 @@ """, 'category': 'sf', 'website': 'https://www.sf.jikimo.com', - 'depends': ['sf_plan','jikimo_printing'], + 'depends': ['sf_plan'], 'data': [ 'security/ir.model.access.csv', 'data/stock_route_group.xml', diff --git a/sf_demand_plan/models/sf_production_demand_plan.py b/sf_demand_plan/models/sf_production_demand_plan.py index 9f5d17f4..d0005ca0 100644 --- a/sf_demand_plan/models/sf_production_demand_plan.py +++ b/sf_demand_plan/models/sf_production_demand_plan.py @@ -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: