From ac0966f3bf790f3c53439650ba64ea957790a447 Mon Sep 17 00:00:00 2001 From: guanhuan Date: Thu, 10 Jul 2025 14:20:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=BD=90=E5=A5=97=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E4=BA=A7=E5=93=81=E5=88=B6=E9=80=A0=E5=AE=8C=E6=88=90?= =?UTF-8?q?,=E5=9D=AF=E6=96=99=E7=9A=84=E7=8A=B6=E6=80=81=E5=8F=88?= =?UTF-8?q?=E5=8F=98=E6=88=90=E4=BA=86=E6=9C=AA=E9=BD=90=E5=A5=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_demand_plan/__manifest__.py | 2 +- sf_demand_plan/models/sf_production_demand_plan.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) 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: