This commit is contained in:
2026-01-04 19:46:26 +01:00
parent 750db2fe4d
commit 5111265019

View File

@@ -138,11 +138,13 @@ class ValuationBase(ModelSQL):
amount = round(price * qty * Decimal(sign), 4)
base_amount = amount
currency = sale_line.sale.currency.id if sale_line else line.purchase.currency.id
company_currency = sale_line.sale.company.currency if sale_line else line.purchase.company.currency
rate = Decimal(1)
if line.purchase.company.currency != currency:
with Transaction().set_context(date=Date.today()):
base_amount = Currency.compute(currency,amount, line.purchase.company.currency)
rate = round(amount / base_amount,6)
base_amount = Currency.compute(currency,amount, company_currency)
if base_amount and amount:
rate = round(amount / base_amount,6)
values.update({
'price': round(price, 4),