[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
This commit is contained in:
@@ -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,
|
||||
move = self.env['account.move'].create({
|
||||
'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,
|
||||
'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."
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user