Do not crash if there is no Euro currency defined for intrastat reports

Closes #14050
(grafted from 8b44253eff407832523cbb9e023955ee5c4a4ba9)

--HG--
branch : 7.0
This commit is contained in:
Cédric Krier committed 2025-07-11 22:43:56 +02:00
1 parent 311657c7fa
commit 6b024d527e
2 files changed
+5 -2

No files matched your search

+4 -1
View File
@@ -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
+1 -1
View File
@@ -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):