Files
odoo_source/addons/account/tests/test_account_tax.py
T
Laurent Smet 564a1b94a7 [IMP] account,l10n_fi: Allow custom COA in accounting test suite
- A custom COA could be passed as parameter.
- Merge the invoice setup to the generic suite like it is in master.

forwart-port of https://github.com/odoo/odoo/commit/161498cf8a75d62f9a8e1a17c6dc62a142b85acc

closes odoo/odoo#52378

X-original-commit: c0acebe2c55f7030df3bd10ad8058da6a070aa72
Related: odoo/enterprise#10921
Signed-off-by: Josse Colpaert <jco@openerp.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-06-04 06:28:07 +00:00

31 lines
1.1 KiB
Python

# -*- coding: utf-8 -*-
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
from odoo.tests import tagged
from odoo.exceptions import UserError
@tagged('post_install', '-at_install')
class TestAccountTax(AccountTestInvoicingCommon):
def test_changing_tax_company(self):
''' Ensure you can't change the company of an account.tax if there are some journal entries '''
# Avoid duplicate key value violates unique constraint "account_tax_name_company_uniq".
self.company_data['default_tax_sale'].name = 'test_changing_account_company'
self.env['account.move'].create({
'move_type': 'out_invoice',
'date': '2019-01-01',
'invoice_line_ids': [
(0, 0, {
'name': 'invoice_line',
'quantity': 1.0,
'price_unit': 100.0,
'tax_ids': [(6, 0, self.company_data['default_tax_sale'].ids)],
}),
],
})
with self.assertRaises(UserError), self.cr.savepoint():
self.company_data['default_tax_sale'].company_id = self.company_data_2['company']