stock_cycle_count: fix issue with nan while doing the mean calculation

This commit is contained in:
Jordi Ballester Alomar
2018-10-17 17:58:42 +02:00
committed by Lois Rilo
parent 177be5f6bc
commit 6c8d4d0e2c

View File

@@ -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'))