summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoroco-odoo <oco@odoo.com>2021-01-14 15:59:09 +0000
committeroco-odoo <oco@odoo.com>2021-01-14 15:59:09 +0000
commitec414a5bb785375d13ea324f345c1eaf5747ddfa (patch)
treee881f87946400903924fdd2c48bf2944f1d59702
parent989465016d578866a0a2535ffa2cfb2112411678 (diff)
[REV] account: don't try to support tax exigibility modification on a tax if a draft entry is using it
This reverts commit 9d4b22fbf6469ada08c28bc2afcd5b5492eac52a. We don't want to support this use case, as this kind of configuration change in the middle of creating an invoice is a very narrow corner case that can be avoided easily. Supporting it for tax exigibility would mean we also need to support it for repartition lines, amounts, affect base, ... This would be a lot of overhead for nothing. closes odoo/odoo#64529 X-original-commit: 1a57bd4b8f09d3d7bd2f06cf5c3fde258abcdab9 Signed-off-by: Laurent Smet <smetl@users.noreply.github.com> Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
-rw-r--r--addons/account/tests/test_invoice_taxes.py52
1 files changed, 0 insertions, 52 deletions
diff --git a/addons/account/tests/test_invoice_taxes.py b/addons/account/tests/test_invoice_taxes.py
index f1098d6fa71..83b9faa26bc 100644
--- a/addons/account/tests/test_invoice_taxes.py
+++ b/addons/account/tests/test_invoice_taxes.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-from odoo import fields
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
from odoo.tests import tagged, Form
@@ -668,54 +667,3 @@ class TestInvoiceTaxes(AccountTestInvoicingCommon):
(50, self.percent_tax_3_incl),
], currency_id=self.currency_data['currency'], invoice_payment_term_id=self.pay_terms_a)
invoice.action_post()
-
- def test_changing_tax_to_caba_after_create_invoice(self):
- tax_waiting_account = self.env['account.account'].create({
- 'name': 'TAX_WAIT',
- 'code': 'TWAIT',
- 'user_type_id': self.env.ref('account.data_account_type_current_liabilities').id,
- 'reconcile': True,
- 'company_id': self.company_data['company'].id,
- })
- sale_tax = self.company_data['default_tax_sale']
- invoice = self._create_invoice([
- (100, sale_tax),
- ])
- # turn on cash basis on the same tax that was used
- self.company_data['company'].tax_exigibility = True
- sale_tax.write({
- 'tax_exigibility': 'on_payment',
- 'cash_basis_transition_account_id': tax_waiting_account.id,
- })
- invoice.action_post()
-
- tax_lines = invoice.line_ids.filtered('tax_line_id')
- self.assertEqual(len(tax_lines), 1, 'Should have only 1 tax line')
- self.assertNotEqual(tax_lines.price_unit, 0.0)
- self.assertEqual(tax_lines.tax_base_amount, 100.0)
- self.assertEqual(tax_lines.account_id.name, 'TAX_WAIT')
-
- def test_recompute_tax_when_change_currency(self):
- """
- - In a multi currency company, create an invoice with the domestic
- currency ($);
- - Add a product (100$) with taxes;
- - Change the currency to a foreign one (€);
- - The product don't change of amount but only of currency (500€);
- - Save the invoice, and print it.
- """
- invoice = self._create_invoice([
- (100, self.percent_tax_1),
- ])
- tax_line = invoice.line_ids.filtered('tax_line_id')
- self.env['res.currency.rate'].create({
- 'name': fields.Date.to_string(fields.Date.today()),
- 'rate': 4.0,
- 'currency_id': self.currency_data['currency'].id,
- 'company_id': self.env.company.id,
- })
- with Form(invoice) as invoice_form:
- invoice_form.currency_id = self.currency_data['currency']
-
- self.assertEqual(tax_line.tax_base_amount, 25, 'Should convert tax base amount to company currency')
- self.assertEqual(tax_line.balance, -5.25, 'Should convert balance to company currency')