diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
| commit | 3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch) | |
| tree | a44932296ef4a9b71d5f010906253d8c53727726 /addons/account/tests/test_account_tax.py | |
| parent | 0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff) | |
initial commit 2
Diffstat (limited to 'addons/account/tests/test_account_tax.py')
| -rw-r--r-- | addons/account/tests/test_account_tax.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/addons/account/tests/test_account_tax.py b/addons/account/tests/test_account_tax.py new file mode 100644 index 00000000..94bd2a16 --- /dev/null +++ b/addons/account/tests/test_account_tax.py @@ -0,0 +1,30 @@ +# -*- 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'] |
