From c2cb24c60b52f8eb6653649a61866562a83e0917 Mon Sep 17 00:00:00 2001 From: guanhuan Date: Wed, 9 Jul 2025 11:38:40 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9C=80=E6=B1=82=E8=AE=A1=E5=88=92=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_demand_plan/models/sf_demand_plan.py | 3 +-- sf_demand_plan/models/sf_production_demand_plan.py | 12 ++++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/sf_demand_plan/models/sf_demand_plan.py b/sf_demand_plan/models/sf_demand_plan.py index 63371dfd..83e890af 100644 --- a/sf_demand_plan/models/sf_demand_plan.py +++ b/sf_demand_plan/models/sf_demand_plan.py @@ -146,9 +146,8 @@ class SfDemandPlan(models.Model): for line in self: sum_plan_uom_qty = sum(line.line_ids.mapped('plan_uom_qty')) pending_qty = line.product_uom_qty - sum_plan_uom_qty - rounding = line.product_id.uom_id.rounding or 0.01 if float_compare(pending_qty, 0, - precision_rounding=rounding) == -1: + precision_rounding=line.product_id.uom_id.rounding) == -1: line.pending_qty = 0 else: line.pending_qty = pending_qty diff --git a/sf_demand_plan/models/sf_production_demand_plan.py b/sf_demand_plan/models/sf_production_demand_plan.py index a0b5bb92..4daa7ae3 100644 --- a/sf_demand_plan/models/sf_production_demand_plan.py +++ b/sf_demand_plan/models/sf_production_demand_plan.py @@ -28,10 +28,8 @@ class SfProductionDemandPlan(models.Model): ], string='状态', default='30', readonly=True) demand_plan_id = fields.Many2one(comodel_name="sf.demand.plan", string="物料需求", readonly=True) - sale_order_id = fields.Many2one(comodel_name="sale.order", related='demand_plan_id.sale_order_id', - string="销售订单", readonly=True) - sale_order_line_id = fields.Many2one(comodel_name="sale.order.line", related='demand_plan_id.sale_order_line_id', - string="销售订单明细", readonly=True) + sale_order_id = fields.Many2one(comodel_name="sale.order", string="销售订单", readonly=True) + sale_order_line_id = fields.Many2one(comodel_name="sale.order.line", string="销售订单明细", readonly=True) sale_order_line_number = fields.Char(string='销售订单行', compute='_compute_sale_order_line_number', store=True) company_id = fields.Many2one( related='sale_order_id.company_id', @@ -215,9 +213,8 @@ class SfProductionDemandPlan(models.Model): @api.depends('sale_order_line_id.qty_to_deliver') def _compute_qty_to_deliver(self): for line in self: - rounding = line.product_id.uom_id.rounding or 0.01 if float_compare(line.sale_order_line_id.qty_to_deliver, 0, - precision_rounding=rounding) == -1: + precision_rounding=line.product_id.uom_id.rounding) == -1: line.qty_to_deliver = 0 else: line.qty_to_deliver = line.sale_order_line_id.qty_to_deliver @@ -287,9 +284,8 @@ class SfProductionDemandPlan(models.Model): if record.mrp_production_ids and record.mrp_production_ids.move_raw_ids: total_reserved_availability = sum( record.mrp_production_ids.mapped('move_raw_ids.reserved_availability')) - rounding = record.product_id.uom_id.rounding or 0.01 if float_compare(total_reserved_availability, record.plan_uom_qty, - precision_rounding=rounding) >= 0: + precision_rounding=record.product_id.uom_id.rounding) >= 0: record.material_check = '1' # 已齐套 else: record.material_check = '0' # 未齐套