From 82afffac898c6ca2c92fe87da1a8c40969c5a83d Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 5 Jun 2020 08:37:00 +0000 Subject: [PATCH] [FIX] stock: sort traceability report Commit 324db18dc9d5774d714 introduced the date formatting on the traceability report. A side effect is that the line sorting is done on the formatted value, leading to lines not appearing in chronological order. We format the line after sorting. opw-2243432 closes odoo/odoo#52497 X-original-commit: 52e04dc3362830874a9f868d8e35a3da441320d7 Signed-off-by: Nicolas Martinelli (nim) --- addons/stock/report/stock_traceability.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/stock/report/stock_traceability.py b/addons/stock/report/stock_traceability.py index 553127505dd..42495ea5a32 100644 --- a/addons/stock/report/stock_traceability.py +++ b/addons/stock/report/stock_traceability.py @@ -121,7 +121,7 @@ class MrpStockReport(models.TransientModel): data = [{ 'level': level, 'unfoldable': unfoldable, - 'date': format_datetime(self.env, move_line.move_id.date, tz=False, dt_format=False), + 'date': move_line.move_id.date, 'parent_id': parent_id, 'is_used': bool(is_used), 'usage': self._get_usage(move_line), @@ -156,7 +156,7 @@ class MrpStockReport(models.TransientModel): 'res_model': data.get('res_model', False), 'columns': [data.get('reference_id', False), data.get('product_id', False), - data.get('date', False), + format_datetime(self.env, data.get('date', False), tz=False, dt_format=False), data.get('lot_name', False), data.get('location_source', False), data.get('location_destination', False),