[FIX] stock: traceability downstream order and date
The traceability report in downstream was looking for newer move lines instead of older ones, which leads to not showing all related traceable moves. We also changed the sort order of the move_lines in downstream
This commit is contained in:
@@ -57,7 +57,7 @@ class MrpStockReport(models.TransientModel):
|
||||
('lot_id', '=', move_line.lot_id.id),
|
||||
('location_id', '=', move_line.location_dest_id.id),
|
||||
('id', '!=', move_line.id),
|
||||
('date', '<', move_line.date),
|
||||
('date', '>', move_line.date),
|
||||
])
|
||||
if res:
|
||||
res |= self.get_move_lines_downstream(res)
|
||||
@@ -278,7 +278,10 @@ class MrpStockReport(models.TransientModel):
|
||||
else:
|
||||
for move_line in obj_ids:
|
||||
final_vals += self.make_dict_head(level, stream=stream, parent_id=line_id, model=model or 'stock.pack.operation', move_line=move_line)
|
||||
final_vals = sorted(final_vals, key=lambda v: v['date'], reverse=True)
|
||||
reverse_sort = True
|
||||
if stream == "downstream":
|
||||
reverse_sort = False
|
||||
final_vals = sorted(final_vals, key=lambda v: v['date'], reverse=reverse_sort)
|
||||
lines = self.final_vals_to_lines(final_vals, level)
|
||||
return lines
|
||||
|
||||
|
||||
Reference in New Issue
Block a user