From 8a53cd17bcd9b970ab415cdbaad8815577a32f89 Mon Sep 17 00:00:00 2001 From: Carlos Serra-Toro <19153972+carlosserratoro@users.noreply.github.com> Date: Tue, 26 Jan 2021 07:59:44 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Guewen Baconnier --- stock_location_last_inventory_date/models/stock_location.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stock_location_last_inventory_date/models/stock_location.py b/stock_location_last_inventory_date/models/stock_location.py index fa0eb421e..ed77a8085 100644 --- a/stock_location_last_inventory_date/models/stock_location.py +++ b/stock_location_last_inventory_date/models/stock_location.py @@ -28,7 +28,7 @@ class StockLocation(models.Model): domain="[('location_ids', 'in', id), ('state', '=', 'done')]", ) - @api.depends("validated_inventory_ids", "validated_inventory_ids.write_date") + @api.depends("validated_inventory_ids", "validated_inventory_ids.date") def _compute_last_inventory_date(self): """Store date of the last inventory for each leaf location""" for loc in self: @@ -38,7 +38,7 @@ class StockLocation(models.Model): and loc.validated_inventory_ids ): loc.last_inventory_date = loc.validated_inventory_ids.sorted( - lambda inventory: inventory.write_date + lambda inventory: inventory.date )[-1].date else: loc.last_inventory_date = False