From 64fa6d89480001b257d800979ffef9f240ab032c Mon Sep 17 00:00:00 2001 From: MerlinGuillaume Date: Mon, 20 Jun 2022 10:48:30 +0000 Subject: [PATCH] [FIX] stock: order stock.production.lot by name Sorting the `stock.quant` by lot_id didn't work correctly Steps to reproduce: 1. Install Inventory 2. Edit a product tracking to 'By Unique Serial Number' (e.g. Acoustic Bloc Screens) 3. Go to Inventory > Overview > Receipts, create a receipt for 3 Acoustic Bloc Screens with serial number '05', '01' and '03' and validate 4. Go to Inventory > Reporting > Inventory Report, remove the 'Group By' filters and sort the entries by Lot/Serial Number 5. The serial numbers are not properly ordered ('01' is between '03' and '05') Solution: Order the `stock.production.lot` by name Problem: Sorting the `stock.quant` by lot_id used the id of `stock.production.lot` opw-2879464 closes odoo/odoo#94358 X-original-commit: 4c855bd3eeb7ffcebd76eb4eaa1e41edf2935021 Signed-off-by: William Henrotin (whe) Signed-off-by: Guillaume Merlin (megu) --- addons/stock/models/stock_lot.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/stock/models/stock_lot.py b/addons/stock/models/stock_lot.py index 54b3fec8d07..a3951ba411a 100644 --- a/addons/stock/models/stock_lot.py +++ b/addons/stock/models/stock_lot.py @@ -14,6 +14,7 @@ class StockLot(models.Model): _inherit = ['mail.thread', 'mail.activity.mixin'] _description = 'Lot/Serial' _check_company_auto = True + _order = 'name, id' name = fields.Char( 'Lot/Serial Number', default=lambda self: self.env['ir.sequence'].next_by_code('stock.lot.serial'),