From eaae9ea8ec35c96d9aa087139fc2ca0a2802ab33 Mon Sep 17 00:00:00 2001 From: brsy-odoo Date: Thu, 17 Jun 2021 12:16:58 +0000 Subject: [PATCH] [IMP] stock: improve order logic of stock.move.line Currently, the order of transfer lines makes no sense for a picker (it's in the order of the creation of the line). We want to have the lines of the detailed operation in the same order as the picker will be picking the products, so we order by source location, destination location, sequence, and then by id (i.e. creation time) respectively instead. Also the printing report of the batch transfer is on too many pages, it's one page by location, but we always group on 'from location'. So it would be better not to split by location and keep the report on the least number of pages possible. task-2496324 odoo/enterprise#21921 closes odoo/odoo#79446 X-original-commit: 9b120caa2a5cd5e2487d663a180b486b5bdb201b Related: odoo/enterprise#22144 Signed-off-by: Tiffany Chang --- addons/stock/models/stock_move_line.py | 2 +- .../report/report_stockpicking_operations.xml | 78 +++++++++---------- addons/stock/tests/test_stock_flow.py | 2 +- .../report/report_picking_batch.xml | 70 +++++++++-------- 4 files changed, 75 insertions(+), 77 deletions(-) diff --git a/addons/stock/models/stock_move_line.py b/addons/stock/models/stock_move_line.py index 53d084a939c..4c27864777d 100644 --- a/addons/stock/models/stock_move_line.py +++ b/addons/stock/models/stock_move_line.py @@ -14,7 +14,7 @@ class StockMoveLine(models.Model): _name = "stock.move.line" _description = "Product Moves (Stock Move Line)" _rec_name = "product_id" - _order = "result_package_id desc, id" + _order = "result_package_id desc, location_id asc, location_dest_id asc, picking_id asc, id" picking_id = fields.Many2one( 'stock.picking', 'Transfer', auto_join=True, diff --git a/addons/stock/report/report_stockpicking_operations.xml b/addons/stock/report/report_stockpicking_operations.xml index 0a4cde56a45..9c20777ec08 100644 --- a/addons/stock/report/report_stockpicking_operations.xml +++ b/addons/stock/report/report_stockpicking_operations.xml @@ -84,48 +84,44 @@ - - - - - -
- - - - - - - - - - - - - - - -
- - - - -
- - -
- - - - -
- - - + + + + +
+ + + + + + + + + + + - - -
+ + +
+ + + + +
+ + +
+ + + + +
+ + + + + diff --git a/addons/stock/tests/test_stock_flow.py b/addons/stock/tests/test_stock_flow.py index d9251ad5cdd..4ea3501f2bb 100644 --- a/addons/stock/tests/test_stock_flow.py +++ b/addons/stock/tests/test_stock_flow.py @@ -1968,7 +1968,7 @@ class TestStockFlow(TestStockCommon): # Validates the two receipts and checks the move lines' lot. (receipt_1 | receipt_2).button_validate() - lots = self.env['stock.production.lot'].search([('product_id', '=', product_lot.id)]) + lots = self.env['stock.production.lot'].search([('product_id', '=', product_lot.id)], order='name asc') self.assertEqual(len(lots), 5) lot1, lot2, lot3, lot4, lot5 = lots self.assertEqual(lot1.name, 'lot-001') diff --git a/addons/stock_picking_batch/report/report_picking_batch.xml b/addons/stock_picking_batch/report/report_picking_batch.xml index 343ea888bd6..0efd70f8083 100644 --- a/addons/stock_picking_batch/report/report_picking_batch.xml +++ b/addons/stock_picking_batch/report/report_picking_batch.xml @@ -48,34 +48,40 @@

- - - -

-
- Responsible: - -

-

To take from:

- - - - - - - - - - - - +

+
+ Responsible: + +

+
ProductQuantityToTransfer - Lot/Serial Number - - Product Barcode - - Package -
+ + + + + + + + + + + + + + + + - @@ -111,14 +114,13 @@ -
ProductQuantityTransfer + Lot/Serial Number + + Product Barcode + + Package +
+

FROM +

+

TO +

+
@@ -94,9 +100,6 @@ - - - → + →
-

- + +