Accept Merge Request #1533: (feature/优化外协采购和出入库单(工艺退回调整) -> develop)
Merge Request: 优化外协采购和出入库单(工艺退回调整) Created By: @杨金灵 Reviewed By: @胡尧 Approved By: @胡尧 Accepted By: @杨金灵 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1533
This commit is contained in:
@@ -321,7 +321,6 @@ class StockRule(models.Model):
|
||||
i = 0
|
||||
if production_item.product_id.categ_id.type == '成品':
|
||||
# 根据加工面板的面数及成品工序模板生成工序设计
|
||||
|
||||
for k in (production_item.product_id.model_processing_panel.split(',')):
|
||||
if production_item.production_type == '自动化产线加工':
|
||||
product_routing_workcenter = self.env['sf.product.model.type.routing.sort'].search(
|
||||
@@ -337,7 +336,7 @@ class StockRule(models.Model):
|
||||
i += 1
|
||||
technology_design_values.append(
|
||||
self.env['sf.technology.design'].json_technology_design_str(k, route, i, False))
|
||||
elif production.product_id.categ_id.type == '坯料':
|
||||
elif production_item.product_id.categ_id.type == '坯料':
|
||||
embryo_routing_workcenter = self.env['sf.embryo.model.type.routing.sort'].search(
|
||||
[('embryo_model_type_id', '=', production_item.product_id.embryo_model_type_id.id)],
|
||||
order='sequence asc'
|
||||
@@ -378,7 +377,6 @@ class StockRule(models.Model):
|
||||
process_parameter))
|
||||
productions.technology_design_ids = technology_design_values
|
||||
|
||||
|
||||
return True
|
||||
|
||||
|
||||
@@ -661,41 +659,40 @@ class StockPicking(models.Model):
|
||||
def create_outcontract_picking(self, sorted_workorders_arr, item):
|
||||
if len(sorted_workorders_arr) > 1:
|
||||
sorted_workorders_arr = sorted_workorders_arr[0]
|
||||
stock_picking = self.env['stock.picking'].search(
|
||||
[('origin', '=', sorted_workorders_arr.production_id.name), ('name', 'ilike', 'OCOUT')])
|
||||
if not stock_picking:
|
||||
stock_picking = self.env['stock.picking'].search([('origin', '=', item.name), ('name', 'ilike', 'OCOUT')])
|
||||
if not stock_picking or sorted_workorders_arr:
|
||||
for sorted_workorders in sorted_workorders_arr:
|
||||
# pick_ids = []
|
||||
if not sorted_workorders.picking_ids:
|
||||
outcontract_stock_move = self.env['stock.move'].search([('production_id', '=', item.id)])
|
||||
if not outcontract_stock_move:
|
||||
new_picking = True
|
||||
location_id = self.env['stock.location'].search(
|
||||
[('barcode', 'ilike', 'VL-SPOC')]).id,
|
||||
location_dest_id = self.env['stock.location'].search(
|
||||
[('barcode', 'ilike', 'WH-PREPRODUCTION')]).id,
|
||||
outcontract_picking_type_in = self.env.ref(
|
||||
'sf_manufacturing.outcontract_picking_in').id,
|
||||
outcontract_picking_type_out = self.env.ref(
|
||||
'sf_manufacturing.outcontract_picking_out').id,
|
||||
moves_out = self.env['stock.move'].sudo().create(
|
||||
self.env['stock.move']._get_stock_move_values_Res(item, location_dest_id, location_id,
|
||||
outcontract_picking_type_out))
|
||||
picking_out = self.create(
|
||||
moves_out._get_new_picking_values_Res(item, sorted_workorders, 'WH/OCOUT/'))
|
||||
# pick_ids.append(picking_out.id)
|
||||
moves_out.write(
|
||||
{'picking_id': picking_out.id, 'state': 'waiting'})
|
||||
moves_out._assign_picking_post_process(new=new_picking)
|
||||
moves_in = self.env['stock.move'].sudo().create(
|
||||
self.env['stock.move']._get_stock_move_values_Res(item, location_id, location_dest_id,
|
||||
outcontract_picking_type_in))
|
||||
picking_in = self.create(
|
||||
moves_in._get_new_picking_values_Res(item, sorted_workorders, 'WH/OCIN/'))
|
||||
# pick_ids.append(picking_in.id)
|
||||
moves_in.write(
|
||||
{'picking_id': picking_in.id, 'state': 'waiting'})
|
||||
moves_in._assign_picking_post_process(new=new_picking)
|
||||
# outcontract_stock_move = self.env['stock.move'].search([('production_id', '=', item.id)])
|
||||
# if not outcontract_stock_move:
|
||||
new_picking = True
|
||||
location_id = self.env['stock.location'].search(
|
||||
[('barcode', 'ilike', 'VL-SPOC')]).id,
|
||||
location_dest_id = self.env['stock.location'].search(
|
||||
[('barcode', 'ilike', 'WH-PREPRODUCTION')]).id,
|
||||
outcontract_picking_type_in = self.env.ref(
|
||||
'sf_manufacturing.outcontract_picking_in').id,
|
||||
outcontract_picking_type_out = self.env.ref(
|
||||
'sf_manufacturing.outcontract_picking_out').id,
|
||||
moves_out = self.env['stock.move'].sudo().create(
|
||||
self.env['stock.move']._get_stock_move_values_Res(item, location_dest_id, location_id,
|
||||
outcontract_picking_type_out))
|
||||
picking_out = self.create(
|
||||
moves_out._get_new_picking_values_Res(item, sorted_workorders, 'WH/OCOUT/'))
|
||||
# pick_ids.append(picking_out.id)
|
||||
moves_out.write(
|
||||
{'picking_id': picking_out.id, 'state': 'waiting'})
|
||||
moves_out._assign_picking_post_process(new=new_picking)
|
||||
moves_in = self.env['stock.move'].sudo().create(
|
||||
self.env['stock.move']._get_stock_move_values_Res(item, location_id, location_dest_id,
|
||||
outcontract_picking_type_in))
|
||||
picking_in = self.create(
|
||||
moves_in._get_new_picking_values_Res(item, sorted_workorders, 'WH/OCIN/'))
|
||||
# pick_ids.append(picking_in.id)
|
||||
moves_in.write(
|
||||
{'picking_id': picking_in.id, 'state': 'waiting'})
|
||||
moves_in._assign_picking_post_process(new=new_picking)
|
||||
|
||||
|
||||
class ReStockMove(models.Model):
|
||||
@@ -731,7 +728,7 @@ class ReStockMove(models.Model):
|
||||
return {
|
||||
'name': self.env['stock.picking']._get_name_Res(rescode),
|
||||
'origin': item.name,
|
||||
# 'surface_technics_parameters_id': sorted_workorders.surface_technics_parameters_id.id,
|
||||
'surface_technics_parameters_id': sorted_workorders.surface_technics_parameters_id.id,
|
||||
'company_id': self.mapped('company_id').id,
|
||||
'user_id': False,
|
||||
'move_type': self.mapped('group_id').move_type or 'direct',
|
||||
|
||||
Reference in New Issue
Block a user