工艺确认弹框优化
This commit is contained in:
@@ -378,16 +378,37 @@ class MrpProduction(models.Model):
|
||||
if process_parameters:
|
||||
raise UserError(_("【工艺设计】-【参数】为%s的在【产品】中不存在,请先创建", ", ".join(process_parameters)))
|
||||
if production_confirmed:
|
||||
return {
|
||||
'name': _('退回调整'),
|
||||
'type': 'ir.actions.act_window',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'sf.production.technology.re_adjust.wizard',
|
||||
'target': 'new',
|
||||
'context': {
|
||||
'default_production_id': self.id,
|
||||
'default_origin': self.origin,
|
||||
}}
|
||||
production_count = self.env['mrp.production'].search_count([
|
||||
('origin', '=', self.origin),
|
||||
('product_id', '=', self.product_id.id),
|
||||
('state', '=', 'confirmed')
|
||||
])
|
||||
if production_count > 1:
|
||||
return {
|
||||
'name': _('退回调整'),
|
||||
'type': 'ir.actions.act_window',
|
||||
'views': [(self.env.ref(
|
||||
'sf_manufacturing.sf_production_technology_re_adjust_wizard_form_view').id,
|
||||
'form')],
|
||||
'res_model': 'sf.production.technology.re_adjust.wizard',
|
||||
'target': 'new',
|
||||
'context': {
|
||||
'default_production_id': self.id,
|
||||
'default_origin': self.origin,
|
||||
}}
|
||||
else:
|
||||
return {
|
||||
'name': _('退回调整'),
|
||||
'type': 'ir.actions.act_window',
|
||||
'views': [(self.env.ref(
|
||||
'sf_manufacturing.sf_production_technology_re_adjust_wizard_confirm_form_view').id,
|
||||
'form')],
|
||||
'res_model': 'sf.production.technology.re_adjust.wizard',
|
||||
'target': 'new',
|
||||
'context': {
|
||||
'default_production_id': self.id,
|
||||
'default_origin': self.origin,
|
||||
}}
|
||||
|
||||
# 工艺确认
|
||||
def technology_confirm(self):
|
||||
@@ -441,16 +462,37 @@ class MrpProduction(models.Model):
|
||||
error_panel.append(design.panel)
|
||||
else:
|
||||
if not error_panel and not process_parameters:
|
||||
return {
|
||||
'name': _('工艺确认'),
|
||||
'type': 'ir.actions.act_window',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'sf.production.technology.wizard',
|
||||
'target': 'new',
|
||||
'context': {
|
||||
'default_production_id': self.id,
|
||||
'default_origin': self.origin,
|
||||
}}
|
||||
production_count = self.env['mrp.production'].search_count([
|
||||
('origin', '=', self.origin),
|
||||
('product_id', '=', self.product_id.id),
|
||||
('state', '=', 'technology_to_confirmed')
|
||||
])
|
||||
if production_count > 1:
|
||||
return {
|
||||
'name': _('工艺确认'),
|
||||
'type': 'ir.actions.act_window',
|
||||
'views': [(self.env.ref(
|
||||
'sf_manufacturing.sf_production_technology_wizard_form_view').id,
|
||||
'form')],
|
||||
'res_model': 'sf.production.technology.wizard',
|
||||
'target': 'new',
|
||||
'context': {
|
||||
'default_production_id': self.id,
|
||||
'default_origin': self.origin,
|
||||
}}
|
||||
else:
|
||||
return {
|
||||
'name': _('工艺确认'),
|
||||
'type': 'ir.actions.act_window',
|
||||
'views': [(self.env.ref(
|
||||
'sf_manufacturing.sf_production_technology_wizard_confirm_form_view').id,
|
||||
'form')],
|
||||
'res_model': 'sf.production.technology.wizard',
|
||||
'target': 'new',
|
||||
'context': {
|
||||
'default_production_id': self.id,
|
||||
'default_origin': self.origin,
|
||||
}}
|
||||
if error_panel:
|
||||
raise UserError(_("【加工面】为%s的标准工序顺序有误,请调整后重试", ", ".join(error_panel)))
|
||||
return True
|
||||
@@ -762,7 +804,7 @@ class MrpProduction(models.Model):
|
||||
# 立即创建外协出入库单和采购订单
|
||||
# self.env['stock.picking'].create_outcontract_picking(workorder, production)
|
||||
# self.env['purchase.order'].get_purchase_order(workorder, production,
|
||||
# product_id_to_production_names)
|
||||
# product_id_to_production_names)
|
||||
consecutive_workorders = []
|
||||
|
||||
# 处理最后一个组,即使它可能只有一个工作订单
|
||||
@@ -774,6 +816,7 @@ class MrpProduction(models.Model):
|
||||
for workorders in reversed(proc_workorders):
|
||||
self.env['stock.picking'].create_outcontract_picking(workorders, production, sorted_workorders)
|
||||
self.env['purchase.order'].get_purchase_order(workorders, production, product_id_to_production_names)
|
||||
|
||||
# 工单排序
|
||||
def _reset_work_order_sequence1(self, k):
|
||||
for rec in self:
|
||||
|
||||
Reference in New Issue
Block a user