修复报废-外协入库验证

This commit is contained in:
jinling.yang
2024-09-02 17:33:06 +08:00
parent 0ef46407dd
commit 09ee1c26b1
3 changed files with 26 additions and 25 deletions

View File

@@ -574,6 +574,7 @@ class StockPicking(models.Model):
('origin', '=', self.origin), ('picking_id', '=', self.id)])
if self.location_id == move_in.location_id and self.location_dest_id == move_in.location_dest_id:
if move_out.origin == move_in.origin:
move_in.write({'production_id': False})
if move_out.picking_id.state != 'done':
raise UserError(
_('该入库单对应的单号为%s的出库单还未完成,不能进行验证操作!' % move_out.picking_id.name))
@@ -659,6 +660,11 @@ class ReStockMove(models.Model):
return move_values
def _get_new_picking_values_Res(self, item, sorted_workorders, rescode):
picking_type_id = self.mapped('picking_type_id').id
if rescode == 'WH/OCOUT/':
picking_type_id = self.env.ref('sf_manufacturing.outcontract_picking_out').id
elif rescode == 'WH/OCIN/':
picking_type_id = self.env.ref('sf_manufacturing.outcontract_picking_in').id
return {
'name': self.env['stock.picking']._get_name_Res(rescode),
'origin': item.name,
@@ -667,7 +673,7 @@ class ReStockMove(models.Model):
'user_id': False,
'move_type': self.mapped('group_id').move_type or 'direct',
'partner_id': sorted_workorders.supplier_id.id,
'picking_type_id': self.mapped('picking_type_id').id,
'picking_type_id': picking_type_id,
'location_id': self.mapped('location_id').id,
'location_dest_id': self.mapped('location_dest_id').id,
'state': 'confirmed',