diff options
| author | william <wan@odoo.com> | 2020-07-10 13:27:25 +0000 |
|---|---|---|
| committer | william <wan@odoo.com> | 2020-08-05 11:57:10 +0000 |
| commit | 0809601d6da21fcf00be3ad4b28cbcf350c7d09d (patch) | |
| tree | 0c26afaf4d130f57ab8d48a85376c5c983831cb8 | |
| parent | 0ea9254c81ea42a7fd9af455f05d70e3ca227460 (diff) | |
[IMP] account: do not pollute test_reconciliation with unlink log
By deleting the res.currency.rate in the setUpClass, we do not pollute
the log with the unlink info, and the test is a little bit faster.
closes odoo/odoo#48651
Related: odoo/upgrade#1502
Related: odoo/enterprise#9559
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
| -rw-r--r-- | addons/account/tests/test_reconciliation.py | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/addons/account/tests/test_reconciliation.py b/addons/account/tests/test_reconciliation.py index b904e0b8cd9..6e2e49c6937 100644 --- a/addons/account/tests/test_reconciliation.py +++ b/addons/account/tests/test_reconciliation.py @@ -13,7 +13,17 @@ from odoo.tests import Form, tagged @tagged('post_install', '-at_install') class TestReconciliationExec(TestAccountReconciliationCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.env['res.currency.rate'].search([]).unlink() + def test_statement_euro_invoice_usd_transaction_euro_full(self): + self.env['res.currency.rate'].create({ + 'name': '%s-07-01' % time.strftime('%Y'), + 'rate': 1.5289, + 'currency_id': self.currency_usd_id, + }) # Create a customer invoice of 50 USD. partner = self.env['res.partner'].create({'name': 'test'}) move = self.env['account.move'].with_context(default_move_type='out_invoice').create({ @@ -588,11 +598,6 @@ class TestReconciliationExec(TestAccountReconciliationCommon): 'company_id': self.env.company.id, }) - # Delete any old rate - to make sure that we use the ones we need. - old_rates = self.env['res.currency.rate'].search( - [('currency_id', '=', self.currency_usd_id)]) - old_rates.unlink() - self.env['res.currency.rate'].create({ 'currency_id': self.currency_usd_id, 'name': time.strftime('%Y') + '-01-01', @@ -824,7 +829,6 @@ class TestReconciliationExec(TestAccountReconciliationCommon): def test_inv_refund_foreign_payment_writeoff_domestic2(self): company = self.company - self.env['res.currency.rate'].search([]).unlink() self.env['res.currency.rate'].create({ 'name': time.strftime('%Y') + '-07-01', 'rate': 1.0, @@ -892,7 +896,6 @@ class TestReconciliationExec(TestAccountReconciliationCommon): Invoices should be marked as paid """ company = self.company - self.env['res.currency.rate'].search([]).unlink() self.env['res.currency.rate'].create({ 'name': time.strftime('%Y') + '-07-01', 'rate': 1.0, @@ -962,7 +965,6 @@ class TestReconciliationExec(TestAccountReconciliationCommon): Invoices should be marked as paid """ company = self.company - self.env['res.currency.rate'].search([]).unlink() self.env['res.currency.rate'].create({ 'name': time.strftime('%Y') + '-07-01', 'rate': 1.0, @@ -1041,7 +1043,6 @@ class TestReconciliationExec(TestAccountReconciliationCommon): Invoices should be marked as paid """ company = self.company - self.env['res.currency.rate'].search([]).unlink() self.env['res.currency.rate'].create({ 'name': time.strftime('%Y') + '-07-01', 'rate': 1.0, @@ -1101,7 +1102,6 @@ class TestReconciliationExec(TestAccountReconciliationCommon): | 315.15 (350.00) PAYMENT > Done in domestic (the 350.00 is virtual, non stored) """ company = self.company - self.env['res.currency.rate'].search([]).unlink() self.env['res.currency.rate'].create({ 'name': time.strftime('%Y') + '-07-01', 'rate': 1.0, @@ -1165,7 +1165,6 @@ class TestReconciliationExec(TestAccountReconciliationCommon): foreign_1 = self.env['res.currency'].browse(self.currency_usd_id) company = self.company - self.env['res.currency.rate'].search([]).unlink() self.env['res.currency.rate'].create({ 'name': time.strftime('%Y') + '-07-01', 'rate': 1.0, @@ -1241,7 +1240,6 @@ class TestReconciliationExec(TestAccountReconciliationCommon): Invoices should be marked as paid """ company = self.company - self.env['res.currency.rate'].search([]).unlink() self.env['res.currency.rate'].create({ 'name': time.strftime('%Y') + '-07-01', 'rate': 1.0, @@ -1288,7 +1286,6 @@ class TestReconciliationExec(TestAccountReconciliationCommon): Because the WriteOff is on a different line than the payment """ company = self.company - self.env['res.currency.rate'].search([]).unlink() self.env['res.currency.rate'].create({ 'name': time.strftime('%Y') + '-07-01', 'rate': 1.0, |
