From 1e2272c13abd5867c994b9b673fa80b6982e2865 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Tue, 23 Jan 2024 15:33:17 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B7=A5=E4=BB=B6?= =?UTF-8?q?=E9=85=8D=E9=80=81=E5=AF=B9=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workorder.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index eabdff95..0ac3c9b7 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -772,3 +772,16 @@ class SfWorkOrderBarcodes(models.Model): # # else: # self.pro_code_ok = workorder.pro_code_is_ok(barcode) + + +class WorkPieceDispatch(models.Model): + _name = "mrp.workpiece.dispatch" + _description = '工件配送' + + workorder_id = fields.Many2one('mrp.workorder') + workorder_code = fields.Char(related='workorder_id.','任务编号(工件编码)') + + + + + From 82f54b5d830888ac9154daa35e5afd95648a78d1 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Wed, 24 Jan 2024 14:24:27 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E5=88=B6=E9=80=A0=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=96=B0=E5=A2=9E=E7=94=9F=E4=BA=A7=E7=BA=BF?= =?UTF-8?q?=E5=92=8C=E8=AE=A1=E5=88=92=E5=BC=80=E5=A7=8B=E5=8A=A0=E5=B7=A5?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_production.py | 11 - sf_manufacturing/models/mrp_workorder.py | 2 +- .../views/mrp_production_addional_change.xml | 329 ++++++++++-------- sf_manufacturing/views/mrp_workorder_view.xml | 9 +- sf_plan/models/custom_plan.py | 38 +- sf_plan/views/change_manufactuing.xml | 110 +++--- sf_plan/views/view.xml | 230 +++++------- 7 files changed, 359 insertions(+), 370 deletions(-) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 7bf0886f..61be5b40 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -50,18 +50,7 @@ class MrpProduction(models.Model): work_state = fields.Char('业务状态') programming_state = fields.Char('编程状态') glb_file = fields.Binary("glb模型文件") - production_line_id = fields.Many2one('sf.production.line', string='生产线', compute='_compute_production_line_id', - store=True) - plan_start_processing_time = fields.Datetime('计划开始加工时间') - @api.depends('name') - def _compute_production_line_id(self): - for production in self: - if production.name: - plan_production = self.env['sf.production.plan'].search([('production_id', '=', self.id)]) - if plan_production: - production.production_line_id = plan_production.production_id.id - production.plan_start_processing_time = plan_production.date_planned_start @api.depends( 'move_raw_ids.state', 'move_raw_ids.quantity_done', 'move_finished_ids.state', diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 04f49d0a..7a77fc5c 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -777,7 +777,7 @@ class WorkPieceDelivery(models.Model): workorder_id = fields.Many2one('mrp.workorder', string='工单', domain=[('name', 'in', ('装夹', '解除装夹'))]) - name = fields.Char(related='workorder_id.production_id.name', string='工件编码/任务编码', store=True) + production_code = fields.Char(related='workorder_id.production_id.name', string='工件编码/任务编码', store=True) plan_start_processing_time = fields.Datetime('计划开始加工时间') workpiece_code = fields.Char('同运工件编码') feeder_station_start = fields.Char('起点接驳站') diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml index 5c7f9cc0..e45f4a6e 100644 --- a/sf_manufacturing/views/mrp_production_addional_change.xml +++ b/sf_manufacturing/views/mrp_production_addional_change.xml @@ -18,19 +18,21 @@ - + - + - + - - - + + + @@ -39,44 +41,52 @@ + attrs="{'invisible': [('state', 'not in', ['confirmed', 'progress'])]}" + optional="hide" + decoration-success="reservation_state == 'assigned' or components_availability_state == 'available'" + decoration-warning="reservation_state != 'assigned' and components_availability_state in ('expected', 'available')" + decoration-danger="reservation_state != 'assigned' and components_availability_state == 'late'"/> - - - - + + + + - - + + custom.mrp.production.form mrp.production - draft,confirmed,progress,pending_processing,completed,done + draft,confirmed,progress,pending_processing,completed,done + - + - + + -
- -
- - -
-
+ + + - - stock.barcode.quant.kanban - stock.quant - 1000 - - - - - - -
- -
-
- - - + + stock.barcode.quant.kanban + stock.quant + 1000 + + + + + + +
+ + + +
+
+ + + +
-
- - - - - + + + + + - - stock.quant.kanban.barcode - stock.quant - 1000 - - - - -
-
- + + stock.quant.kanban.barcode + stock.quant + 1000 + + + + +
+
+ + + +
+
+ + + + + +
+
+ + +
+
+ + +
-
- - - - -
-
- -
-
- -
-
- - - - - + + + + + - - stock_barcode.quant.tree.inherit - stock.quant - - primary - - - UoM - show - - - hide - - - hide - - - + + stock_barcode.quant.tree.inherit + stock.quant + + primary + + + UoM + show + + + hide + + + hide + + + diff --git a/stock_barcode/views/stock_picking_views.xml b/stock_barcode/views/stock_picking_views.xml index d61de200..d516844c 100644 --- a/stock_barcode/views/stock_picking_views.xml +++ b/stock_barcode/views/stock_picking_views.xml @@ -1,181 +1,174 @@ - - - stock.move.line.operations.tree.inherit - stock.move.line - - - - - - - - {'barcode_events': True} - field_float_scannable - - - + + + + stock.move.line.kanban.inherited + stock.move.line + + + + + + + + + + - - stock.move.line.kanban.inherited - stock.move.line - - - - - - - - - - - - - stock.picking.form.view.barcode - stock.picking - 1000 - -
- - - -
- -
-
+ + + + + + +
+
+ +
+ - - Open picking form - stock.picking - form - { - 'res_id': active_id, - } - - + + Open picking form + stock.picking + form + { + 'res_id': active_id, + } + + - - stock.picking.view.kanban.barcode - stock.picking - - + + stock.picking.view.kanban.barcode + stock.picking + + - - - - - - + + + + + + - - Operation Types - stock.picking.type - - - - - - - + + Operation Types + stock.picking.type + + + + + + + - - Operation Types - stock.picking.type - - - - - - - - - - - - - - - - - - - - + Operation Types + stock.picking.type + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + From 37161e2e20757202dc3e8a9cd4b2b3dd02caf291 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Thu, 25 Jan 2024 17:51:57 +0800 Subject: [PATCH 5/7] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E7=9A=84=E6=89=98=E7=9B=98=E5=BA=8F=E5=88=97=E5=8F=B7=EF=BC=8C?= =?UTF-8?q?=E6=89=98=E7=9B=98=E5=90=8D=E7=A7=B0=EF=BC=8C=E6=89=98=E7=9B=98?= =?UTF-8?q?=E5=93=81=E7=89=8C=EF=BC=8C=E6=89=98=E7=9B=98=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=EF=BC=8C=E6=89=98=E7=9B=98=E5=9E=8B=E5=8F=B7=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=EF=BC=8C=E4=B8=94=E9=A1=B5=E9=9D=A2=E5=AF=B9?= =?UTF-8?q?=E5=BA=94=E5=AD=97=E6=AE=B5=E6=94=B9=E4=B8=BA=E5=8F=AA=E8=AF=BB?= =?UTF-8?q?=202.=E8=A3=85=E5=A4=B9=E9=A2=84=E8=B0=83=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=89=AB=E6=9D=A1=E5=BD=A2=E7=A0=81=EF=BC=8C?= =?UTF-8?q?=E6=89=AB=E7=A0=81=E6=97=B6=E5=AF=B9=E8=AF=A5=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E8=87=AA=E5=8A=A8=E5=BC=80=E5=A7=8B=E5=B9=B6?= =?UTF-8?q?=E5=B0=86=E6=9D=A1=E7=A0=81=E9=87=8C=E5=AF=B9=E5=BA=94=E7=9A=84?= =?UTF-8?q?=E6=89=98=E7=9B=98=E4=BA=A7=E5=93=81=E4=BF=A1=E6=81=AF=E5=9B=9E?= =?UTF-8?q?=E5=A1=AB=E5=88=B0=E6=89=98=E7=9B=98=E5=BA=8F=E5=88=97=E5=8F=B7?= =?UTF-8?q?=EF=BC=8C=E6=89=98=E7=9B=98=E5=90=8D=E7=A7=B0=EF=BC=8C=E6=89=98?= =?UTF-8?q?=E7=9B=98=E5=93=81=E7=89=8C=EF=BC=8C=E6=89=98=E7=9B=98=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=EF=BC=8C=E6=89=98=E7=9B=98=E5=9E=8B=E5=8F=B7=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E4=B8=8A=EF=BC=8C=E7=82=B9=E5=87=BB=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E6=97=B6=E5=AF=B9=E5=89=8D=E7=BD=AE=E4=B8=89=E5=85=83=E5=AE=9A?= =?UTF-8?q?=E4=BD=8D=E6=A3=80=E6=B5=8B=E5=8F=82=E6=95=B0=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=203.=E7=A0=94=E7=A9=B6=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E5=BA=8F=E5=88=97=E5=8F=B7=EF=BC=88=E5=A4=9A=E4=B8=AA=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workorder.py | 73 ++++++------------- sf_manufacturing/models/stock.py | 12 ++- sf_manufacturing/views/mrp_workorder_view.xml | 17 +++-- 3 files changed, 42 insertions(+), 60 deletions(-) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 7a77fc5c..712940f0 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -122,10 +122,10 @@ class ResMrpWorkOrder(models.Model): chuck_type_id = fields.Char(string="卡盘类型") chuck_model_id = fields.Char(string="卡盘型号") tray_serial_number = fields.Char(string="托盘序列号") - tray_name = fields.Char(string="托盘名称") + tray_product_id = fields.Many2one('product.product', string="托盘名称") tray_brand_id = fields.Many2one('sf.machine.brand', string="托盘品牌") - tray_type_id = fields.Char(string="托盘类型") - tray_model_id = fields.Char(string="托盘型号") + tray_type_id = fields.Many2one('sf.fixture.material', string="托盘类型") + tray_model_id = fields.Many2one('sf.fixture.model', string="托盘型号") total_wight = fields.Float(string="总重量") maximum_carrying_weight = fields.Char(string="最大承载重量[kg]") maximum_clamping_force = fields.Char(string="最大夹持力[n]") @@ -552,6 +552,9 @@ class ResMrpWorkOrder(models.Model): raise UserError(_('请先完成上一步工单')) def button_finish(self): + if self.routing_type == '装夹预调': + if not self.material_center_point and self.X_deviation_angle > 0: + raise UserError("请对前置三元检测定位参数进行计算定位") if self.picking_out_id: picking_out = self.env['stock.picking'].search([('id', '=', self.picking_out_id.id)]) if picking_out.workorder_out_id: @@ -721,54 +724,22 @@ class SfWorkOrderBarcodes(models.Model): _name = "mrp.workorder" _inherit = ["mrp.workorder", "barcodes.barcode_events_mixin"] - # def on_barcode_scanned(self, barcode): - # workorder = self.env['mrp.workorder'].browse(self.ids) - # if "*" not in barcode: - # if self.routing_type == '装夹': - # tray_code = self.env['sf.tray'].search([('code', '=', barcode)]) - # self.tray_code = tray_code.code - # self.tray_id = workorder.gettray_auto(barcode) - # elif self.routing_type == '前置三元定位检测': - # print('我是前置三元检测') - # logging.info('我是前置三元检测') - # elif self.routing_type == 'CNC加工': - # if barcode == 'UP-ALL': - # print("我是一键合并下发") - # logging.info('我是一键合并下发') - # self.up_merge_all() - # else: - # print('CNC加工') - # # print(barcode) - # # a = self.env['sf.tray'].search([('code', '=', barcode)]) - # # print(a) - # # # workorder_obj = self.env['mrp.workorder'].search([('tray_code', '=', barcode)], limit=1) - # # workorder_obj = self.env['mrp.workorder'].search([('tray_code', '=', barcode)]) - # # e = workorder_obj.id - # # print(workorder_obj) - # # action = { - # # 'name': '工单', - # # 'type': 'ir.actions.act_window', - # # # 'view_type': 'form', - # # 'view_mode': 'form', - # # 'res_model': 'mrp.workorder', - # # 'view_id': self.env.ref('mrp.mrp_production_workorder_form_view_inherit').id, - # # # 'res_id': workorder_obj.id, - # # 'res_id': 1023, - # # 'target': 'current', - # # # 'context': self.env.context, - # # # 'flags': {'initial_mode': 'edit'}, - # # } - # # return action - # - # elif self.routing_type == '后置三元质量检测': - # print('后置三元检测') - # elif self.routing_type == '解除装夹': - # print("我是解除装夹") - # else: - # pass - # - # else: - # self.pro_code_ok = workorder.pro_code_is_ok(barcode) + def on_barcode_scanned(self, barcode): + workorder = self.env['mrp.workorder'].browse(self.ids) + # workorder = self.env['mrp.workorder'].search( + # [('routing_type', '=', '装夹预调'), ('production_id', '=', self.production_id.id)]) + if workorder: + if workorder.routing_type == '装夹预调': + stock_move_line = self.env['stock.move.line'].search([('lot_name', '=', barcode)]) + if stock_move_line: + workorder.write({ + 'tray_serial_number': stock_move_line.lot_name, + 'tray_product_id': stock_move_line.product_id.id, + 'tray_brand_id': stock_move_line.product_id.brand_id.id, + 'tray_type_id': stock_move_line.product_id.fixture_material_id.id, + 'tray_model_id': stock_move_line.product_id.fixture_model_id.id + }) + workorder.button_start() class WorkPieceDelivery(models.Model): diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index a39bd0f4..f13abf6b 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -375,8 +375,18 @@ class ReStockMove(models.Model): def print_serial_numbers(self): if not self.next_serial: raise UserError(_("请先分配序列号再进行打印")) + label_data = [] for item in self.move_line_ids: - print(item.lot_name) + label_data.append({ + 'item_id': item.id, + }) + if label_data: + report_template = self.env.ref('stock.label_package_template') + res = report_template.report_action(label_data) + res['id'] = report_template.id + return res + else: + raise UserError(_("没有可打印的标签数据")) class ReStockQuant(models.Model): diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml index 42b58149..502b33a2 100644 --- a/sf_manufacturing/views/mrp_workorder_view.xml +++ b/sf_manufacturing/views/mrp_workorder_view.xml @@ -117,7 +117,7 @@ attrs="{'invisible': ['|', '|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('is_user_working', '=', False)]}"/>
- - + + From cf2aaa38fed567c223dac0773c88c90543d4a4e5 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Fri, 26 Jan 2024 17:46:53 +0800 Subject: [PATCH 6/7] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8D=E6=9D=90=E6=96=99?= =?UTF-8?q?=E5=9E=8B=E5=8F=B7=E5=90=8C=E6=AD=A5=E6=8A=A5=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E9=97=AE=E9=A2=982.=E4=BC=98=E5=8C=96=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E7=9A=84=E5=B7=A5=E4=BB=B6=E6=B4=BE=E9=80=813.=E8=AE=A1?= =?UTF-8?q?=E5=88=92=E9=87=8C=E6=96=B0=E5=A2=9E=E7=94=9F=E4=BA=A7=E7=BA=BF?= =?UTF-8?q?=E7=9A=84=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/models/common.py | 2 +- sf_manufacturing/models/mrp_production.py | 2 + sf_manufacturing/models/mrp_workorder.py | 43 +++++++++++++++---- .../views/mrp_production_addional_change.xml | 2 + sf_manufacturing/views/mrp_workorder_view.xml | 10 ++--- sf_plan/models/custom_plan.py | 23 +++------- sf_plan/views/view.xml | 11 ----- 7 files changed, 51 insertions(+), 42 deletions(-) diff --git a/sf_base/models/common.py b/sf_base/models/common.py index 7450fff9..6cddafd7 100644 --- a/sf_base/models/common.py +++ b/sf_base/models/common.py @@ -61,7 +61,7 @@ class MrsMaterialModel(models.Model): supplier_ids = fields.One2many('sf.supplier.sort', 'materials_model_id', string='供应商') active = fields.Boolean('有效', default=True) - @api.constrains('gain_way', 'supplier_ids') + @api.constrains('supplier_ids') def _check_gain_way(self): if not self.gain_way: raise UserError("请输入获取方式") diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 61be5b40..7c4915c1 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -50,6 +50,8 @@ class MrpProduction(models.Model): work_state = fields.Char('业务状态') programming_state = fields.Char('编程状态') glb_file = fields.Binary("glb模型文件") + production_line_id = fields.Many2one('sf.production.line', string='生产线') + plan_start_processing_time = fields.Datetime('计划开始加工时间') @api.depends( diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 712940f0..a0ba1317 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -131,7 +131,7 @@ class ResMrpWorkOrder(models.Model): maximum_clamping_force = fields.Char(string="最大夹持力[n]") production_line = fields.Char(string="生产线") preset_program_information = fields.Char(string="预调程序信息") - workpiece_delivery_id = fields.One2many('sf.workpiece.delivery', 'workorder_id', '工件配送') + workpiece_delivery_ids = fields.One2many('sf.workpiece.delivery', 'workorder_id', '工件配送') @api.onchange('is_ok') def _onchange_inspection_user_id(self): @@ -196,9 +196,24 @@ class ResMrpWorkOrder(models.Model): work = workorder.production_id.workorder_ids work.compensation_value_x = eval(self.material_center_point)[0] work.compensation_value_y = eval(self.material_center_point)[1] + workorder.button_finish() + except: raise UserError("参数计算有误") + # def button_workpiece_delivery(self): + # if self.routing_type == '装夹预调': + # if not self.workpiece_delivery_ids: + # raise UserError('请添加【工件配送】信息') + # else: + # for item in self.workpiece_delivery_ids: + # if not item.feeder_station_start: + # raise UserError('【工件配送】明细中请输入起点接驳站') + # if not item.workpiece_code: + # raise UserError('请对【同运工件】进行扫描') + # else: + # workpiece_code + # 拼接工单对象属性值 def json_workorder_str(self, k, production, route): # 计算预计时长duration_expected @@ -241,7 +256,9 @@ class ResMrpWorkOrder(models.Model): 'date_planned_finished': False, 'duration_expected': duration_expected, 'duration': 0, - + 'workpiece_delivery_ids': False if not route.routing_type == '装夹预调' else self.env[ + 'sf.workpiece.delivery'].create( + {'production_id': production.id}) }] return workorders_values_str @@ -731,7 +748,7 @@ class SfWorkOrderBarcodes(models.Model): if workorder: if workorder.routing_type == '装夹预调': stock_move_line = self.env['stock.move.line'].search([('lot_name', '=', barcode)]) - if stock_move_line: + if stock_move_line.product_id.categ_type == '夹具': workorder.write({ 'tray_serial_number': stock_move_line.lot_name, 'tray_product_id': stock_move_line.product_id.id, @@ -740,26 +757,36 @@ class SfWorkOrderBarcodes(models.Model): 'tray_model_id': stock_move_line.product_id.fixture_model_id.id }) workorder.button_start() + # elif stock_move_line.product_id.categ_type == '坯料': + # if stock_move_line.production_id.production_line_id.id == workorder.production_id.production_line_id.id + # workorder. class WorkPieceDelivery(models.Model): _name = "sf.workpiece.delivery" _description = '工件配送' - workorder_id = fields.Many2one('mrp.workorder', string='工单', - domain=[('name', 'in', ('装夹', '解除装夹'))]) - production_code = fields.Char(related='workorder_id.production_id.name', string='工件编码/任务编码', store=True) - plan_start_processing_time = fields.Datetime('计划开始加工时间') + workorder_id = fields.Many2one('mrp.workorder', string='工单', readonly=True) + production_id = fields.Many2one('mrp.production', string='制造订单', readonly=True) + production_line_id = fields.Many2one('sf.production.line', compute='_compute_production_line_id', + string='目标生产线', readonly=True, + store=True) + plan_start_processing_time = fields.Datetime('计划开始加工时间', readonly=True) workpiece_code = fields.Char('同运工件编码') feeder_station_start = fields.Char('起点接驳站') feeder_station_destination = fields.Char('目的接驳站') - production_line_id = fields.Many2one('sf.production.line', string='目标生产线') task_delivery_time = fields.Datetime('任务下发时间') task_completion_time = fields.Datetime('任务完成时间') delivery_time = fields.Char('配送时长', compute='_compute_delivery_time') status = fields.Selection([('待下发', '待下发'), ('待配送', '待配送'), ('已配送', '已配送')], string='状态', default='待下发') + @api.depends('production_id.production_line_id') + def _compute_production_line_id(self): + if self.production_id.production_line_id: + self.production_line_id = self.production_id.production_line_id.id + self.plan_start_processing_time = self.production_id.plan_start_processing_time + @api.depends('task_delivery_time', 'task_completion_time') def _compute_delivery_time(self): for obj in self: diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml index 6ba4d4d5..b93ad455 100644 --- a/sf_manufacturing/views/mrp_production_addional_change.xml +++ b/sf_manufacturing/views/mrp_production_addional_change.xml @@ -69,6 +69,8 @@ + +