From 0347eb48e43dcdd3924f2f67e4795ec6b5ea4220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?= Date: Tue, 25 Mar 2025 13:48:17 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E8=A1=8C=E5=A2=9E=E5=8A=A0=E4=BA=A4=E6=9C=9F=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=EF=BC=8C=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=80=BC=E4=BF=AE=E6=94=B9=E4=B8=BA=E4=BE=9B?= =?UTF-8?q?=E8=B4=A7=E6=96=B9=E5=BC=8F=E5=BE=85=E7=A1=AE=E8=AE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/views/sale_order_views.xml | 2 +- sf_sale/models/sale_order.py | 3 +++ sf_sale/views/sale_order_view.xml | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sf_manufacturing/views/sale_order_views.xml b/sf_manufacturing/views/sale_order_views.xml index 10700231..7bda0168 100644 --- a/sf_manufacturing/views/sale_order_views.xml +++ b/sf_manufacturing/views/sale_order_views.xml @@ -71,7 +71,7 @@ - {'search_default_draft': 1} + {'search_default_supply_method': 1} diff --git a/sf_sale/models/sale_order.py b/sf_sale/models/sale_order.py index 09dc24dd..1c8480dd 100644 --- a/sf_sale/models/sale_order.py +++ b/sf_sale/models/sale_order.py @@ -150,6 +150,7 @@ class ReSaleOrder(models.Model): 'is_incoming_material': True if item.get('embryo_redundancy_id') else False, 'manual_quotation': item.get('manual_quotation'), 'model_id': item['model_id'], + 'delivery_end_date': item['delivery_end_date'], } return self.env['sale.order.line'].with_context(skip_procurement=True).create(vals) @@ -272,6 +273,8 @@ class ResaleOrderLine(models.Model): model_url = fields.Char('模型文件地址') model_id = fields.Char('模型id') + delivery_end_date = fields.Date('交货截止日期') + @api.depends('embryo_redundancy_id') def _compute_is_incoming_material(self): for line in self: diff --git a/sf_sale/views/sale_order_view.xml b/sf_sale/views/sale_order_view.xml index 6a5f839b..704f9e5e 100644 --- a/sf_sale/views/sale_order_view.xml +++ b/sf_sale/views/sale_order_view.xml @@ -136,6 +136,10 @@ hide + + + + {'readonly': [('state', 'in', ['cancel','sale'])]} From 4b6f04aa9d283f7c6c37bdfbc556a403b8f85b12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?= Date: Thu, 27 Mar 2025 15:51:16 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/views/sale_order_views.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sf_manufacturing/views/sale_order_views.xml b/sf_manufacturing/views/sale_order_views.xml index 10700231..a6bebf9c 100644 --- a/sf_manufacturing/views/sale_order_views.xml +++ b/sf_manufacturing/views/sale_order_views.xml @@ -18,7 +18,7 @@ - + From 4cbcf08da8503bd6b9cdb23d6974fcb1b22453d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?= Date: Thu, 27 Mar 2025 16:10:07 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E9=94=80=E5=94=AE=E5=8D=95=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E7=AD=9B=E9=80=89=E4=BE=9B=E8=B4=A7=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=E5=BE=85=E7=A1=AE=E8=AE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/views/sale_order_views.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sf_manufacturing/views/sale_order_views.xml b/sf_manufacturing/views/sale_order_views.xml index a6bebf9c..8366a972 100644 --- a/sf_manufacturing/views/sale_order_views.xml +++ b/sf_manufacturing/views/sale_order_views.xml @@ -71,7 +71,7 @@ - {'search_default_draft': 1} + {'search_default_supply_method': 1} From f34c01d1b0a3a5306b19dbf5c6fe2b8a52f51c7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?= Date: Fri, 28 Mar 2025 13:37:29 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=A1=A8=E9=9D=A2?= =?UTF-8?q?=E5=B7=A5=E8=89=BA=E5=A4=96=E5=8D=8F=E8=B0=83=E6=8B=A8=E5=8D=95?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workorder.py | 13 ++++++++++++- sf_manufacturing/models/stock.py | 12 +++++++++++- sf_message/models/sf_message_workorder.py | 7 ++++--- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index b8ea6eec..ea2923bd 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1533,7 +1533,7 @@ class ResMrpWorkOrder(models.Model): # workorder.rfid_code_old = rfid_code # workorder.rfid_code = False logging.info('workorder.rfid_code:%s' % workorder.rfid_code) - # if is_production_id is True and record.routing_type in ['解除装夹', '表面工艺', '切割']: + if is_production_id is True: logging.info('product_qty:%s' % record.production_id.product_qty) for move_raw_id in record.production_id.move_raw_ids: @@ -1548,6 +1548,17 @@ class ResMrpWorkOrder(models.Model): # if raw_move: # raw_move.write({'state': 'done'}) if record.production_id.state != 'rework': + # 如果工单包含了外协工序,需要预留数量 + if self.move_raw_ids.move_orig_ids.subcontract_workorder_id: + location_id = self.move_raw_ids.location_id + quant = self.move_raw_ids.lot_ids.quant_ids.filtered(lambda q: q.location_id.id == location_id.id) + if quant.reserved_quantity == 0: + self.env['stock.quant']._update_reserved_quantity( + self.move_raw_ids.product_id, + location_id, + quant.quantity, + lot_id=quant.lot_id, + ) record.production_id.button_mark_done1() # record.production_id.state = 'done' diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index 051f0507..1f1e45b6 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -690,7 +690,8 @@ class StockPicking(models.Model): # 如果当前工单是是制造订单的最后一个工艺外协工单 if workorder == next((workorder for workorder in reversed(sorted_workorders) if workorder.is_subcontract), None): - move_dest_id = item.move_raw_ids[0].id + if item.move_raw_ids: + move_dest_id = item.move_raw_ids[0].id else: # 从sorted_workorders中找到上一工单的move if len(sorted_workorders) > 1: @@ -726,6 +727,7 @@ class StockPicking(models.Model): moves_out._action_confirm() moves_out._assign_picking_post_process(new=new_picking) + @api.depends('move_type', 'immediate_transfer', 'move_ids.state', 'move_ids.picking_id') def _compute_state(self): super(StockPicking, self)._compute_state() @@ -849,6 +851,7 @@ class ReStockMove(models.Model): # 'route_ids': False if not route else [(4, route.id)], 'date_deadline': datetime.now(), 'picking_type_id': picking_type_id, + # 'is_subcontract': True, } return move_values @@ -1118,6 +1121,13 @@ class ReStockMove(models.Model): if self.state != 'assigned': self.state = 'assigned' return self.action_show_details() + + def _prepare_move_line_vals(self, quantity=None, reserved_quant=None): + res = super(ReStockMove, self)._prepare_move_line_vals(quantity, reserved_quant) + if self.subcontract_workorder_id: + if self.subcontract_workorder_id.production_id.move_raw_ids.move_line_ids: + res['lot_id'] = self.subcontract_workorder_id.production_id.move_raw_ids.move_line_ids[0].lot_id.id + return res class ReStockQuant(models.Model): diff --git a/sf_message/models/sf_message_workorder.py b/sf_message/models/sf_message_workorder.py index 42b03139..5b73565e 100644 --- a/sf_message/models/sf_message_workorder.py +++ b/sf_message/models/sf_message_workorder.py @@ -191,7 +191,8 @@ class SFMessageWork(models.Model): def write(self, vals): res = super(SFMessageWork, self).write(vals) - if ('leave_id' in vals and vals['leave_id'] is False or 'date_planned_start' in vals and vals['date_planned_start'] is False) \ - and self.schedule_state != '未排': - self.add_queue('计划数据异常跟踪') + for record in self: + if ('leave_id' in vals and vals['leave_id'] is False or 'date_planned_start' in vals and vals['date_planned_start'] is False) \ + and record.schedule_state != '未排': + record.add_queue('计划数据异常跟踪') return res From b55c6c1fe7b2685e0c29da6f30cfb322e1f00d9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?= Date: Sun, 30 Mar 2025 11:16:40 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=89=8D=E7=BD=AE?= =?UTF-8?q?=E4=B8=89=E5=85=83=E6=A3=80=E6=B5=8B=E6=96=87=E4=BB=B6=E6=A0=B9?= =?UTF-8?q?=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workorder.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index ea2923bd..9386f7da 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -736,7 +736,8 @@ class ResMrpWorkOrder(models.Model): local_filename = self.save_name + '.xls' local_file_path = os.path.join(local_dir_path, local_filename) logging.info('local_file_path:%s' % local_file_path) - remote_path = '/home/ftp/ftp_root/ThreeTest/XT/Before/' + local_filename + # remote_path = '/home/ftp/ftp_root/ThreeTest/XT/Before/' + local_filename + remote_path = '/ThreeTest/XT/Before/' + local_filename logging.info('remote_path:%s' % remote_path) is_get_detection_file = self.env['ir.config_parameter'].sudo().get_param('is_get_detection_file') if not is_get_detection_file: From 1a3590b6b65aa7c1dab0d24db5ec476a87502112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?= Date: Sun, 30 Mar 2025 15:03:18 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E5=B1=8F=E8=94=BD=E7=89=A9=E6=B5=81?= =?UTF-8?q?=E4=B8=8B=E5=8D=95=E7=9A=84=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_bf_connect/views/view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sf_bf_connect/views/view.xml b/sf_bf_connect/views/view.xml index f4245343..b2d9d5e7 100644 --- a/sf_bf_connect/views/view.xml +++ b/sf_bf_connect/views/view.xml @@ -32,7 +32,7 @@ -