[FIX] stock, mrp: _get_similar_move_lines
try to make it work actually.
This commit is contained in:
@@ -20,11 +20,14 @@ class StockMoveLine(models.Model):
|
||||
def _get_similar_move_lines(self):
|
||||
lines = super(StockMoveLine, self)._get_similar_move_lines()
|
||||
if self.move_id.production_id:
|
||||
lines |= self.move_id.production_id.move_finished_ids.mapped('move_line_ids').filtered(lambda l: l.lot_id)
|
||||
finished_moves = self.move_id.production_id.move_finished_ids
|
||||
finished_move_lines = finished_moves.mapped('move_line_ids')
|
||||
lines |= finished_move_lines.filtered(lambda ml: ml.product_id == self.product_id and (ml.lot_id or ml.lot_name))
|
||||
if self.move_id.raw_material_production_id:
|
||||
lines |= self.move_id.raw_material_production_id.move_raw_ids.mapped('move_line_ids').filtered(lambda l: l.lot_id)
|
||||
if self.workorder_id:
|
||||
lines |= self.workorder_id.active_move_line_ids
|
||||
raw_moves = self.move_id.raw_material_production_id.move_raw_ids
|
||||
raw_moves_lines = raw_moves.mapped('move_line_ids')
|
||||
raw_moves_lines |= self.move_id.active_move_line_ids
|
||||
lines |= raw_moves_lines.filtered(lambda ml: ml.product_id == self.product_id and (ml.lot_id or ml.lot_name))
|
||||
return lines
|
||||
|
||||
@api.multi
|
||||
|
||||
@@ -128,8 +128,9 @@ class StockMoveLine(models.Model):
|
||||
def _get_similar_move_lines(self):
|
||||
self.ensure_one()
|
||||
lines = self.env['stock.move.line']
|
||||
if self.move_id.picking_id:
|
||||
lines |= self.move_id.picking_id.move_line_ids.filtered(lambda ml: ml.product_id == self.product_id and (ml.lot_id or ml.lot_name))
|
||||
picking_id = self.move_id.picking_id if self.move_id else self.picking_id
|
||||
if picking_id:
|
||||
lines |= picking_id.move_line_ids.filtered(lambda ml: ml.product_id == self.product_id and (ml.lot_id or ml.lot_name))
|
||||
return lines
|
||||
|
||||
def _check_for_duplicated_serial_numbers(self):
|
||||
|
||||
Reference in New Issue
Block a user