[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) <whe@odoo.com>
Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
This commit is contained in:
MerlinGuillaume
2022-06-23 09:00:37 +02:00
parent 93ed43bcb3
commit 64fa6d8948
+1
View File
@@ -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'),