From 6c8d4d0e2c5a74a2da6abc68bb2a0834b209fc96 Mon Sep 17 00:00:00 2001 From: Jordi Ballester Alomar Date: Wed, 17 Oct 2018 17:58:42 +0200 Subject: [PATCH] stock_cycle_count: fix issue with nan while doing the mean calculation --- stock_cycle_count/models/stock_location.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stock_cycle_count/models/stock_location.py b/stock_cycle_count/models/stock_location.py index 93886b082..6f6946489 100644 --- a/stock_cycle_count/models/stock_location.py +++ b/stock_cycle_count/models/stock_location.py @@ -32,7 +32,8 @@ class StockLocation(models.Model): if history: wh_id = rec.get_warehouse(rec) wh = self.env['stock.warehouse'].browse(wh_id) - if len(history) > wh.counts_for_accuracy_qty: + if wh.counts_for_accuracy_qty and \ + len(history) > wh.counts_for_accuracy_qty: rec.loc_accuracy = mean( history[:wh.counts_for_accuracy_qty]. mapped('inventory_accuracy'))