|
|
|
|
@@ -649,10 +649,10 @@ class StockPicking(models.Model):
|
|
|
|
|
for mi in move_in:
|
|
|
|
|
pick = self.env['stock.picking'].search([('id', '=', mi.picking_id.id), ('name', 'ilike', 'OCIN'),
|
|
|
|
|
('partner_id', '=', self.partner_id.id)])
|
|
|
|
|
if pick:
|
|
|
|
|
if mi.state != 'done':
|
|
|
|
|
mi.write({'state': 'assigned'})
|
|
|
|
|
self.env['stock.move.line'].create(mi.get_move_line(production, None))
|
|
|
|
|
# if pick:
|
|
|
|
|
# if mi.state != 'done':
|
|
|
|
|
# mi.write({'state': 'assigned'})
|
|
|
|
|
# self.env['stock.move.line'].create(mi.get_move_line(production, None))
|
|
|
|
|
|
|
|
|
|
return res
|
|
|
|
|
|
|
|
|
|
@@ -671,6 +671,11 @@ class StockPicking(models.Model):
|
|
|
|
|
if not sorted_workorders.picking_ids:
|
|
|
|
|
# outcontract_stock_move = self.env['stock.move'].search([('production_id', '=', item.id)])
|
|
|
|
|
# if not outcontract_stock_move:
|
|
|
|
|
# 创建一个新的补货组
|
|
|
|
|
procurement_group_id = self.env['procurement.group'].create({
|
|
|
|
|
'name': sorted_workorders.name,
|
|
|
|
|
'partner_id': self.partner_id.id,
|
|
|
|
|
})
|
|
|
|
|
new_picking = True
|
|
|
|
|
location_id = self.env['stock.location'].search(
|
|
|
|
|
[('barcode', 'ilike', 'VL-SPOC')]).id,
|
|
|
|
|
@@ -680,24 +685,25 @@ class StockPicking(models.Model):
|
|
|
|
|
'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))
|
|
|
|
|
outcontract_picking_type_in, procurement_group_id.id))
|
|
|
|
|
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)
|
|
|
|
|
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, procurement_group_id.id, moves_in.id))
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ReStockMove(models.Model):
|
|
|
|
|
@@ -707,7 +713,7 @@ class ReStockMove(models.Model):
|
|
|
|
|
materiel_width = fields.Float(string='物料宽度', digits=(16, 4))
|
|
|
|
|
materiel_height = fields.Float(string='物料高度', digits=(16, 4))
|
|
|
|
|
|
|
|
|
|
def _get_stock_move_values_Res(self, item, location_src_id, location_dest_id, picking_type_id):
|
|
|
|
|
def _get_stock_move_values_Res(self, item, location_src_id, location_dest_id, picking_type_id, group_id, move_dest_ids=False):
|
|
|
|
|
route = self.env['stock.route'].sudo().search([('name', '=', '表面工艺外协')])
|
|
|
|
|
move_values = {
|
|
|
|
|
'name': '推',
|
|
|
|
|
@@ -718,6 +724,8 @@ class ReStockMove(models.Model):
|
|
|
|
|
'location_id': location_src_id,
|
|
|
|
|
'location_dest_id': location_dest_id,
|
|
|
|
|
'origin': item.name,
|
|
|
|
|
'group_id': group_id,
|
|
|
|
|
'move_dest_ids': [(6, 0, [move_dest_ids])] if move_dest_ids else False,
|
|
|
|
|
# 'route_ids': False if not route else [(4, route.id)],
|
|
|
|
|
'date_deadline': datetime.now(),
|
|
|
|
|
'picking_type_id': picking_type_id,
|
|
|
|
|
|