表面工艺外协需求,不包含页面展示外协出入库单
This commit is contained in:
@@ -142,7 +142,7 @@ class MrpProduction(models.Model):
|
||||
[('production_process_ids.id', 'in', surface_technics_arr)],
|
||||
order='sequence asc'
|
||||
)
|
||||
#用filter刷选表面工艺id'是否存在工艺类别对象里
|
||||
# 用filter刷选表面工艺id'是否存在工艺类别对象里
|
||||
if production_process_category:
|
||||
for p in production_process_category:
|
||||
production_process = p.production_process_ids.filtered(
|
||||
@@ -176,7 +176,8 @@ class MrpProduction(models.Model):
|
||||
self.env['mrp.workorder'].json_workorder_str('', production, route))
|
||||
production.workorder_ids = workorders_values
|
||||
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)])
|
||||
if process_parameter_workorder:
|
||||
is_pick = False
|
||||
consecutive_workorders = []
|
||||
@@ -185,10 +186,8 @@ class MrpProduction(models.Model):
|
||||
for i in range(len(sorted_workorders) - 1):
|
||||
if m == 0:
|
||||
is_pick = False
|
||||
# if sorted_workorders[i].id in consecutive_workorders:
|
||||
# consecutive_workorders = [x for x in consecutive_workorders if x not in sorted_workorders[i].id]
|
||||
# continue
|
||||
if sorted_workorders[i].supplier_id == sorted_workorders[i + 1].supplier_id and \
|
||||
if sorted_workorders[i].supplier_id.id == sorted_workorders[i + 1].supplier_id.id and \
|
||||
sorted_workorders[i].is_subcontract == sorted_workorders[i + 1].is_subcontract and \
|
||||
sorted_workorders[i].id == sorted_workorders[i + 1].id - 1:
|
||||
if sorted_workorders[i] not in consecutive_workorders:
|
||||
consecutive_workorders.append(sorted_workorders[i])
|
||||
@@ -196,16 +195,16 @@ class MrpProduction(models.Model):
|
||||
m += 1
|
||||
continue
|
||||
else:
|
||||
if m == len(consecutive_workorders)-1 and m != 0:
|
||||
if m == len(consecutive_workorders) - 1 and m != 0:
|
||||
self.env['stock.picking'].create_outcontract_picking(consecutive_workorders, production)
|
||||
if sorted_workorders[i] in consecutive_workorders:
|
||||
is_pick = True
|
||||
is_pick = True
|
||||
consecutive_workorders = []
|
||||
m = 0
|
||||
# 当前面的连续工序生成对应的外协出入库单再生成当前工序的外协出入库单
|
||||
if is_pick is False:
|
||||
self.env['stock.picking'].create_outcontract_picking(sorted_workorders[i], production)
|
||||
if m == len(consecutive_workorders)-1 and m != 0:
|
||||
if m == len(consecutive_workorders) - 1 and m != 0:
|
||||
self.env['stock.picking'].create_outcontract_picking(consecutive_workorders, production)
|
||||
if sorted_workorders[i] in consecutive_workorders:
|
||||
is_pick = True
|
||||
@@ -213,7 +212,7 @@ class MrpProduction(models.Model):
|
||||
m = 0
|
||||
if m == len(consecutive_workorders) - 1 and m != 0:
|
||||
self.env['stock.picking'].create_outcontract_picking(consecutive_workorders, production)
|
||||
if is_pick is False:
|
||||
if is_pick is False and m == 0:
|
||||
self.env['stock.picking'].create_outcontract_picking(sorted_workorders[i], production)
|
||||
for workorder in production.workorder_ids:
|
||||
workorder.duration_expected = workorder._get_duration_expected()
|
||||
@@ -240,7 +239,7 @@ class MrpProduction(models.Model):
|
||||
'user_id': production.user_id.id}
|
||||
return production_values_str
|
||||
|
||||
def _get_stock_move_values_Res(self,item,location_src_id,location_dest_id):
|
||||
def _get_stock_move_values_Res(self, item, location_src_id, location_dest_id, picking_type_id):
|
||||
move_values = {
|
||||
'name': item.name if item.name else '/',
|
||||
'company_id': item.company_id.id,
|
||||
@@ -250,7 +249,7 @@ class MrpProduction(models.Model):
|
||||
'location_id': location_src_id,
|
||||
'location_dest_id': location_dest_id,
|
||||
'origin': item.origin,
|
||||
'picking_type_id': self.picking_type_id.id,
|
||||
'picking_type_id': picking_type_id,
|
||||
}
|
||||
return move_values
|
||||
|
||||
|
||||
Reference in New Issue
Block a user