From ed689b63a680bd1c0c1a93366abdcfa6faf09d02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 9 Oct 2024 20:15:47 +0200 Subject: [PATCH] Fallback to 0 when summing stock values of products Closes #13581 (grafted from 929d753eaf33a2121362ab7429813a82e288e97a) --HG-- branch : 7.0 --- modules/stock/product.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/stock/product.py b/modules/stock/product.py index 07d31c4a91..d09244d848 100644 --- a/modules/stock/product.py +++ b/modules/stock/product.py @@ -168,7 +168,7 @@ class Template(metaclass=PoolMeta): raise Exception('Bad argument') sum_ = 0. if name != 'cost_value' else Decimal(0) for product in self.products: - sum_ += getattr(product, name) + sum_ += getattr(product, name) or 0 return sum_ @classmethod