1.新增加工面模型2.制造订单详情页面的返工操作上的加工面根据产品的加工面板进行过滤

This commit is contained in:
jinling.yang
2024-07-08 17:33:04 +08:00
parent 52fa229896
commit b383a6d229
8 changed files with 129 additions and 46 deletions

View File

@@ -11,6 +11,7 @@ class ReworkWizard(models.TransientModel):
_description = '返工向导'
workorder_id = fields.Many2one('mrp.workorder', string='工单')
product_id = fields.Many2one('product.product')
production_ids = fields.Many2many('mrp.production', string='制造订单号')
rework_reason = fields.Selection(
[("programming", "编程"), ("cutter", "刀具"), ("clamping", "装夹"),
@@ -20,13 +21,33 @@ class ReworkWizard(models.TransientModel):
routing_type = fields.Selection([
('装夹预调', '装夹预调'),
('CNC加工', 'CNC加工')], string="工序类型")
# 根据工单的加工面来显示
processing_panel_id = fields.Many2one('sf.processing.panel', string="加工面")
def confirm(self):
self.workorder_id.is_rework = True
if len(self.production_ids) == 1:
self.workorder_id.is_rework = True
self.production_ids.write({'detection_result_ids': [(0, 0, {
'rework_reason': self.rework_reason,
'detailed_reason': self.detailed_reason,
'processing_panel': self.workorder_id.processing_panel,
# 'processing_panel': self.workorder_id.processing_panel,
'routing_type': self.workorder_id.routing_type,
'test_results': self.workorder_id.test_results,
'test_report': self.workorder_id.detection_report})]})
@api.onchange('product_id')
def onchange_processing_panel_id(self):
for item in self:
domain = [('id', '=', False)]
product_id = item.product_id
if product_id:
if self.env.user.has_group('sf_base.group_sf_order_user'):
panel_ids = []
for p in product_id.model_processing_panel.split(','):
panel = self.env['sf.processing.panel'].search(
[('name', 'ilike', p)])
if panel:
panel_ids.append(panel.id)
domain = {'processing_panel_id': [('id', 'in', panel_ids)]}
return {'domain': domain}