mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[IMP] replace python sort with SQL
This commit is contained in:
@@ -23,9 +23,12 @@ class StockLocation(models.Model):
|
||||
@api.multi
|
||||
def _compute_loc_accuracy(self):
|
||||
for rec in self:
|
||||
history = self.env['stock.inventory'].search([
|
||||
('location_id', '=', rec.id), ('state', '=', 'done')])
|
||||
history = history.sorted(key=lambda r: r.write_date, reverse=True)
|
||||
history = self.env['stock.inventory'].search(
|
||||
[('location_id', '=', rec.id),
|
||||
('state', '=', 'done'),
|
||||
],
|
||||
order='write_date DESC'
|
||||
)
|
||||
if history:
|
||||
wh_id = rec.get_warehouse(rec)
|
||||
wh = self.env['stock.warehouse'].browse(wh_id)
|
||||
|
||||
Reference in New Issue
Block a user