From a32876e1b024f7cdb9acf03b75242bed02c54d7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 14 Jan 2024 23:34:48 +0100 Subject: [PATCH] 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 --- ...io_account_cash_rounding_alternate_currency.rst | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/account_cash_rounding/tests/scenario_account_cash_rounding_alternate_currency.rst b/modules/account_cash_rounding/tests/scenario_account_cash_rounding_alternate_currency.rst index e771e27331..e38afad0b3 100644 --- a/modules/account_cash_rounding/tests/scenario_account_cash_rounding_alternate_currency.rst +++ b/modules/account_cash_rounding/tests/scenario_account_cash_rounding_alternate_currency.rst @@ -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')