Set currency exchange account for account cash scenario

Since 1c698e656c02 such account is needed if there is a difference due to
exchange rate.

Closes #12935
This commit is contained in:
Cédric Krier
2024-01-14 23:34:48 +01:00
parent 6760a897eb
commit a32876e1b0
@@ -19,6 +19,8 @@ Activate modules::
>>> config = activate_modules(['account_cash_rounding', 'account_invoice'])
>>> Configuration = Model.get('account.configuration')
Set alternate currencies::
>>> currency = get_currency('USD')
@@ -42,6 +44,16 @@ Create chart of accounts::
>>> _ = create_chart(company)
>>> accounts = get_accounts(company)
Configure currency exchange::
>>> currency_exchange_account, = (
... accounts['revenue'].duplicate(
... default={'name': "Currency Exchange"}))
>>> configuration = Configuration(1)
>>> configuration.currency_exchange_debit_account = (
... currency_exchange_account)
>>> configuration.save()
Set cash rounding::
>>> cash_rounding_credit = Account(name="Cash Rounding")
@@ -98,6 +110,6 @@ Post invoice::
>>> line_to_pay, = invoice.lines_to_pay
>>> line_to_pay.debit, line_to_pay.credit
(Decimal('21.03'), Decimal('0'))
(Decimal('21.02'), Decimal('0'))
>>> line_to_pay.amount_second_currency
Decimal('42.05')