修改退回工艺设计后再确认,采购单编程草稿状态
This commit is contained in:
@@ -783,7 +783,7 @@ class MrpProduction(models.Model):
|
|||||||
workorder.duration_expected = workorder._get_duration_expected()
|
workorder.duration_expected = workorder._get_duration_expected()
|
||||||
|
|
||||||
# 外协出入库单处理
|
# 外协出入库单处理
|
||||||
def get_subcontract_pick_purchase(self):
|
def get_subcontract_pick_purchase(self, special_design_workorder):
|
||||||
production_all = self.sorted(lambda x: x.id)
|
production_all = self.sorted(lambda x: x.id)
|
||||||
product_id_to_production_names = {}
|
product_id_to_production_names = {}
|
||||||
grouped_product_ids = {k: list(g) for k, g in
|
grouped_product_ids = {k: list(g) for k, g in
|
||||||
@@ -792,18 +792,19 @@ class MrpProduction(models.Model):
|
|||||||
product_id_to_production_names[product_id] = [p.name for p in pd]
|
product_id_to_production_names[product_id] = [p.name for p in pd]
|
||||||
sorted_workorders = None
|
sorted_workorders = None
|
||||||
for production in production_all:
|
for production in production_all:
|
||||||
proc_workorders = []
|
# proc_workorders = []
|
||||||
process_parameter_workorder = self.env['mrp.workorder'].search(
|
# process_parameter_workorder = self.env['mrp.workorder'].search(
|
||||||
[('surface_technics_parameters_id', '!=', False), ('production_id', '=', production.id),
|
# [('surface_technics_parameters_id', '!=', False), ('production_id', '=', production.id),
|
||||||
('is_subcontract', '=', True), ('state', '!=', 'cancel')], order='sequence asc')
|
# ('is_subcontract', '=', True), ('state', '!=', 'cancel')], order='sequence asc')
|
||||||
if process_parameter_workorder:
|
# need_delete_workorder = process_parameter_workorder - special_design_workorder
|
||||||
# 将这些特殊表面工艺工单的采购单与调拨单置为失效
|
# for workorder in need_delete_workorder:
|
||||||
for workorder in process_parameter_workorder:
|
# workorder._get_surface_technics_purchase_ids().write({'active': False})
|
||||||
workorder._get_surface_technics_purchase_ids().write({'state': 'cancel'})
|
# workorder.move_subcontract_workorder_ids.write({'state': 'cancel'})
|
||||||
workorder.move_subcontract_workorder_ids.write({'state': 'cancel'})
|
# workorder.move_subcontract_workorder_ids.picking_id.write({'active': False})
|
||||||
workorder.move_subcontract_workorder_ids.picking_id.write({'state': 'cancel'})
|
|
||||||
|
if special_design_workorder:
|
||||||
consecutive_workorders = []
|
consecutive_workorders = []
|
||||||
sorted_workorders = sorted(process_parameter_workorder, key=lambda w: w.sequence)
|
sorted_workorders = sorted(special_design_workorder, key=lambda w: w.sequence)
|
||||||
# for i, workorder in enumerate(sorted_workorders):
|
# for i, workorder in enumerate(sorted_workorders):
|
||||||
# # 检查当前工作订单和下一个工作订单是否连续,并且供应商相同
|
# # 检查当前工作订单和下一个工作订单是否连续,并且供应商相同
|
||||||
# if i == 0:
|
# if i == 0:
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ class ProductionTechnologyWizard(models.TransientModel):
|
|||||||
# td_upd = self.env['sf.technology.design'].sudo().search(domain)
|
# td_upd = self.env['sf.technology.design'].sudo().search(domain)
|
||||||
# if td_upd:
|
# if td_upd:
|
||||||
# ro.write({'sequence': td_upd.sequence, 'active': td_upd.active})
|
# ro.write({'sequence': td_upd.sequence, 'active': td_upd.active})
|
||||||
|
# 特殊表面工艺
|
||||||
special_design = self.env['sf.technology.design'].sudo().search(
|
special_design = self.env['sf.technology.design'].sudo().search(
|
||||||
[('routing_tag', '=', 'special'), ('production_id', '=', production.id),
|
[('routing_tag', '=', 'special'), ('production_id', '=', production.id),
|
||||||
('is_auto', '=', False), ('active', 'in', [True, False])])
|
('is_auto', '=', False), ('active', 'in', [True, False])])
|
||||||
@@ -112,7 +113,9 @@ class ProductionTechnologyWizard(models.TransientModel):
|
|||||||
workorder.blocked_by_workorder_ids = blocked_by_workorder_ids[0]
|
workorder.blocked_by_workorder_ids = blocked_by_workorder_ids[0]
|
||||||
productions._create_workorder(False)
|
productions._create_workorder(False)
|
||||||
if self.production_id.product_id.categ_id.type == '成品':
|
if self.production_id.product_id.categ_id.type == '成品':
|
||||||
productions.get_subcontract_pick_purchase()
|
special_design_workorder = self.env['mrp.workorder'].search(
|
||||||
|
[('technology_design_id', 'in', special_design.ids), ('production_id', '=', special.production_id.id), ('state', '!=', 'cancel')])
|
||||||
|
productions.get_subcontract_pick_purchase(special_design_workorder)
|
||||||
productions.is_adjust = False
|
productions.is_adjust = False
|
||||||
for item in productions:
|
for item in productions:
|
||||||
workorder = item.workorder_ids.filtered(lambda wo: wo.state not in ('cancel')).sorted(
|
workorder = item.workorder_ids.filtered(lambda wo: wo.state not in ('cancel')).sorted(
|
||||||
|
|||||||
@@ -363,7 +363,6 @@ class RePurchaseOrder(models.Model):
|
|||||||
server_product_process = []
|
server_product_process = []
|
||||||
purchase_order = pp._get_surface_technics_purchase_ids()
|
purchase_order = pp._get_surface_technics_purchase_ids()
|
||||||
if purchase_order:
|
if purchase_order:
|
||||||
purchase_order.write({'state': 'draft'})
|
|
||||||
pp.purchase_id = [(6, 0, [purchase_order.id])]
|
pp.purchase_id = [(6, 0, [purchase_order.id])]
|
||||||
else:
|
else:
|
||||||
server_template = self.env['product.template'].search(
|
server_template = self.env['product.template'].search(
|
||||||
|
|||||||
Reference in New Issue
Block a user