From 22c9de86f6fa828f2eb1ed4b14fbb16f306f5324 Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Mon, 21 Oct 2024 13:56:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=B6=E9=80=A0=E8=AE=A2=E5=8D=95=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E8=AE=A2=E5=8D=95=E4=BA=A4=E6=9C=9F=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_production.py | 14 +++++++++++++- .../views/mrp_production_addional_change.xml | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 0b68852b..4eac6f54 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -18,7 +18,7 @@ class MrpProduction(models.Model): _inherit = 'mrp.production' _description = "制造订单" _order = 'create_date desc' - + deadline_of_delivery = fields.Date('订单交期', tracking=True, compute='_compute_deadline_of_delivery') # tray_ids = fields.One2many('sf.tray', 'production_id', string="托盘") maintenance_count = fields.Integer(compute='_compute_maintenance_count', string="Number of maintenance requests") request_ids = fields.One2many('maintenance.request', 'production_id') @@ -34,6 +34,18 @@ class MrpProduction(models.Model): tool_state_remark = fields.Text(string='功能刀具状态备注(缺刀)', compute='_compute_tool_state_remark', store=True) tool_state_remark2 = fields.Text(string='功能刀具状态备注(无效刀)', readonly=True) + @api.depends('procurement_group_id.mrp_production_ids.move_dest_ids.group_id.sale_id') + def _compute_deadline_of_delivery(self): + for production in self: + production.sale_order_count = len( + production.procurement_group_id.mrp_production_ids.move_dest_ids.group_id.sale_id) + sale_order_ids = production.procurement_group_id.mrp_production_ids.move_dest_ids.group_id.sale_id.ids + if len(sale_order_ids) < 1: + continue + sale_id = self.env['sale.order'].browse(sale_order_ids[0]) + if sale_id: + production.deadline_of_delivery = sale_id.deadline_of_delivery + @api.depends('workorder_ids.tool_state_remark') def _compute_tool_state_remark(self): for item in self: diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml index c6ae49ad..86a9ce9e 100644 --- a/sf_manufacturing/views/mrp_production_addional_change.xml +++ b/sf_manufacturing/views/mrp_production_addional_change.xml @@ -101,6 +101,7 @@ +