From 6b024d527ee0cfa3357977a00181fb9f7d6d8a3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 11 Jul 2025 22:43:56 +0200 Subject: [PATCH] Do not crash if there is no Euro currency defined for intrastat reports Closes #14050 (grafted from 8b44253eff407832523cbb9e023955ee5c4a4ba9) --HG-- branch : 7.0 --- modules/account_stock_eu/company.py | 5 ++++- modules/account_stock_eu/stock.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/account_stock_eu/company.py b/modules/account_stock_eu/company.py index ad6463e3dd..62951e27b0 100644 --- a/modules/account_stock_eu/company.py +++ b/modules/account_stock_eu/company.py @@ -24,7 +24,10 @@ class Company(metaclass=PoolMeta): currency = company.currency else: if not eur: - eur, = Currency.search([('code', '=', 'EUR')], limit=1) + try: + eur, = Currency.search([('code', '=', 'EUR')], limit=1) + except ValueError: + pass currency = eur currencies[company.id] = currency return currencies diff --git a/modules/account_stock_eu/stock.py b/modules/account_stock_eu/stock.py index 782bc1ec44..e1a93b309d 100644 --- a/modules/account_stock_eu/stock.py +++ b/modules/account_stock_eu/stock.py @@ -418,7 +418,7 @@ class Move(metaclass=PoolMeta): return round(Currency.compute( self.currency, self.unit_price * Decimal(str(self.quantity)), - self.company.intrastat_currency, + self.company.intrastat_currency or self.currency, round=False), ndigits) def _intrastat_quantity(self, unit):