From 2f4d3435877eb26e4a5d7a85eb4c2d6b7f6fcecf Mon Sep 17 00:00:00 2001 From: qdp-odoo Date: Wed, 21 Mar 2018 17:36:00 +0100 Subject: [PATCH] [FIX] account: fix and enhance multi-currency test on payment --- addons/account/tests/test_payment.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/addons/account/tests/test_payment.py b/addons/account/tests/test_payment.py index bac638ccd85..13a00bde77f 100644 --- a/addons/account/tests/test_payment.py +++ b/addons/account/tests/test_payment.py @@ -390,13 +390,16 @@ class TestPayment(AccountingTestCase): {'account_id': self.account_payable.id, 'debit': 8.65, 'credit': 0.0, 'amount_currency': 13.22, 'currency_id': self.currency_usd_id}, {'account_id': self.account_receivable.id, 'debit': 0.0, 'credit': 25.0, 'amount_currency': -38.22, 'currency_id': self.currency_usd_id}, ]) + self.assertTrue(payment.move_line_ids.filtered(lambda l: l.account_id == invoice.account_id)[0].full_reconcile_id) + self.assertEqual(invoice.state, 'paid') + # Use case: # Company is in EUR, create a vendor bill for 25 EUR and register payment of 25 USD. # Mark invoice as fully paid with a write_off # Check that all the aml are correctly created. invoice = self.create_invoice(amount=25, type='in_invoice', currency_id=self.currency_eur_id, partner=self.partner_agrolait.id) # register payment on invoice - payment = self.payment_model.create({'payment_type': 'inbound', + payment = self.payment_model.create({'payment_type': 'outbound', 'payment_method_id': self.env.ref('account.account_payment_method_manual_in').id, 'partner_type': 'supplier', 'partner_id': self.partner_agrolait.id, @@ -410,10 +413,12 @@ class TestPayment(AccountingTestCase): }) payment.post() self.check_journal_items(payment.move_line_ids, [ - {'account_id': self.account_eur.id, 'debit': 16.35, 'credit': 0.0, 'amount_currency': 25.0, 'currency_id': self.currency_usd_id}, + {'account_id': self.account_eur.id, 'debit': 0.0, 'credit': 16.35, 'amount_currency': -25.0, 'currency_id': self.currency_usd_id}, {'account_id': self.account_payable.id, 'debit': 0.0, 'credit': 8.65, 'amount_currency': -13.22, 'currency_id': self.currency_usd_id}, - {'account_id': self.account_receivable.id, 'debit': 0.0, 'credit': 7.7, 'amount_currency': -11.78, 'currency_id': self.currency_usd_id}, + {'account_id': self.account_receivable.id, 'debit': 25.0, 'credit': 0.0, 'amount_currency': 38.22, 'currency_id': self.currency_usd_id}, ]) + self.assertTrue(payment.move_line_ids.filtered(lambda l: l.account_id == invoice.account_id)[0].full_reconcile_id) + self.assertEqual(invoice.state, 'paid') def test_payment_and_writeoff_in_other_currency_2(self): # Use case: