Skip to content

Commit 4734c64

Browse files
teste
1 parent d243e37 commit 4734c64

File tree

3 files changed

+50
-41
lines changed

3 files changed

+50
-41
lines changed

l10n_br_account/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
22
from . import account_tax_group
33
from . import fiscal_tax_group
4+
from . import template_br_oca
45
from . import account_tax
56
from . import fiscal_tax
67
from . import fiscal_operation

l10n_br_account/models/template_br_oca.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Copyright (C) 2019 Renato Lima - Akretion
2+
# Copyright 2025 Escodoo - Marcel Savegnago <https://www.escodoo.com.br>
23
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
34

45
from odoo import Command, models

l10n_br_account/tests/test_multi_localizations_invoice.py

Lines changed: 48 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# Copyright (C) 2023 - TODAY Raphaël Valyi - Akretion
22
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
33

4-
import logging
4+
from contextlib import contextmanager
55

66
from odoo.tests.common import tagged
77
from odoo.tests.suite import OdooSuite
88

9-
_logger = logging.getLogger(__name__)
9+
from odoo.addons.account.tests import common
10+
11+
from .common import instantiate_accountman
1012

1113

1214
# ruff: noqa: E501 - line too long
@@ -52,12 +54,12 @@ def setup_company_data(cls, company_name, chart_template=None, **kwargs):
5254

5355
@classmethod
5456
def setUpClass(cls, chart_template_ref=None):
55-
res = super().setUpClass(chart_template_ref)
56-
# FIXME the following line should not be required but as for
57-
# now if we don't add this group, creating a refund will result
58-
# in an attempt to create a l10n_br_fiscal.subsequent.document record.
59-
cls.env.user.groups_id |= cls.env.ref("l10n_br_fiscal.group_manager")
60-
return res
57+
def instantiate(cls):
58+
instantiate_accountman(cls)
59+
cls.user.lang = "en_US"
60+
61+
common.instantiate_accountman = instantiate
62+
return super().setUpClass(chart_template_ref)
6163

6264
# The following tests list is taken with
6365
# cat addons/account/tests/test_account_move_out_invoice.py | grep "def test_"
@@ -84,28 +86,25 @@ def test_force_out_invoice_line_onchange_product_2_with_fiscal_pos_2(self):
8486
# FIXME
8587
# return super().test_out_invoice_line_onchange_business_fields_1()
8688

87-
# def test_force_out_invoice_line_onchange_accounting_fields_1(self):
88-
# FIXME this test works with most of the l10n-brazil modules
89-
# but fails because of _order = "date desc, date_maturity ASC, id desc"
90-
# inside l10n_br_account_payment_order/models/account_move_line.py
91-
# return super().test_out_invoice_line_onchange_accounting_fields_1()
92-
9389
def test_force_out_invoice_line_onchange_partner_1(self):
9490
return super().test_out_invoice_line_onchange_partner_1()
9591

96-
# FIXME
97-
# def test_force_out_invoice_line_onchange_taxes_1(self):
98-
# return super().test_out_invoice_line_onchange_taxes_1()
92+
def test_force_out_invoice_line_onchange_taxes_1(self):
93+
with self._with_invoice_form_force_show_tax_ids():
94+
return super().test_out_invoice_line_onchange_taxes_1()
9995

10096
def test_force_out_invoice_line_onchange_rounding_price_subtotal_1(self):
10197
return super().test_out_invoice_line_onchange_rounding_price_subtotal_1()
10298

103-
# FIXME
104-
# def test_force_out_invoice_line_onchange_rounding_price_subtotal_2(self):
105-
# return super().test_out_invoice_line_onchange_rounding_price_subtotal_2()
106-
# FIXME
107-
# def test_force_out_invoice_line_onchange_taxes_2_price_unit_tax_included(self):
108-
# return super().test_out_invoice_line_onchange_taxes_2_price_unit_tax_included()
99+
def test_force_out_invoice_line_onchange_rounding_price_subtotal_2(self):
100+
with self._with_invoice_form_force_show_tax_ids():
101+
return super().test_out_invoice_line_onchange_rounding_price_subtotal_2()
102+
103+
def test_force_out_invoice_line_onchange_taxes_2_price_unit_tax_included(self):
104+
with self._with_invoice_form_force_show_tax_ids():
105+
return (
106+
super().test_out_invoice_line_onchange_taxes_2_price_unit_tax_included()
107+
)
109108

110109
def test_force_out_invoice_line_onchange_analytic(self):
111110
return super().test_out_invoice_line_onchange_analytic()
@@ -116,17 +115,14 @@ def test_force_out_invoice_line_onchange_analytic_2(self):
116115
def test_force_out_invoice_line_onchange_cash_rounding_1(self):
117116
return super().test_out_invoice_line_onchange_cash_rounding_1()
118117

119-
# def test_force_out_invoice_line_onchange_currency_1(self):
120-
# FIXME broken after https://github.com/OCA/l10n-brazil/issues/3617
121-
# return super().test_out_invoice_line_onchange_currency_1()
118+
def test_force_out_invoice_line_onchange_currency_1(self):
119+
return super().test_out_invoice_line_onchange_currency_1()
122120

123-
# def test_force_out_invoice_line_tax_fixed_price_include_free_product(self):
124-
# FIXME
125-
# return super().test_out_invoice_line_tax_fixed_price_include_free_product()
121+
def test_force_out_invoice_line_tax_fixed_price_include_free_product(self):
122+
return super().test_out_invoice_line_tax_fixed_price_include_free_product()
126123

127-
# def test_force_out_invoice_line_taxes_fixed_price_include_free_product(self):
128-
# FIXME
129-
# return super().test_out_invoice_line_taxes_fixed_price_include_free_product()
124+
def test_force_out_invoice_line_taxes_fixed_price_include_free_product(self):
125+
return super().test_out_invoice_line_taxes_fixed_price_include_free_product()
130126

131127
def test_force_out_invoice_create_refund(self):
132128
return super().test_out_invoice_create_refund()
@@ -176,11 +172,13 @@ def test_force_out_invoice_filter_zero_balance_lines(self):
176172
def test_force_out_invoice_recomputation_receivable_lines(self):
177173
return super().test_out_invoice_recomputation_receivable_lines()
178174

179-
# def test_force_out_invoice_rounding_recomputation_receivable_lines(self):
180-
# return super().test_out_invoice_rounding_recomputation_receivable_lines()
175+
def test_force_out_invoice_rounding_recomputation_receivable_lines(self):
176+
with self._with_invoice_form_force_show_tax_ids():
177+
return super().test_out_invoice_rounding_recomputation_receivable_lines()
181178

182-
# def test_force_out_invoice_multi_company(self):
183-
# return super().test_out_invoice_multi_company()
179+
def test_force_out_invoice_multi_company(self):
180+
with self._with_invoice_form_force_show_tax_ids():
181+
return super().test_out_invoice_multi_company()
184182

185183
def test_force_out_invoice_multiple_switch_payment_terms(self):
186184
return super().test_out_invoice_multiple_switch_payment_terms()
@@ -191,11 +189,20 @@ def test_force_out_invoice_copy_custom_date(self):
191189
def test_force_out_invoice_note_and_tax_partner_is_set(self):
192190
return super().test_out_invoice_note_and_tax_partner_is_set()
193191

194-
# def test_force_out_invoice_reverse_caba(self):
195-
# return super().test_out_invoice_reverse_caba()
196-
197-
# def test_force_out_invoice_duplicate_currency_rate(self):
198-
# return super().test_out_invoice_duplicate_currency_rate()
192+
def test_force_out_invoice_reverse_caba(self):
193+
with self._with_invoice_form_force_show_tax_ids():
194+
return super().test_out_invoice_reverse_caba()
199195

200196
def test_force_out_invoice_depreciated_account(self):
201197
return super().test_out_invoice_depreciated_account()
198+
199+
@contextmanager
200+
def _with_invoice_form_force_show_tax_ids(self):
201+
env_orig = self.env
202+
self.env = self.env(
203+
context=dict(env_orig.context, force_show_invoice_tax_ids=True)
204+
)
205+
self.invoice = self.invoice.with_env(self.env)
206+
yield
207+
self.env = env_orig
208+
self.invoice = self.invoice.with_env(self.env)

0 commit comments

Comments
 (0)