diff options
| author | Laurent Smet <las@odoo.com> | 2020-07-14 06:55:56 +0000 |
|---|---|---|
| committer | Laurent Smet <las@odoo.com> | 2020-07-16 07:25:09 +0000 |
| commit | ce8eb6e93e5fec8a1d72ae1be283cce8ed470776 (patch) | |
| tree | 5bb0c8f055039935f736d966193f8bdd2bae6f55 /addons | |
| parent | 3b4962ccc75f7f0aa3f7931a2072a558b7f905f8 (diff) | |
[IMP] account: Remove test_account_move_rounding dependency to AccountTestCommon
l10n runbot builds are all failing when running at least one test depending of AccountTestCommon because it:
- doesn't create a sandboxed testing environnement to manage the multi-currency, multi-company, the default company's currency, the exchange rates...
- doesn't setup a testing user then all tests are done using the superuser.
- doesn't provide a fully setup chart of accounts: exchange difference journal is not set, accounts have bad types, etc...
- is run sometimes at-install.
--task: 2296213
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/account/tests/test_account_move_rounding.py | 59 |
1 files changed, 6 insertions, 53 deletions
diff --git a/addons/account/tests/test_account_move_rounding.py b/addons/account/tests/test_account_move_rounding.py index 5514ec05c57..92f76b7c68c 100644 --- a/addons/account/tests/test_account_move_rounding.py +++ b/addons/account/tests/test_account_move_rounding.py @@ -1,43 +1,11 @@ # -*- coding: utf-8 -*- -from odoo.addons.account.tests.common import AccountTestCommon +from odoo.addons.account.tests.common import AccountTestInvoicingCommon from odoo.tests import tagged @tagged('post_install', '-at_install') -class TestAccountMoveRounding(AccountTestCommon): - - @classmethod - def setUpClass(cls): - super(TestAccountMoveRounding, cls).setUpClass() - cls.currency = cls.env['res.currency'].create({ - 'name': "RAM", - 'symbol': "🐏", - 'rounding': 0.01, - }) - cls.company = cls.env['res.company'].create({ - 'name': "SHEEP", - 'currency_id': cls.currency.id, - }) - cls.account_type = cls.env['account.account.type'].create({ - 'name': 'BAAH', - 'internal_group': 'asset', - 'type': 'receivable' - }) - cls.journal = cls.env['account.journal'].create({ - 'company_id': cls.company.id, - 'name': 'LAMB', - 'code': 'LL', - 'type': 'purchase', - }) - cls.account = cls.env['account.account'].create({ - 'company_id': cls.company.id, - 'name': 'EWE', - 'code': 'EE', - 'user_type_id': cls.account_type.id, - 'reconcile': True, - }) - +class TestAccountMoveRounding(AccountTestInvoicingCommon): def test_move_line_rounding(self): """Whatever arguments we give to the creation of an account move, @@ -49,30 +17,15 @@ class TestAccountMoveRounding(AccountTestCommon): In principle, it should not be necessary to add it to the create values, since it is supposed to be computed by the ORM... """ - move1 = self.env['account.move'].create({ - 'journal_id': self.journal.id, - 'line_ids': [ - (0, 0, {'debit': 100.0 / 3, 'account_id': self.account.id}), - (0, 0, {'credit': 100.0 / 3, 'account_id': self.account.id}), - ], - }) - move2 = self.env['account.move'].create({ - 'journal_id': self.journal.id, + move = self.env['account.move'].create({ 'line_ids': [ - (0, 0, {'debit': 100.0 / 3, 'account_id': self.account.id, - 'company_currency_id': self.company.currency_id.id}), - (0, 0, {'credit': 100.0 / 3, 'account_id': self.account.id, - 'company_currency_id': self.company.currency_id.id}), + (0, 0, {'debit': 100.0 / 3, 'account_id': self.company_data['default_account_revenue'].id}), + (0, 0, {'credit': 100.0 / 3, 'account_id': self.company_data['default_account_revenue'].id}), ], }) self.assertEqual( [(33.33, 0.0), (0.0, 33.33)], - move2.line_ids.mapped(lambda x: (x.debit, x.credit)), + move.line_ids.mapped(lambda x: (x.debit, x.credit)), "Quantities should have been rounded according to the currency." ) - self.assertEqual( - move1.line_ids.mapped(lambda x: (x.debit, x.credit)), - move2.line_ids.mapped(lambda x: (x.debit, x.credit)), - "In both cases the rounding should be correctly done." - ) |
