1.优化制造订单的检测结果:新增处理结果字段
2.优化制造订单的返工向导:加工面字段类型改为多对多,且该字段需根据处理结果为待处理的检测结果的加工面进行过滤 3.优化工单工件下产线接口:工单状态为待检测 4,.优化工单状态方法(_compute_state)
This commit is contained in:
@@ -24,7 +24,7 @@
|
|||||||
'views/mrp_production_addional_change.xml',
|
'views/mrp_production_addional_change.xml',
|
||||||
'views/mrp_routing_workcenter_view.xml',
|
'views/mrp_routing_workcenter_view.xml',
|
||||||
'views/production_line_view.xml',
|
'views/production_line_view.xml',
|
||||||
# 'views/mrp_workcenter_views.xml',
|
'views/mrp_workcenter_views.xml',
|
||||||
'views/mrp_workorder_view.xml',
|
'views/mrp_workorder_view.xml',
|
||||||
'views/model_type_view.xml',
|
'views/model_type_view.xml',
|
||||||
'views/agv_setting_views.xml',
|
'views/agv_setting_views.xml',
|
||||||
|
|||||||
@@ -541,6 +541,7 @@ class Manufacturing_Connect(http.Controller):
|
|||||||
('processing_panel', '=', order.processing_panel)])
|
('processing_panel', '=', order.processing_panel)])
|
||||||
if panel_workorder:
|
if panel_workorder:
|
||||||
panel_workorder.write({'production_line_state': '已下产线'})
|
panel_workorder.write({'production_line_state': '已下产线'})
|
||||||
|
workorder.write({'state': 'to be detected'})
|
||||||
workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search(
|
workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search(
|
||||||
[
|
[
|
||||||
('rfid_code', '=', rfid_code), ('type', '=', '下产线'),
|
('rfid_code', '=', rfid_code), ('type', '=', '下产线'),
|
||||||
|
|||||||
@@ -107,7 +107,8 @@ class MrpProduction(models.Model):
|
|||||||
precision_rounding=production.product_uom_id.rounding) >= 0:
|
precision_rounding=production.product_uom_id.rounding) >= 0:
|
||||||
production.state = 'to_close'
|
production.state = 'to_close'
|
||||||
elif any(
|
elif any(
|
||||||
(wo.test_results == '返工' and wo.state == 'done') or wo.state == 'rework' for wo in
|
(wo.test_results == '返工' and wo.state == 'done') or wo.state == 'rework' or (
|
||||||
|
wo.is_rework is True and wo.state == 'done') for wo in
|
||||||
production.workorder_ids):
|
production.workorder_ids):
|
||||||
production.state = 'rework'
|
production.state = 'rework'
|
||||||
elif any(wo_state in ('progress', 'done') for wo_state in production.workorder_ids.mapped('state')):
|
elif any(wo_state in ('progress', 'done') for wo_state in production.workorder_ids.mapped('state')):
|
||||||
@@ -757,6 +758,7 @@ class MrpProduction(models.Model):
|
|||||||
|
|
||||||
# 返工
|
# 返工
|
||||||
def button_rework(self):
|
def button_rework(self):
|
||||||
|
if self.programming_state != '已编程':
|
||||||
self._cron_get_programming_state()
|
self._cron_get_programming_state()
|
||||||
return {
|
return {
|
||||||
'name': _('返工'),
|
'name': _('返工'),
|
||||||
@@ -767,7 +769,8 @@ class MrpProduction(models.Model):
|
|||||||
'context': {
|
'context': {
|
||||||
'default_production_id': self.id,
|
'default_production_id': self.id,
|
||||||
'default_product_id': self.product_id.id,
|
'default_product_id': self.product_id.id,
|
||||||
'default_programming_state': self.programming_state
|
'default_programming_state': self.programming_state,
|
||||||
|
'default_is_reprogramming': True if self.programming_state in ['已编程'] else False
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -870,12 +873,15 @@ class sf_detection_result(models.Model):
|
|||||||
('CNC加工', 'CNC加工')], string="工序类型")
|
('CNC加工', 'CNC加工')], string="工序类型")
|
||||||
|
|
||||||
rework_reason = fields.Selection(
|
rework_reason = fields.Selection(
|
||||||
[("programming", "编程"), ("cutter", "刀具"), ("operate computer", "操机"),
|
[("programming", "编程"), ("cutter", "刀具"), ("clamping", "装夹"),
|
||||||
|
("operate computer", "操机"),
|
||||||
("technology", "工艺"), ("customer redrawing", "客户改图")], string="原因", tracking=True)
|
("technology", "工艺"), ("customer redrawing", "客户改图")], string="原因", tracking=True)
|
||||||
detailed_reason = fields.Text('详细原因')
|
detailed_reason = fields.Text('详细原因')
|
||||||
test_results = fields.Selection([("合格", "合格"), ("返工", "返工"), ("报废", "报废")], default='合格',
|
test_results = fields.Selection([("合格", "合格"), ("返工", "返工"), ("报废", "报废")],
|
||||||
string="检测结果", tracking=True)
|
string="检测结果", tracking=True)
|
||||||
test_report = fields.Binary('检测报告', readonly=True)
|
test_report = fields.Binary('检测报告', readonly=True)
|
||||||
|
handle_result = fields.Selection([("待处理", "待处理"), ("已处理", "已处理")], default='', string="处理结果",
|
||||||
|
tracking=True)
|
||||||
|
|
||||||
# 查看检测报告
|
# 查看检测报告
|
||||||
def button_look_test_report(self):
|
def button_look_test_report(self):
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
('切割', '切割'), ('表面工艺', '表面工艺')
|
('切割', '切割'), ('表面工艺', '表面工艺')
|
||||||
], string="工序类型")
|
], string="工序类型")
|
||||||
results = fields.Char('结果')
|
results = fields.Char('结果')
|
||||||
state = fields.Selection(selection_add=[('to be detected', "待检测"), ('rework', '返工')])
|
state = fields.Selection(selection_add=[('to be detected', "待检测"), ('rework', '返工')], tracking=True)
|
||||||
|
|
||||||
manual_quotation = fields.Boolean('人工编程', default=False, readonly=True)
|
manual_quotation = fields.Boolean('人工编程', default=False, readonly=True)
|
||||||
|
|
||||||
@@ -433,6 +433,7 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
work.compensation_value_y = eval(self.material_center_point)[1]
|
work.compensation_value_y = eval(self.material_center_point)[1]
|
||||||
# work.process_state = '待加工'
|
# work.process_state = '待加工'
|
||||||
# self.sudo().production_id.process_state = '待加工'
|
# self.sudo().production_id.process_state = '待加工'
|
||||||
|
# self.sudo().production_id.process_state = '待加工'
|
||||||
self.date_finished = datetime.now()
|
self.date_finished = datetime.now()
|
||||||
workorder.button_finish()
|
workorder.button_finish()
|
||||||
|
|
||||||
@@ -464,7 +465,6 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
raise UserError(_("该工单暂未完成,无法进行工件配送"))
|
raise UserError(_("该工单暂未完成,无法进行工件配送"))
|
||||||
|
|
||||||
def button_rework_pre(self):
|
def button_rework_pre(self):
|
||||||
# production_ids |= self.production_id
|
|
||||||
return {
|
return {
|
||||||
'name': _('返工'),
|
'name': _('返工'),
|
||||||
'type': 'ir.actions.act_window',
|
'type': 'ir.actions.act_window',
|
||||||
@@ -473,7 +473,8 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
'target': 'new',
|
'target': 'new',
|
||||||
'context': {
|
'context': {
|
||||||
'default_workorder_id': self.id,
|
'default_workorder_id': self.id,
|
||||||
'default_production_ids': [(6, 0, [self.production_id.id])],
|
'default_production_id': self.production_id.id,
|
||||||
|
'default_routing_type': self.routing_type
|
||||||
}}
|
}}
|
||||||
|
|
||||||
# 拼接工单对象属性值
|
# 拼接工单对象属性值
|
||||||
@@ -819,13 +820,30 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
}]
|
}]
|
||||||
return workorders_values_str
|
return workorders_values_str
|
||||||
|
|
||||||
# @api.depends('production_availability', 'blocked_by_workorder_ids', 'blocked_by_workorder_ids.state')
|
@api.depends('production_availability', 'blocked_by_workorder_ids', 'blocked_by_workorder_ids.state')
|
||||||
# def _compute_state(self):
|
def _compute_state(self):
|
||||||
|
super()._compute_state()
|
||||||
|
for workorder in self:
|
||||||
|
if workorder.routing_type == '装夹预调' and workorder.state not in ['done', 'cancel', 'progress', 'rework']:
|
||||||
|
re_work = self.env['mrp.workorder'].search(
|
||||||
|
[('routing_type', '=', '装夹预调'), ('production_id', '=', workorder.production_id.id),
|
||||||
|
('processing_panel', '=', workorder.processing_panel), ('state', '=', 'rework')])
|
||||||
|
if re_work:
|
||||||
|
workorder.state = 'waiting'
|
||||||
|
elif workorder.routing_type == 'CNC加工' and workorder.state not in ['done', 'cancel', 'progress',
|
||||||
|
'rework']:
|
||||||
|
per_work = self.env['mrp.workorder'].search(
|
||||||
|
[('routing_type', '=', '装夹预调'), ('production_id', '=', workorder.production_id.id),
|
||||||
|
('processing_panel', '=', workorder.processing_panel), ('is_rework', '=', True)])
|
||||||
|
if per_work:
|
||||||
|
workorder.state = 'waiting'
|
||||||
|
# if workorder.routing_type == 'CNC加工' and workorder.state == 'progress':
|
||||||
|
# workorder.state = 'to be detected'
|
||||||
# for workorder in self:
|
# for workorder in self:
|
||||||
# if any(
|
# if workorder.is_rework is True and workorder.state == 'done':
|
||||||
# (wo.test_results == '返工' and wo.state == 'done') or wo.state == 'rework' for wo in
|
# cnc_work = self.env['mrp.workorder'].search([('routing_type','=','CNC加工'),('production_id','=',workorder.production_id.id)])
|
||||||
# production.workorder_ids):
|
# if cnc_work:
|
||||||
# production.state = 'rework'
|
# cnc_work.state = 'waiting'
|
||||||
# if workorder.state == 'pending':
|
# if workorder.state == 'pending':
|
||||||
# if all([wo.state in ('done', 'cancel') for wo in workorder.blocked_by_workorder_ids]):
|
# if all([wo.state in ('done', 'cancel') for wo in workorder.blocked_by_workorder_ids]):
|
||||||
# workorder.state = 'ready' if workorder.production_id.reservation_state == 'assigned' else 'waiting'
|
# workorder.state = 'ready' if workorder.production_id.reservation_state == 'assigned' else 'waiting'
|
||||||
|
|||||||
@@ -117,8 +117,13 @@
|
|||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="(//header//button[@name='button_scrap'])" position="replace">
|
<xpath expr="(//header//button[@name='button_scrap'])" position="replace">
|
||||||
<button name="button_scrap" invisible="1"/>
|
<button name="button_scrap" invisible="1"/>
|
||||||
<button name="button_rework" string="返工" type="object" groups="sf_base.group_sf_mrp_user"/>
|
<button name="do_update_program" string="更新程序" type="object" groups="sf_base.group_sf_mrp_user"
|
||||||
<button name="button_scrap_new" string="报废" type="object" groups="sf_base.group_sf_mrp_user"/>
|
confirm="是否确认更新程序"
|
||||||
|
attrs="{'invisible': ['&',('state', '!=', 'rework'), ('programming_state', '!=', '已编程未下发')]}"/>
|
||||||
|
<button name="button_rework" string="返工" type="object" groups="sf_base.group_sf_mrp_user"
|
||||||
|
attrs="{'invisible': [('state', '!=', 'rework')]}"/>
|
||||||
|
<button name="button_scrap_new" string="报废" type="object" groups="sf_base.group_sf_mrp_user"
|
||||||
|
confirm="是否确认报废" attrs="{'invisible': [('state', '!=', 'cancel')]}"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="(//header//button[@name='button_mark_done'])[3]" position="replace">
|
<xpath expr="(//header//button[@name='button_mark_done'])[3]" position="replace">
|
||||||
<button name="button_mark_done" attrs="{'invisible': [
|
<button name="button_mark_done" attrs="{'invisible': [
|
||||||
@@ -149,11 +154,11 @@
|
|||||||
attrs="{'invisible': ['|', ('is_planned', '=', False), ('state', '=', 'cancel')]}"
|
attrs="{'invisible': ['|', ('is_planned', '=', False), ('state', '=', 'cancel')]}"
|
||||||
data-hotkey="x" groups="sf_base.group_sf_mrp_user"/>
|
data-hotkey="x" groups="sf_base.group_sf_mrp_user"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//header//button[@name='button_scrap']" position="replace">
|
<!-- <xpath expr="//header//button[@name='button_scrap']" position="replace">-->
|
||||||
<button name="button_scrap" type="object" string="报废"
|
<!-- <button name="button_scrap" type="object" string="报废"-->
|
||||||
attrs="{'invisible': [('state', 'in', ('cancel', 'draft'))]}" data-hotkey="y"
|
<!-- attrs="{'invisible': [('state', 'in', ('cancel', 'draft'))]}" data-hotkey="y"-->
|
||||||
groups="sf_base.group_sf_mrp_user"/>
|
<!-- groups="sf_base.group_sf_mrp_user"/>-->
|
||||||
</xpath>
|
<!-- </xpath>-->
|
||||||
|
|
||||||
|
|
||||||
<xpath expr="//header//button[@name='action_confirm']" position="replace">
|
<xpath expr="//header//button[@name='action_confirm']" position="replace">
|
||||||
@@ -272,7 +277,7 @@
|
|||||||
</xpath>
|
</xpath>
|
||||||
|
|
||||||
<xpath expr="//sheet//notebook//page[@name='operations']" position="after">
|
<xpath expr="//sheet//notebook//page[@name='operations']" position="after">
|
||||||
<page string="检测报告" attrs="{'invisible': [('detection_result_ids', '=', [])]}">
|
<page string="检测结果" attrs="{'invisible': [('detection_result_ids', '=', [])]}">
|
||||||
<field name="detection_result_ids" string="" readonly="1">
|
<field name="detection_result_ids" string="" readonly="1">
|
||||||
<tree sample="1">
|
<tree sample="1">
|
||||||
<field name="production_id" invisible="1"/>
|
<field name="production_id" invisible="1"/>
|
||||||
@@ -281,6 +286,7 @@
|
|||||||
<field name="rework_reason"/>
|
<field name="rework_reason"/>
|
||||||
<field name="detailed_reason"/>
|
<field name="detailed_reason"/>
|
||||||
<field name="test_results"/>
|
<field name="test_results"/>
|
||||||
|
<field name="handle_result"/>
|
||||||
<field name="test_report" invisible="1"/>
|
<field name="test_report" invisible="1"/>
|
||||||
<button name="button_look_test_report" string="查看测试报告" type="object"
|
<button name="button_look_test_report" string="查看测试报告" type="object"
|
||||||
attrs="{'invisible': [('test_report', '=', False)]}"
|
attrs="{'invisible': [('test_report', '=', False)]}"
|
||||||
|
|||||||
@@ -160,19 +160,11 @@
|
|||||||
<!-- attrs="{'invisible': ['|', '|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '!=', 'blocked'),('state','=','done')]}"/> -->
|
<!-- attrs="{'invisible': ['|', '|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '!=', 'blocked'),('state','=','done')]}"/> -->
|
||||||
<button name="button_workpiece_delivery" type="object" string="工件配送" class="btn-primary"
|
<button name="button_workpiece_delivery" type="object" string="工件配送" class="btn-primary"
|
||||||
attrs="{'invisible': ['|','|',('routing_type','!=','装夹预调'),('is_delivery','=',True),('state','!=','done')]}"/>
|
attrs="{'invisible': ['|','|',('routing_type','!=','装夹预调'),('is_delivery','=',True),('state','!=','done')]}"/>
|
||||||
<<<<<<< HEAD
|
|
||||||
<button name="button_rework_pre" type="object" string="返工"
|
<button name="button_rework_pre" type="object" string="返工"
|
||||||
class="btn-primary"
|
class="btn-primary"
|
||||||
attrs="{'invisible': ['|','|',('routing_type','!=','装夹预调'),('state','!=','progress'),('is_rework','=',True)]}"/>
|
attrs="{'invisible': ['|','|',('routing_type','!=','装夹预调'),('state','!=','progress'),('is_rework','=',True)]}"/>
|
||||||
=======
|
|
||||||
<!-- <button name="button_send_program_again" type="object" string="重新下发NC程序" class="btn-primary"-->
|
|
||||||
<!-- confirm="是否确认重新下发NC程序?"-->
|
|
||||||
<!-- groups="sf_base.group_sf_order_user,sf_base.group_sf_equipment_user"-->
|
|
||||||
<!-- attrs="{'invisible': ['|', '|', '|',('routing_type','!=','装夹预调'),('state','in',['done', 'cancel',-->
|
|
||||||
<!-- 'progress']),('cnc_worksheet','=',False),('is_send_program_again','=',True)]}"/>-->
|
|
||||||
<button name="print_method" type="object" string="打印二维码" class="btn-primary"
|
<button name="print_method" type="object" string="打印二维码" class="btn-primary"
|
||||||
attrs="{'invisible': ['|',('routing_type','!=','解除装夹'),('state','!=','done')]}"/>
|
attrs="{'invisible': ['|',('routing_type','!=','解除装夹'),('state','!=','done')]}"/>
|
||||||
>>>>>>> 6a2ff72dce60612aeb6c6f2e1851081840f46322
|
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//page[1]" position="before">
|
<xpath expr="//page[1]" position="before">
|
||||||
<page string="开料要求" attrs='{"invisible": [("routing_type","!=","切割")]}'>
|
<page string="开料要求" attrs='{"invisible": [("routing_type","!=","切割")]}'>
|
||||||
@@ -596,6 +588,9 @@
|
|||||||
<field name="product_id" position="after">
|
<field name="product_id" position="after">
|
||||||
<field name="part_number" string="成品零件图号"/>
|
<field name="part_number" string="成品零件图号"/>
|
||||||
</field>
|
</field>
|
||||||
|
<xpath expr="//filter[@name='progress']" position="after">
|
||||||
|
<filter string="待检测" name="state" domain="[('state','=','to be detected')]"/>
|
||||||
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|||||||
@@ -16,23 +16,35 @@ class ReworkWizard(models.TransientModel):
|
|||||||
rework_reason = fields.Selection(
|
rework_reason = fields.Selection(
|
||||||
[("programming", "编程"), ("cutter", "刀具"), ("clamping", "装夹"),
|
[("programming", "编程"), ("cutter", "刀具"), ("clamping", "装夹"),
|
||||||
("operate computer", "操机"),
|
("operate computer", "操机"),
|
||||||
("technology", "工艺"), ("customer redrawing", "客户改图")], string="原因", tracking=True)
|
("technology", "工艺"), ("customer redrawing", "客户改图")], string="原因")
|
||||||
detailed_reason = fields.Text('详细原因')
|
detailed_reason = fields.Text('详细原因')
|
||||||
routing_type = fields.Selection([
|
routing_type = fields.Selection([
|
||||||
('装夹预调', '装夹预调'),
|
('装夹预调', '装夹预调'),
|
||||||
('CNC加工', 'CNC加工')], string="工序类型")
|
('CNC加工', 'CNC加工')], string="工序类型")
|
||||||
# 根据工单的加工面来显示
|
# 根据工单的加工面来显示
|
||||||
processing_panel_id = fields.Many2one('sf.processing.panel', string="加工面")
|
processing_panel_id = fields.Many2many('sf.processing.panel', string="加工面")
|
||||||
is_reprogramming = fields.Boolean(string='申请重新编程', default=False)
|
is_reprogramming = fields.Boolean(string='申请重新编程', default=False)
|
||||||
reprogramming_num = fields.Integer('重新编程次数', default=0)
|
reprogramming_num = fields.Integer('重新编程次数', default=0)
|
||||||
programming_state = fields.Selection(
|
programming_state = fields.Selection(
|
||||||
[('编程中', '编程中'), ('已编程', '已编程'), ('已编程未下发', '已编程未下发')], string='编程状态')
|
[('编程中', '编程中'), ('已编程', '已编程'), ('已编程未下发', '已编程未下发')], string='编程状态')
|
||||||
|
|
||||||
def confirm(self):
|
def confirm(self):
|
||||||
if self.is_reprogramming is True:
|
if self.routing_type in ['装夹预调', 'CNC加工']:
|
||||||
|
self.workorder_id.is_rework = True
|
||||||
|
self.production_id.write({'detection_result_ids': [(0, 0, {
|
||||||
|
'rework_reason': self.rework_reason,
|
||||||
|
'detailed_reason': self.detailed_reason,
|
||||||
|
'processing_panel': self.workorder_id.processing_panel,
|
||||||
|
'routing_type': self.workorder_id.routing_type,
|
||||||
|
'handle_result': '待处理' if self.test_results == '返工' else '',
|
||||||
|
'test_results': '返工' if not self.routing_type == 'CNC加工' else self.workorder_id.test_results,
|
||||||
|
'test_report': self.workorder_id.detection_report})]})
|
||||||
|
self.workorder_id.button_finish()
|
||||||
|
else:
|
||||||
if self.production_id.workorder_ids:
|
if self.production_id.workorder_ids:
|
||||||
|
for panel in self.processing_panel_id:
|
||||||
panel_workorder = self.production_id.workorder_ids.filtered(
|
panel_workorder = self.production_id.workorder_ids.filtered(
|
||||||
lambda ap: ap.processing_panel == self.processing_panel_id.name)
|
lambda ap: ap.processing_panel == panel.name and ap.state != 'rework')
|
||||||
if panel_workorder:
|
if panel_workorder:
|
||||||
panel_workorder.write({'state': 'rework'})
|
panel_workorder.write({'state': 'rework'})
|
||||||
product_routing_workcenter = self.env['sf.product.model.type.routing.sort'].search(
|
product_routing_workcenter = self.env['sf.product.model.type.routing.sort'].search(
|
||||||
@@ -43,35 +55,33 @@ class ReworkWizard(models.TransientModel):
|
|||||||
for route in product_routing_workcenter:
|
for route in product_routing_workcenter:
|
||||||
if route.is_repeat is True:
|
if route.is_repeat is True:
|
||||||
workorders_values.append(
|
workorders_values.append(
|
||||||
self.env['mrp.workorder'].json_workorder_str(self.processing_panel_id.name,
|
self.env['mrp.workorder'].json_workorder_str(panel.name,
|
||||||
self.production_id, route, False))
|
self.production_id, route, False))
|
||||||
if workorders_values:
|
if workorders_values:
|
||||||
self.production_id.write(
|
self.production_id.write(
|
||||||
{'workorder_ids': workorders_values, 'programming_state': '编程中', 'work_state': '编程中',
|
{'workorder_ids': workorders_values, 'programming_state': '编程中', 'work_state': '编程中',
|
||||||
'reprogramming_num': self.production_id.reprogramming_num + 1})
|
'reprogramming_num': self.production_id.reprogramming_num + 1})
|
||||||
self.production_id._reset_work_order_sequence()
|
self.production_id._reset_work_order_sequence()
|
||||||
|
self.production_id.detection_result_ids.filtered(
|
||||||
|
lambda ap1: ap1.processing_panel == panel.name and ap1.handle_result == '待处理').write(
|
||||||
|
{'handle_result': '已处理'})
|
||||||
|
if self.is_reprogramming is True:
|
||||||
self.production_id.update_programming_state()
|
self.production_id.update_programming_state()
|
||||||
else:
|
else:
|
||||||
self.workorder_id.is_rework = True
|
self.production_id.do_update_program()
|
||||||
self.production_id.write({'detection_result_ids': [(0, 0, {
|
|
||||||
'rework_reason': self.rework_reason,
|
|
||||||
'detailed_reason': self.detailed_reason,
|
|
||||||
# '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')
|
@api.onchange('production_id')
|
||||||
def onchange_processing_panel_id(self):
|
def onchange_processing_panel_id(self):
|
||||||
for item in self:
|
for item in self:
|
||||||
domain = [('id', '=', False)]
|
domain = [('id', '=', False)]
|
||||||
product_id = item.product_id
|
production_id = item.production_id
|
||||||
if product_id:
|
if product_id:
|
||||||
if self.env.user.has_group('sf_base.group_sf_order_user'):
|
if self.env.user.has_group('sf_base.group_sf_order_user'):
|
||||||
panel_ids = []
|
panel_ids = []
|
||||||
for p in product_id.model_processing_panel.split(','):
|
for p in production_id.detection_result_ids.filtered(
|
||||||
|
lambda ap1: ap1.handle_result == '待处理'):
|
||||||
panel = self.env['sf.processing.panel'].search(
|
panel = self.env['sf.processing.panel'].search(
|
||||||
[('name', 'ilike', p)])
|
[('name', 'ilike', p.processing_panel)])
|
||||||
if panel:
|
if panel:
|
||||||
panel_ids.append(panel.id)
|
panel_ids.append(panel.id)
|
||||||
domain = {'processing_panel_id': [('id', 'in', panel_ids)]}
|
domain = {'processing_panel_id': [('id', 'in', panel_ids)]}
|
||||||
|
|||||||
@@ -9,11 +9,12 @@
|
|||||||
<field name="production_id" invisible="True"/>
|
<field name="production_id" invisible="True"/>
|
||||||
<field name="workorder_id" invisible="True"/>
|
<field name="workorder_id" invisible="True"/>
|
||||||
<field name="product_id" invisible="True"/>
|
<field name="product_id" invisible="True"/>
|
||||||
|
<field name="routing_type" invisible="0"/>
|
||||||
<group>
|
<group>
|
||||||
<field name="processing_panel_id" options="{'no_create': True}"/>
|
<field name="processing_panel_id" options="{'no_create': True}"
|
||||||
|
attrs='{"invisible": [("routing_type","=","装夹预调")]}' widget="many2many_tags"/>
|
||||||
</group>
|
</group>
|
||||||
|
<div attrs='{"invisible": [("reprogramming_num","=",0)]}'>
|
||||||
<div>
|
|
||||||
注意*: 该制造订单的产品已重复编程过<field name="reprogramming_num" string=""
|
注意*: 该制造订单的产品已重复编程过<field name="reprogramming_num" string=""
|
||||||
readonly="1"
|
readonly="1"
|
||||||
style='color:red;'/>次,且当前编程状态为
|
style='color:red;'/>次,且当前编程状态为
|
||||||
@@ -24,11 +25,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<group>
|
<group>
|
||||||
<field name="is_reprogramming"
|
<field name="is_reprogramming"
|
||||||
attrs='{"invisible": [("is_reprogramming","=",False)],"readonly": [("programming_state","in",["编程中","已编程未下发时"])]}'/>
|
attrs='{"invisible": [("programming_state","=",False)],"readonly": [("programming_state","in",["编程中","已编程未下发时"])]}'/>
|
||||||
<field name="rework_reason"
|
<field name="rework_reason"
|
||||||
attrs='{"invisible": [("is_reprogramming","=",True)],"required": [("is_reprogramming","=",False)]}'/>
|
attrs='{"invisible": [("routing_type","!=","")],"required": [("routing_type","in",["装夹预调"])]}'/>
|
||||||
<field name="detailed_reason"
|
<field name="detailed_reason"
|
||||||
attrs='{"invisible": [("is_reprogramming","=",True)],"required": [("is_reprogramming","=",False)]}'/>
|
attrs='{"invisible": [("routing_type","!=","")],"required": [("routing_type","in",["装夹预调"])]}'/>
|
||||||
</group>
|
</group>
|
||||||
<footer>
|
<footer>
|
||||||
<button string="确认" name="confirm" type="object" class="oe_highlight" confirm="是否确认返工"/>
|
<button string="确认" name="confirm" type="object" class="oe_highlight" confirm="是否确认返工"/>
|
||||||
|
|||||||
@@ -102,11 +102,11 @@
|
|||||||
attrs="{'invisible': ['|', '|', '|', ('picking_type_code', '=', 'incoming'), ('immediate_transfer', '=', True), '&', ('state', '!=', 'assigned'), ('move_type', '!=', 'one'), '&', ('state', 'not in', ('assigned', 'confirmed')), ('move_type', '=', 'one')]}"
|
attrs="{'invisible': ['|', '|', '|', ('picking_type_code', '=', 'incoming'), ('immediate_transfer', '=', True), '&', ('state', '!=', 'assigned'), ('move_type', '!=', 'one'), '&', ('state', 'not in', ('assigned', 'confirmed')), ('move_type', '=', 'one')]}"
|
||||||
data-hotkey="w"/>
|
data-hotkey="w"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//form//header//button[@name='button_scrap']" position="replace">
|
<!-- <xpath expr="//form//header//button[@name='button_scrap']" position="replace">-->
|
||||||
<button name="button_scrap" groups="sf_base.group_sf_stock_user" type="object" string="报废"
|
<!-- <button name="button_scrap" groups="sf_base.group_sf_stock_user" type="object" string="报废"-->
|
||||||
attrs="{'invisible': ['|', '&', ('picking_type_code', '=', 'incoming'), ('state', '!=', 'done'), '&', ('picking_type_code', '=', 'outgoing'), ('state', '=', 'done')]}"
|
<!-- attrs="{'invisible': ['|', '&', ('picking_type_code', '=', 'incoming'), ('state', '!=', 'done'), '&', ('picking_type_code', '=', 'outgoing'), ('state', '=', 'done')]}"-->
|
||||||
data-hotkey="y"/>
|
<!-- data-hotkey="y"/>-->
|
||||||
</xpath>
|
<!-- </xpath>-->
|
||||||
<xpath expr="//form//header//button[@name='action_assign']" position="replace">
|
<xpath expr="//form//header//button[@name='action_assign']" position="replace">
|
||||||
<button name="action_assign" attrs="{'invisible': [('show_check_availability', '=', False)]}"
|
<button name="action_assign" attrs="{'invisible': [('show_check_availability', '=', False)]}"
|
||||||
string="检查可用量" type="object" class="oe_highlight"
|
string="检查可用量" type="object" class="oe_highlight"
|
||||||
|
|||||||
Reference in New Issue
Block a user