Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] account: currency of reconci. suggestion
When the currency used for a payment/internal transfert is not the same as the company currency, the prices shown in the reconciliation suggestions are computed using the company currency. 1) Enable multi-currency. 2) Setup two bank, one in USD, the other in EUR. 3) Leave the company currency to USD. 4) Create an invoice for a partner targeting the EUR bank and validate it. 5) Create a bank statement for the EUR bank amounting the **exact** value of the invoice for the **same** partner and reconcile it, this will create the payment behind the hood. 6) In the reconciliation the invoice appears as suggestion, if the currency symbol is correct, the amount is shown as USD. opw-1937202 closes #30623 closes #31290
- Loading branch information
1 parent
6530f12
commit 01405ca
Showing
2 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import logging | ||
import odoo.tests | ||
import time | ||
from odoo.addons.account.tests.test_reconciliation import TestReconciliation | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
|
@@ -22,3 +23,29 @@ def test_01_admin_bank_statement_reconciliation(self): | |
self.phantom_js("/web#statement_ids=" + str(bank_stmt.id) + "&action=bank_statement_reconciliation_view", | ||
"odoo.__DEBUG__.services['web_tour.tour'].run('bank_statement_reconciliation')", | ||
"odoo.__DEBUG__.services['web_tour.tour'].tours.bank_statement_reconciliation.ready", login="admin") | ||
|
||
|
||
@odoo.tests.tagged('post_install', '-at_install') | ||
class TestReconciliationWidget(TestReconciliation): | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Julien00859
Author
Member
|
||
|
||
def test_statement_suggestion_other_currency(self): | ||
# company currency is EUR | ||
# payment in USD | ||
invoice = self.create_invoice(invoice_amount=50, currency_id=self.currency_usd_id) | ||
|
||
# journal currency in USD | ||
bank_stmt = self.acc_bank_stmt_model.create({ | ||
'journal_id': self.bank_journal_usd.id, | ||
'date': time.strftime('%Y-07-15'), | ||
'name': 'payment %s' % invoice.number, | ||
}) | ||
|
||
bank_stmt_line = self.acc_bank_stmt_line_model.create({'name': 'payment', | ||
'statement_id': bank_stmt.id, | ||
'partner_id': self.partner_agrolait_id, | ||
'amount': 50, | ||
'date': time.strftime('%Y-07-15'), | ||
}) | ||
|
||
result = self.env['account.reconciliation.widget'].get_bank_statement_line_data(bank_stmt_line.ids) | ||
self.assertEqual(result['lines'][0]['reconciliation_proposition'][0]['amount_str'], '$ 50.00') |
@Julien00859 It's not a good idea to extend a class containing some tests because you force the TestSuite to execute them twice. In your case, the tests inside
TestReconciliation
are now executed 2 times in runbot :/