修复表面工艺
This commit is contained in:
@@ -862,10 +862,9 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
('location_dest_id', '=', self.env['stock.location'].search(
|
('location_dest_id', '=', self.env['stock.location'].search(
|
||||||
[('barcode', 'ilike', 'VL-SPOC')]).id),
|
[('barcode', 'ilike', 'VL-SPOC')]).id),
|
||||||
('origin', '=', self.production_id.name)])
|
('origin', '=', self.production_id.name)])
|
||||||
purchase = self.env['purchase.order'].search([('origin', 'ilike', self.production_id.name)])
|
if move_out:
|
||||||
if purchase and move_out:
|
|
||||||
move_out.write({'state': 'assigned'})
|
move_out.write({'state': 'assigned'})
|
||||||
self.env['stock.move.line'].create(move_out.get_move_line(purchase, self))
|
self.env['stock.move.line'].create(move_out.get_move_line(self.production_id, self))
|
||||||
|
|
||||||
# move_out._action_assign()
|
# move_out._action_assign()
|
||||||
if self.state == 'waiting' or self.state == 'ready' or self.state == 'progress':
|
if self.state == 'waiting' or self.state == 'ready' or self.state == 'progress':
|
||||||
|
|||||||
@@ -487,10 +487,10 @@ class StockPicking(models.Model):
|
|||||||
('location_dest_id', '=', self.env['stock.location'].search(
|
('location_dest_id', '=', self.env['stock.location'].search(
|
||||||
[('barcode', 'ilike', 'VL-SPOC')]).id),
|
[('barcode', 'ilike', 'VL-SPOC')]).id),
|
||||||
('origin', '=', self.origin)])
|
('origin', '=', self.origin)])
|
||||||
if self.id == move_out.picking_id.id:
|
# if self.id == move_out.picking_id.id:
|
||||||
if move_out.move_line_ids.workorder_id.state not in ['progress']:
|
# if move_out.move_line_ids.workorder_id.state not in ['progress']:
|
||||||
raise UserError(
|
# raise UserError(
|
||||||
_('该出库单里源单据内的单号为%s的工单还未开始,不能进行验证操作!' % move_out.move_line_ids.workorder_id.name))
|
# _('该出库单里源单据内的单号为%s的工单还未开始,不能进行验证操作!' % move_out.move_line_ids.workorder_id.name))
|
||||||
# 入库单验证
|
# 入库单验证
|
||||||
move_in = self.env['stock.move'].search(
|
move_in = self.env['stock.move'].search(
|
||||||
[('location_dest_id', '=', self.env['stock.location'].search(
|
[('location_dest_id', '=', self.env['stock.location'].search(
|
||||||
@@ -506,18 +506,17 @@ class StockPicking(models.Model):
|
|||||||
res = super().button_validate()
|
res = super().button_validate()
|
||||||
if res is True:
|
if res is True:
|
||||||
if self.id == move_out.picking_id.id:
|
if self.id == move_out.picking_id.id:
|
||||||
if move_out.move_line_ids.workorder_id.state == 'progress':
|
# if move_out.move_line_ids.workorder_id.state == 'progress':
|
||||||
move_in = self.env['stock.move'].search(
|
move_in = self.env['stock.move'].search(
|
||||||
[('location_dest_id', '=', self.env['stock.location'].search(
|
[('location_dest_id', '=', self.env['stock.location'].search(
|
||||||
[('barcode', 'ilike', 'WH-PREPRODUCTION')]).id),
|
[('barcode', 'ilike', 'WH-PREPRODUCTION')]).id),
|
||||||
('location_id', '=', self.env['stock.location'].search(
|
('location_id', '=', self.env['stock.location'].search(
|
||||||
[('barcode', 'ilike', 'VL-SPOC')]).id),
|
[('barcode', 'ilike', 'VL-SPOC')]).id),
|
||||||
('origin', '=', self.origin)])
|
('origin', '=', self.origin)])
|
||||||
# purchase = self.env['purchase.order'].search([('origin', '=', self.origin)])
|
production = self.env['mrp.production'].search([('name', '=', self.origin)])
|
||||||
if move_in:
|
if move_in:
|
||||||
move_in.write({'state': 'assigned'})
|
move_in.write({'state': 'assigned'})
|
||||||
purchase = self.env['purchase.order'].search([('origin', '=', self.origin)])
|
self.env['stock.move.line'].create(move_in.get_move_line(production, None))
|
||||||
self.env['stock.move.line'].create(move_in.get_move_line(purchase, None))
|
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@@ -599,7 +598,7 @@ class ReStockMove(models.Model):
|
|||||||
'state': 'confirmed',
|
'state': 'confirmed',
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_move_line(self, purchase, sorted_workorders):
|
def get_move_line(self, production_id, sorted_workorders):
|
||||||
return {
|
return {
|
||||||
'move_id': self.id,
|
'move_id': self.id,
|
||||||
'product_id': self.product_id.id,
|
'product_id': self.product_id.id,
|
||||||
@@ -608,7 +607,7 @@ class ReStockMove(models.Model):
|
|||||||
'location_dest_id': self.picking_id.location_dest_id.id,
|
'location_dest_id': self.picking_id.location_dest_id.id,
|
||||||
'picking_id': self.picking_id.id,
|
'picking_id': self.picking_id.id,
|
||||||
'reserved_uom_qty': 1.0,
|
'reserved_uom_qty': 1.0,
|
||||||
'lot_id': purchase.picking_ids.move_line_ids.lot_id.id,
|
'lot_id': production_id.move_line_raw_ids.lot_id.id,
|
||||||
'company_id': self.company_id.id,
|
'company_id': self.company_id.id,
|
||||||
# 'workorder_id': '' if not sorted_workorders else sorted_workorders.id,
|
# 'workorder_id': '' if not sorted_workorders else sorted_workorders.id,
|
||||||
# 'production_id': '' if not sorted_workorders else sorted_workorders.production_id.id,
|
# 'production_id': '' if not sorted_workorders else sorted_workorders.production_id.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user