Do not try to assign currency id to the invoice if the currency has not be found

Closes #13538
This commit is contained in:
Cédric Krier
2024-09-20 15:52:43 +02:00
parent 6bda7c336f
commit 8d9da767bb
+1 -2
View File
@@ -97,12 +97,11 @@ class IncomingSupplierInvoice(metaclass=PoolMeta):
currency = invoice_data.get('currency')
if currency:
try:
currency, = Currency.search([
invoice.currency, = Currency.search([
('code', '=', currency),
])
except ValueError:
logger.debug(f"Cannot find currency '{currency}'")
invoice.currency = currency.id
invoice.reference = invoice_data.get('number')
invoice.description = invoice_data.get('description')