From b472303f67c3f54058fd39ed1608351f1bbaa3a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Tarroja=20Caubet?= Date: Thu, 18 Jan 2024 10:38:07 +0100 Subject: [PATCH] Check purchase amount is not None on compute production cost Closes #12946 (grafted from dd9635826c8a493f4268690a47d37ee039b2d65a) --HG-- branch : 7.0 --- modules/production_outsourcing/production.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/production_outsourcing/production.py b/modules/production_outsourcing/production.py index bec026e657..bc7a7eb095 100644 --- a/modules/production_outsourcing/production.py +++ b/modules/production_outsourcing/production.py @@ -118,7 +118,7 @@ class Production(metaclass=PoolMeta): Currency = pool.get('currency.currency') cost = super(Production, self).get_cost(name) for line in self.purchase_lines: - if line.purchase.state != 'cancelled': + if line.purchase.state != 'cancelled' and line.amount: cost += Currency.compute( line.purchase.currency, line.amount, self.company.currency, round=False)