odoo-addon-l10n-br-fiscal 18.0.2.0.0.10__py3-none-any.whl → 18.0.7.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of odoo-addon-l10n-br-fiscal might be problematic. Click here for more details.
- odoo/addons/l10n_br_fiscal/README.rst +1 -1
- odoo/addons/l10n_br_fiscal/__manifest__.py +7 -3
- odoo/addons/l10n_br_fiscal/constants/fiscal.py +64 -18
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal.cest.csv +1043 -983
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal.cst.csv +58 -0
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal.document.type.csv +1 -0
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal.operation.indicator.csv +27 -0
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal.tax.classification.csv +163 -0
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal.tax.csv +31 -0
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal.tax.group.csv +3 -0
- odoo/addons/l10n_br_fiscal/data/operation_data.xml +1 -1
- odoo/addons/l10n_br_fiscal/demo/fiscal_document_demo.xml +3 -179
- odoo/addons/l10n_br_fiscal/demo/fiscal_document_nfse_demo.xml +0 -4
- odoo/addons/l10n_br_fiscal/demo/fiscal_operation_demo.xml +2 -2
- odoo/addons/l10n_br_fiscal/i18n/l10n_br_fiscal.pot +665 -79
- odoo/addons/l10n_br_fiscal/i18n/pt_BR.po +713 -102
- odoo/addons/l10n_br_fiscal/migrations/18.0.3.0.0/pre-migration.py +30 -0
- odoo/addons/l10n_br_fiscal/models/__init__.py +2 -2
- odoo/addons/l10n_br_fiscal/models/comment.py +3 -1
- odoo/addons/l10n_br_fiscal/models/data_abstract.py +9 -6
- odoo/addons/l10n_br_fiscal/models/document.py +27 -8
- odoo/addons/l10n_br_fiscal/models/document_line.py +51 -8
- odoo/addons/l10n_br_fiscal/models/document_line_mixin.py +1107 -35
- odoo/addons/l10n_br_fiscal/models/document_mixin.py +244 -6
- odoo/addons/l10n_br_fiscal/models/document_related.py +1 -1
- odoo/addons/l10n_br_fiscal/models/document_serie.py +33 -0
- odoo/addons/l10n_br_fiscal/models/icms_regulation.py +1 -1
- odoo/addons/l10n_br_fiscal/models/operation_dashboard.py +3 -2
- odoo/addons/l10n_br_fiscal/models/operation_indicator.py +58 -0
- odoo/addons/l10n_br_fiscal/models/operation_line.py +28 -0
- odoo/addons/l10n_br_fiscal/models/partner_profile.py +6 -0
- odoo/addons/l10n_br_fiscal/models/product_template.py +4 -0
- odoo/addons/l10n_br_fiscal/models/res_company.py +17 -0
- odoo/addons/l10n_br_fiscal/models/res_partner.py +17 -0
- odoo/addons/l10n_br_fiscal/models/simplified_tax_range.py +8 -0
- odoo/addons/l10n_br_fiscal/models/tax.py +7 -3
- odoo/addons/l10n_br_fiscal/models/tax_classification.py +81 -0
- odoo/addons/l10n_br_fiscal/security/fiscal_security.xml +6 -16
- odoo/addons/l10n_br_fiscal/security/ir.model.access.csv +7 -2
- odoo/addons/l10n_br_fiscal/static/description/index.html +1 -1
- odoo/addons/l10n_br_fiscal/tests/__init__.py +2 -0
- odoo/addons/l10n_br_fiscal/tests/test_document_edition.py +175 -10
- odoo/addons/l10n_br_fiscal/tests/test_fiscal_document_generic.py +13 -42
- odoo/addons/l10n_br_fiscal/tests/test_fiscal_document_nfse.py +0 -5
- odoo/addons/l10n_br_fiscal/tests/test_fiscal_document_serie.py +60 -0
- odoo/addons/l10n_br_fiscal/tests/test_tax_benefit.py +2 -5
- odoo/addons/l10n_br_fiscal/tests/test_tax_classification.py +110 -0
- odoo/addons/l10n_br_fiscal/views/document_line_mixin_view.xml +107 -4
- odoo/addons/l10n_br_fiscal/views/document_line_view.xml +7 -3
- odoo/addons/l10n_br_fiscal/views/document_view.xml +34 -15
- odoo/addons/l10n_br_fiscal/views/icms_regulation_view.xml +1 -5
- odoo/addons/l10n_br_fiscal/views/l10n_br_fiscal_action.xml +30 -0
- odoo/addons/l10n_br_fiscal/views/l10n_br_fiscal_menu.xml +16 -9
- odoo/addons/l10n_br_fiscal/views/nbs_view.xml +1 -5
- odoo/addons/l10n_br_fiscal/views/ncm_view.xml +1 -5
- odoo/addons/l10n_br_fiscal/views/operation_dashboard_view.xml +3 -3
- odoo/addons/l10n_br_fiscal/views/operation_indicator_view.xml +75 -0
- odoo/addons/l10n_br_fiscal/views/operation_line_view.xml +4 -5
- odoo/addons/l10n_br_fiscal/views/operation_view.xml +1 -5
- odoo/addons/l10n_br_fiscal/views/product_product_view.xml +33 -6
- odoo/addons/l10n_br_fiscal/views/product_template_view.xml +22 -4
- odoo/addons/l10n_br_fiscal/views/res_company_view.xml +6 -0
- odoo/addons/l10n_br_fiscal/views/res_partner_view.xml +10 -0
- odoo/addons/l10n_br_fiscal/views/service_type_view.xml +1 -5
- odoo/addons/l10n_br_fiscal/views/tax_classification.xml +108 -0
- odoo/addons/l10n_br_fiscal/views/tax_definition_view.xml +1 -5
- odoo/addons/l10n_br_fiscal/views/tax_view.xml +2 -2
- odoo/addons/l10n_br_fiscal/wizards/__init__.py +1 -1
- odoo/addons/l10n_br_fiscal/wizards/base_wizard_mixin.py +1 -1
- odoo/addons/l10n_br_fiscal/wizards/document_import_wizard.py +234 -0
- odoo/addons/l10n_br_fiscal/wizards/{document_import_wizard_mixin.xml → document_import_wizard.xml} +26 -7
- {odoo_addon_l10n_br_fiscal-18.0.2.0.0.10.dist-info → odoo_addon_l10n_br_fiscal-18.0.7.1.0.dist-info}/METADATA +3 -3
- {odoo_addon_l10n_br_fiscal-18.0.2.0.0.10.dist-info → odoo_addon_l10n_br_fiscal-18.0.7.1.0.dist-info}/RECORD +75 -68
- odoo/addons/l10n_br_fiscal/models/document_line_mixin_methods.py +0 -837
- odoo/addons/l10n_br_fiscal/models/document_mixin_methods.py +0 -349
- odoo/addons/l10n_br_fiscal/wizards/document_import_wizard_mixin.py +0 -129
- {odoo_addon_l10n_br_fiscal-18.0.2.0.0.10.dist-info → odoo_addon_l10n_br_fiscal-18.0.7.1.0.dist-info}/WHEEL +0 -0
- {odoo_addon_l10n_br_fiscal-18.0.2.0.0.10.dist-info → odoo_addon_l10n_br_fiscal-18.0.7.1.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Copyright 2025 Marcel Savegnago <https://escodoo.com.br>
|
|
2
|
+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
|
3
|
+
|
|
4
|
+
from odoo import api, fields, models
|
|
5
|
+
|
|
6
|
+
from ..constants.fiscal import (
|
|
7
|
+
TAX_DOMAIN_CBS,
|
|
8
|
+
TAX_DOMAIN_IBS,
|
|
9
|
+
TAX_RATE_TYPE,
|
|
10
|
+
TAX_RATE_TYPE_DEFAULT,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class TaxClassification(models.Model):
|
|
15
|
+
_name = "l10n_br_fiscal.tax.classification"
|
|
16
|
+
_inherit = "l10n_br_fiscal.data.abstract"
|
|
17
|
+
_order = "code"
|
|
18
|
+
_description = "Tax Classification"
|
|
19
|
+
|
|
20
|
+
code = fields.Char(size=8)
|
|
21
|
+
|
|
22
|
+
description = fields.Text()
|
|
23
|
+
|
|
24
|
+
cst_code_prefix_like = fields.Char(
|
|
25
|
+
compute="_compute_cst_code_prefix_like",
|
|
26
|
+
help="Helper field to filter taxes by CST code prefix (3 chars) using LIKE.",
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
@api.depends("code")
|
|
30
|
+
def _compute_cst_code_prefix_like(self):
|
|
31
|
+
for rec in self:
|
|
32
|
+
prefix = (rec.code or "")[:3]
|
|
33
|
+
# Avoid matching all records when the prefix is not available yet.
|
|
34
|
+
rec.cst_code_prefix_like = (
|
|
35
|
+
f"{prefix}%" if len(prefix) == 3 else "__no_match__%"
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
tax_ibs_id = fields.Many2one(
|
|
39
|
+
comodel_name="l10n_br_fiscal.tax",
|
|
40
|
+
string="Tax IBS",
|
|
41
|
+
domain=(
|
|
42
|
+
f"[('tax_domain', '=', '{TAX_DOMAIN_IBS}'), '|', "
|
|
43
|
+
"('cst_in_id.code', 'like', cst_code_prefix_like), "
|
|
44
|
+
"('cst_out_id.code', 'like', cst_code_prefix_like)]"
|
|
45
|
+
),
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
tax_cbs_id = fields.Many2one(
|
|
49
|
+
comodel_name="l10n_br_fiscal.tax",
|
|
50
|
+
string="Tax CBS",
|
|
51
|
+
domain=(
|
|
52
|
+
f"[('tax_domain', '=', '{TAX_DOMAIN_CBS}'), '|', "
|
|
53
|
+
"('cst_in_id.code', 'like', cst_code_prefix_like), "
|
|
54
|
+
"('cst_out_id.code', 'like', cst_code_prefix_like)]"
|
|
55
|
+
),
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
regular_taxation = fields.Boolean(
|
|
59
|
+
default=False,
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
presumed_credit = fields.Boolean(
|
|
63
|
+
default=False,
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
credit_reversal = fields.Boolean(
|
|
67
|
+
default=False,
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
rate_type = fields.Selection(
|
|
71
|
+
selection=TAX_RATE_TYPE,
|
|
72
|
+
default=TAX_RATE_TYPE_DEFAULT,
|
|
73
|
+
required=True,
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
document_type_ids = fields.Many2many(
|
|
77
|
+
comodel_name="l10n_br_fiscal.document.type",
|
|
78
|
+
relation="tax_classification_document_type_rel",
|
|
79
|
+
string="Related DFes",
|
|
80
|
+
help="Related Digital Fiscal Documents",
|
|
81
|
+
)
|
|
@@ -38,44 +38,34 @@
|
|
|
38
38
|
<field name="name">Fiscal Tax Estimate multi-company</field>
|
|
39
39
|
<field name="model_id" ref="model_l10n_br_fiscal_tax_estimate" />
|
|
40
40
|
<field eval="True" name="global" />
|
|
41
|
-
<field
|
|
42
|
-
name="domain_force"
|
|
43
|
-
>['|',('company_id','=',False),('company_id','in',company_ids)]</field>
|
|
41
|
+
<field name="domain_force">[('company_id', 'in', company_ids + [False])]</field>
|
|
44
42
|
</record>
|
|
45
43
|
|
|
46
|
-
<record id="
|
|
44
|
+
<record id="l10n_br_fiscal_operation_rule" model="ir.rule">
|
|
47
45
|
<field name="name">Fiscal Operation multi-company</field>
|
|
48
46
|
<field name="model_id" ref="model_l10n_br_fiscal_operation" />
|
|
49
47
|
<field eval="True" name="global" />
|
|
50
|
-
<field
|
|
51
|
-
name="domain_force"
|
|
52
|
-
>['|',('company_id','=',False),('company_id','in',company_ids)]</field>
|
|
48
|
+
<field name="domain_force">[('company_id', 'in', company_ids + [False])]</field>
|
|
53
49
|
</record>
|
|
54
50
|
|
|
55
51
|
<record id="l10n_br_fiscal_document_serie_rule" model="ir.rule">
|
|
56
52
|
<field name="name">Fiscal Document Serie multi-company</field>
|
|
57
53
|
<field name="model_id" ref="model_l10n_br_fiscal_document_serie" />
|
|
58
54
|
<field eval="True" name="global" />
|
|
59
|
-
<field
|
|
60
|
-
name="domain_force"
|
|
61
|
-
>['|',('company_id','=',False),('company_id','in',company_ids)]</field>
|
|
55
|
+
<field name="domain_force">[('company_id', 'in', company_ids + [False])]</field>
|
|
62
56
|
</record>
|
|
63
57
|
|
|
64
58
|
<record id="l10n_br_fiscal_document_rule" model="ir.rule">
|
|
65
59
|
<field name="name">Fiscal Document multi-company</field>
|
|
66
60
|
<field name="model_id" ref="model_l10n_br_fiscal_document" />
|
|
67
61
|
<field eval="True" name="global" />
|
|
68
|
-
<field
|
|
69
|
-
name="domain_force"
|
|
70
|
-
>['|',('company_id','=',False),('company_id','in',company_ids)]</field>
|
|
62
|
+
<field name="domain_force">[('company_id', 'in', company_ids + [False])]</field>
|
|
71
63
|
</record>
|
|
72
64
|
|
|
73
65
|
<record id="l10n_br_fiscal_document_line_rule" model="ir.rule">
|
|
74
66
|
<field name="name">Fiscal Document line multi-company</field>
|
|
75
67
|
<field name="model_id" ref="model_l10n_br_fiscal_document_line" />
|
|
76
68
|
<field eval="True" name="global" />
|
|
77
|
-
<field
|
|
78
|
-
name="domain_force"
|
|
79
|
-
>['|',('company_id','=',False),('company_id','in',company_ids)]</field>
|
|
69
|
+
<field name="domain_force">[('company_id', 'in', company_ids + [False])]</field>
|
|
80
70
|
</record>
|
|
81
71
|
</odoo>
|
|
@@ -38,6 +38,9 @@
|
|
|
38
38
|
"l10n_br_fiscal_cest_user","Fiscal CEST for User","model_l10n_br_fiscal_cest","l10n_br_fiscal.group_user",1,0,0,0
|
|
39
39
|
"l10n_br_fiscal_cest_manager","Fiscal CEST for Manager","model_l10n_br_fiscal_cest","l10n_br_fiscal.group_manager",1,0,0,0
|
|
40
40
|
"l10n_br_fiscal_cest_maintenance","Fiscal CEST for Maintenance","model_l10n_br_fiscal_cest","l10n_br_fiscal.group_data_maintenance",1,1,1,1
|
|
41
|
+
"l10n_br_fiscal_tax_classification_user","Fiscal Tax Classification for User","model_l10n_br_fiscal_tax_classification","l10n_br_fiscal.group_user",1,0,0,0
|
|
42
|
+
"l10n_br_fiscal_tax_classification_manager","Fiscal Tax Classification for Manager","model_l10n_br_fiscal_tax_classification","l10n_br_fiscal.group_manager",1,0,0,0
|
|
43
|
+
"l10n_br_fiscal_tax_classification_maintenance","Fiscal Tax Classification for Maintenance","model_l10n_br_fiscal_tax_classification","l10n_br_fiscal.group_data_maintenance",1,1,1,1
|
|
41
44
|
"l10n_br_fiscal_product_genre_user","Fiscal Fiscal Product Genre for User","model_l10n_br_fiscal_product_genre","l10n_br_fiscal.group_user",1,0,0,0
|
|
42
45
|
"l10n_br_fiscal_product_genre_manager","Fiscal Fiscal Product Genre for Manager","model_l10n_br_fiscal_product_genre","l10n_br_fiscal.group_manager",1,0,0,0
|
|
43
46
|
"l10n_br_fiscal_product_genre_maintenance","Fiscal Fiscal Product Genre for Maintenance","model_l10n_br_fiscal_product_genre","l10n_br_fiscal.group_data_maintenance",1,1,1,1
|
|
@@ -67,6 +70,9 @@
|
|
|
67
70
|
"l10n_br_fiscal_operation_line_manager","Fiscal Operation Line for Manager","model_l10n_br_fiscal_operation_line","l10n_br_fiscal.group_manager",1,1,1,1
|
|
68
71
|
"l10n_br_fiscal_operation_document_type_user","Fiscal Operation Document Type for User","model_l10n_br_fiscal_operation_document_type","l10n_br_fiscal.group_user",1,0,0,0
|
|
69
72
|
"l10n_br_fiscal_operation_document_type_manager","Fiscal Operation Document Type for Manager","model_l10n_br_fiscal_operation_document_type","l10n_br_fiscal.group_manager",1,1,1,1
|
|
73
|
+
"l10n_br_fiscal_operation_indicator_user","Operation Indicator for User","model_l10n_br_fiscal_operation_indicator","l10n_br_fiscal.group_user",1,0,0,0
|
|
74
|
+
"l10n_br_fiscal_operation_indicator_manager","Operation Indicator for Manager","model_l10n_br_fiscal_operation_indicator","l10n_br_fiscal.group_manager",1,1,1,1
|
|
75
|
+
"l10n_br_fiscal_operation_indicator_maintenance","Operation Indicator for Maintenance","model_l10n_br_fiscal_operation_indicator","l10n_br_fiscal.group_data_maintenance",1,1,1,1
|
|
70
76
|
"l10n_br_fiscal_partner_profile_user","Fiscal Partner Profile for User","model_l10n_br_fiscal_partner_profile","base.group_user",1,0,0,0
|
|
71
77
|
"l10n_br_fiscal_partner_profile_manager","Fiscal Partner Profile for Manager","model_l10n_br_fiscal_partner_profile","l10n_br_fiscal.group_manager",1,1,1,1
|
|
72
78
|
"l10n_br_fiscal_document_user","Fiscal Document for User","model_l10n_br_fiscal_document","l10n_br_fiscal.group_user",1,1,1,0
|
|
@@ -94,6 +100,5 @@
|
|
|
94
100
|
"l10n_br_fiscal_invalidate_number_manager","manager_l10n_br_fiscal_invalidate_number","model_l10n_br_fiscal_invalidate_number","l10n_br_fiscal.group_manager",1,1,1,1
|
|
95
101
|
"l10n_br_fiscal_city_taxation_code_user","Fiscal City Taxation Code for User","model_l10n_br_fiscal_city_taxation_code","l10n_br_fiscal.group_user",1,1,1,0
|
|
96
102
|
"l10n_br_fiscal_city_taxation_code_manager","Fiscal City Taxation Code for Manager","model_l10n_br_fiscal_city_taxation_code","l10n_br_fiscal.group_user",1,1,1,1
|
|
97
|
-
"l10n_br_fiscal_base_wizard_mixin_user",l10n_br_fiscal_base_wizard_mixin,model_l10n_br_fiscal_base_wizard_mixin,base.group_user,1,1,1,1
|
|
98
103
|
"l10n_br_fiscal_document_status_wizard_user",l10n_br_fiscal_document_status_wizard,model_l10n_br_fiscal_document_status_wizard,base.group_user,1,1,1,1
|
|
99
|
-
"
|
|
104
|
+
"l10n_br_fiscal_document_import_wizard_user",l10n_br_fiscal_document_import_wizard_user,model_l10n_br_fiscal_document_import_wizard,base.group_user,1,1,1,1
|
|
@@ -372,7 +372,7 @@ ul.auto-toc {
|
|
|
372
372
|
!! This file is generated by oca-gen-addon-readme !!
|
|
373
373
|
!! changes will be overwritten. !!
|
|
374
374
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
375
|
-
!! source digest: sha256:
|
|
375
|
+
!! source digest: sha256:5cd8cb0b01f3ea46d8329418b2478d777a70350607e16eee38900f6a08e7e3f2
|
|
376
376
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
|
377
377
|
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-brazil/tree/18.0/l10n_br_fiscal"><img alt="OCA/l10n-brazil" src="https://img.shields.io/badge/github-OCA%2Fl10n--brazil-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/l10n-brazil-18-0/l10n-brazil-18-0-l10n_br_fiscal"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/l10n-brazil&target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
|
378
378
|
<p><img alt="image" src="https://raw.githubusercontent.com/OCA/l10n-brazil/18.0/l10n_br_fiscal/static/img/fiscal_dashboard.png" /></p>
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
from unittest import mock
|
|
5
5
|
|
|
6
6
|
from odoo import Command
|
|
7
|
-
from odoo.tests import Form, TransactionCase
|
|
7
|
+
from odoo.tests import Form, TransactionCase, tagged
|
|
8
8
|
|
|
9
9
|
|
|
10
|
+
@tagged("post_install", "-at_install")
|
|
10
11
|
class TestDocumentEdition(TransactionCase):
|
|
11
12
|
@classmethod
|
|
12
13
|
def setUpClass(cls):
|
|
@@ -35,6 +36,10 @@ class TestDocumentEdition(TransactionCase):
|
|
|
35
36
|
cls.env = cls.env(
|
|
36
37
|
user=cls.user, context=dict(cls.env.context, tracking_disable=True)
|
|
37
38
|
)
|
|
39
|
+
cls.user = cls.env.user
|
|
40
|
+
cls.company = cls.env.ref("l10n_br_base.empresa_lucro_presumido")
|
|
41
|
+
cls.user.company_ids |= cls.company
|
|
42
|
+
cls.user.company_id = cls.company.id
|
|
38
43
|
|
|
39
44
|
def test_basic_doc_edition(self):
|
|
40
45
|
doc_form = Form(
|
|
@@ -98,20 +103,46 @@ class TestDocumentEdition(TransactionCase):
|
|
|
98
103
|
line_form.fiscal_operation_line_id,
|
|
99
104
|
self.env.ref("l10n_br_fiscal.fo_venda_revenda"),
|
|
100
105
|
)
|
|
106
|
+
self.assertEqual(
|
|
107
|
+
line_form.ipi_tax_id, self.env.ref("l10n_br_fiscal.tax_ipi_nt")
|
|
108
|
+
)
|
|
101
109
|
|
|
102
|
-
|
|
103
|
-
|
|
110
|
+
line_form.fiscal_operation_line_id = self.env.ref(
|
|
111
|
+
"l10n_br_fiscal.fo_venda_venda"
|
|
112
|
+
)
|
|
113
|
+
self.assertEqual(
|
|
114
|
+
line_form.ipi_tax_id, self.env.ref("l10n_br_fiscal.tax_ipi_3_25")
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
# ensure manually setting a xx_tax_id is properly saved (not recomputed):
|
|
118
|
+
line_form.icms_tax_id = self.env.ref("l10n_br_fiscal.tax_icms_18")
|
|
119
|
+
self.assertEqual(line_form.icms_value, 37.17)
|
|
120
|
+
self.assertEqual(
|
|
121
|
+
line_form.ipi_tax_id, self.env.ref("l10n_br_fiscal.tax_ipi_3_25")
|
|
122
|
+
)
|
|
123
|
+
line_form.icmsfcp_base = line_form.price_unit
|
|
124
|
+
line_form.icmsfcp_value = 3 # ensure manually setting FCP value works
|
|
104
125
|
|
|
105
126
|
doc = doc_form.save()
|
|
106
|
-
|
|
107
|
-
self.assertEqual(
|
|
108
|
-
self.assertEqual(
|
|
109
|
-
self.assertEqual(
|
|
110
|
-
self.assertEqual(
|
|
127
|
+
line = doc.fiscal_line_ids[0]
|
|
128
|
+
self.assertEqual(line.price_unit, 100)
|
|
129
|
+
self.assertEqual(line.fiscal_price, 100)
|
|
130
|
+
self.assertEqual(line.quantity, 2)
|
|
131
|
+
self.assertEqual(line.fiscal_quantity, 2)
|
|
132
|
+
self.assertEqual(len(line.fiscal_tax_ids), 4)
|
|
133
|
+
|
|
134
|
+
self.assertEqual(
|
|
135
|
+
line.fiscal_operation_line_id,
|
|
136
|
+
self.env.ref("l10n_br_fiscal.fo_venda_venda"),
|
|
137
|
+
)
|
|
111
138
|
self.assertEqual(
|
|
112
|
-
|
|
113
|
-
self.ref("l10n_br_fiscal.
|
|
139
|
+
line.icms_tax_id.id,
|
|
140
|
+
self.ref("l10n_br_fiscal.tax_icms_18"),
|
|
114
141
|
)
|
|
142
|
+
self.assertEqual(line.ipi_tax_id, self.env.ref("l10n_br_fiscal.tax_ipi_3_25"))
|
|
143
|
+
self.assertEqual(line.icms_value, 37.17)
|
|
144
|
+
self.assertEqual(line.icmsfcp_base, line.price_unit)
|
|
145
|
+
self.assertEqual(line.icmsfcp_value, 3)
|
|
115
146
|
|
|
116
147
|
def test_product_fiscal_factor(self):
|
|
117
148
|
doc_form = Form(
|
|
@@ -162,3 +193,137 @@ class TestDocumentEdition(TransactionCase):
|
|
|
162
193
|
self.assertEqual(doc.fiscal_line_ids[0].fiscal_price, 112)
|
|
163
194
|
self.assertEqual(doc.fiscal_line_ids[0].quantity, 10)
|
|
164
195
|
self.assertEqual(doc.fiscal_line_ids[0].fiscal_quantity, 5)
|
|
196
|
+
|
|
197
|
+
def test_landed_costs_by_line_and_by_total(self):
|
|
198
|
+
"""
|
|
199
|
+
Tests both landed cost scenarios: 'by line' and 'by total'.
|
|
200
|
+
1. By Line: Enters costs on lines and verifies the header totals.
|
|
201
|
+
2. By Total: Enters costs on the header and verifies lines distribution.
|
|
202
|
+
"""
|
|
203
|
+
self.env.user.groups_id |= self.env.ref("l10n_br_fiscal.group_user")
|
|
204
|
+
product1 = self.env.ref("product.product_product_6")
|
|
205
|
+
product2 = self.env.ref("product.product_product_7")
|
|
206
|
+
|
|
207
|
+
# Part 1: Test with delivery_costs = 'line'
|
|
208
|
+
# ----------------------------------------------------
|
|
209
|
+
self.company.delivery_costs = "line"
|
|
210
|
+
doc_form = Form(self.env["l10n_br_fiscal.document"])
|
|
211
|
+
doc_form.company_id = self.company
|
|
212
|
+
doc_form.partner_id = self.env.ref("l10n_br_base.res_partner_cliente1_sp")
|
|
213
|
+
doc_form.fiscal_operation_id = self.env.ref("l10n_br_fiscal.fo_venda")
|
|
214
|
+
|
|
215
|
+
with doc_form.fiscal_line_ids.new() as line1:
|
|
216
|
+
line1.product_id = product1
|
|
217
|
+
line1.fiscal_operation_line_id = self.env.ref(
|
|
218
|
+
"l10n_br_fiscal.fo_venda_venda"
|
|
219
|
+
)
|
|
220
|
+
line1.price_unit = 1000.0
|
|
221
|
+
line1.quantity = 2.0 # Gross: 2000
|
|
222
|
+
line1.freight_value = 10.0
|
|
223
|
+
line1.insurance_value = 20.0
|
|
224
|
+
line1.other_value = 5.0
|
|
225
|
+
|
|
226
|
+
with doc_form.fiscal_line_ids.new() as line2:
|
|
227
|
+
line2.product_id = product2
|
|
228
|
+
line2.fiscal_operation_line_id = self.env.ref(
|
|
229
|
+
"l10n_br_fiscal.fo_venda_venda"
|
|
230
|
+
)
|
|
231
|
+
line2.price_unit = 500.0
|
|
232
|
+
line2.quantity = 1.0 # Gross: 500
|
|
233
|
+
line2.freight_value = 4.0
|
|
234
|
+
line2.insurance_value = 6.0
|
|
235
|
+
line2.other_value = 2.0
|
|
236
|
+
|
|
237
|
+
doc = doc_form.save()
|
|
238
|
+
|
|
239
|
+
self.assertEqual(doc.company_id.delivery_costs, "line")
|
|
240
|
+
# Assert header totals are the SUM of line values
|
|
241
|
+
self.assertAlmostEqual(doc.amount_freight_value, 14.0) # 10.0 + 4.0
|
|
242
|
+
self.assertAlmostEqual(doc.amount_insurance_value, 26.0) # 20.0 + 6.0
|
|
243
|
+
self.assertAlmostEqual(doc.amount_other_value, 7.0) # 5.0 + 2.0
|
|
244
|
+
|
|
245
|
+
# Assert final fiscal totals (bottom-up calculation)
|
|
246
|
+
# price_gross = (1000*2) + (500*1) = 2500
|
|
247
|
+
# landed_costs = 14 + 26 + 7 = 47
|
|
248
|
+
# fiscal_amount_untaxed (IPI Base) = 2500 + 47 = 2547
|
|
249
|
+
self.assertAlmostEqual(doc.fiscal_amount_untaxed, 2547.00)
|
|
250
|
+
# fiscal_amount_tax (IPI) = (2035 * 3.25%) + (512 * 5%) = 66.14 + 25.60 = 91.74
|
|
251
|
+
self.assertAlmostEqual(doc.fiscal_amount_tax, 91.74, places=2)
|
|
252
|
+
# fiscal_amount_total = 2547.00 + 91.74 = 2638.74
|
|
253
|
+
self.assertAlmostEqual(doc.fiscal_amount_total, 2638.74, places=2)
|
|
254
|
+
|
|
255
|
+
# Part 2: Test with delivery_costs = 'total'
|
|
256
|
+
# ----------------------------------------------------
|
|
257
|
+
self.company.delivery_costs = "total"
|
|
258
|
+
doc_form_edit = Form(doc)
|
|
259
|
+
# Set new header totals, which should trigger inverse methods to distribute
|
|
260
|
+
doc_form_edit.amount_freight_value = 30.0
|
|
261
|
+
doc_form_edit.amount_insurance_value = 60.0
|
|
262
|
+
doc_form_edit.amount_other_value = 90.0
|
|
263
|
+
doc_after_total_update = doc_form_edit.save()
|
|
264
|
+
|
|
265
|
+
line1 = doc_after_total_update.fiscal_line_ids[0]
|
|
266
|
+
line2 = doc_after_total_update.fiscal_line_ids[1]
|
|
267
|
+
|
|
268
|
+
# Assert values were distributed proportionally to price_gross
|
|
269
|
+
# (2000 vs 500 -> 80% vs 20%)
|
|
270
|
+
# Freight: 30.0 * 0.8 = 24.0 | 30.0 * 0.2 = 6.0
|
|
271
|
+
self.assertAlmostEqual(line1.freight_value, 24.0)
|
|
272
|
+
self.assertAlmostEqual(line2.freight_value, 6.0)
|
|
273
|
+
# Insurance: 60.0 * 0.8 = 48.0 | 60.0 * 0.2 = 12.0
|
|
274
|
+
self.assertAlmostEqual(line1.insurance_value, 48.0)
|
|
275
|
+
self.assertAlmostEqual(line2.insurance_value, 12.0)
|
|
276
|
+
# Other: 90.0 * 0.8 = 72.0 | 90.0 * 0.2 = 18.0
|
|
277
|
+
self.assertAlmostEqual(line1.other_value, 72.0)
|
|
278
|
+
self.assertAlmostEqual(line2.other_value, 18.0)
|
|
279
|
+
|
|
280
|
+
# Assert final fiscal totals are recomputed correctly (top-down calculation)
|
|
281
|
+
# price_gross = 2500
|
|
282
|
+
# landed_costs = 30 + 60 + 90 = 180
|
|
283
|
+
# fiscal_amount_untaxed (IPI Base) = 2500 + 180 = 2680
|
|
284
|
+
self.assertAlmostEqual(doc_after_total_update.fiscal_amount_untaxed, 2680.00)
|
|
285
|
+
# Line 1 IPI Base = 2000 (product) + 24 (freight) + 48 (insurance)
|
|
286
|
+
# + 72 (other) = 2144
|
|
287
|
+
# Line 1 IPI Value = 2144 * 3.25% = 69.68
|
|
288
|
+
self.assertAlmostEqual(line1.ipi_base, 2144.00)
|
|
289
|
+
self.assertAlmostEqual(line1.ipi_value, 69.68, places=2)
|
|
290
|
+
|
|
291
|
+
# Line 2 IPI Base = 500 (product) + 6 (freight) + 12 (insurance)
|
|
292
|
+
# + 18 (other) = 536
|
|
293
|
+
# Line 2 IPI Value = 536 * 5% = 26.80
|
|
294
|
+
self.assertAlmostEqual(line2.ipi_base, 536.00)
|
|
295
|
+
self.assertAlmostEqual(line2.ipi_value, 26.80, places=2)
|
|
296
|
+
|
|
297
|
+
# fiscal_amount_tax (IPI) = 69.68 + 26.80 = 96.48
|
|
298
|
+
self.assertAlmostEqual(
|
|
299
|
+
doc_after_total_update.fiscal_amount_tax, 96.48, places=2
|
|
300
|
+
)
|
|
301
|
+
# fiscal_amount_total = 2680.00 + 96.48 = 2776.48
|
|
302
|
+
self.assertAlmostEqual(
|
|
303
|
+
doc_after_total_update.fiscal_amount_total, 2776.48, places=2
|
|
304
|
+
)
|
|
305
|
+
|
|
306
|
+
def test_difal_calculation(self):
|
|
307
|
+
partner = self.env.ref("l10n_br_base.res_partner_cliente5_pe")
|
|
308
|
+
partner.ind_ie_dest = "9"
|
|
309
|
+
doc_form = Form(
|
|
310
|
+
self.env["l10n_br_fiscal.document"].with_context(
|
|
311
|
+
default_fiscal_operation_type="out",
|
|
312
|
+
)
|
|
313
|
+
)
|
|
314
|
+
doc_form.company_id = self.company
|
|
315
|
+
doc_form.partner_id = partner
|
|
316
|
+
doc_form.fiscal_operation_id = self.env.ref("l10n_br_fiscal.fo_venda")
|
|
317
|
+
|
|
318
|
+
product = self.env.ref("product.product_product_6")
|
|
319
|
+
with doc_form.fiscal_line_ids.new() as line_form:
|
|
320
|
+
line_form.product_id = product
|
|
321
|
+
line_form.price_unit = 100.0
|
|
322
|
+
line_form.quantity = 1.0
|
|
323
|
+
|
|
324
|
+
doc = doc_form.save()
|
|
325
|
+
line = doc.fiscal_line_ids[0]
|
|
326
|
+
self.assertEqual(line.icms_destination_base, 100.0)
|
|
327
|
+
self.assertEqual(line.icms_origin_percent, 7.0)
|
|
328
|
+
self.assertEqual(line.icms_destination_percent, 20.5)
|
|
329
|
+
self.assertEqual(line.icms_destination_value, 13.5)
|
|
@@ -40,15 +40,10 @@ class TestFiscalDocumentGeneric(TransactionCase):
|
|
|
40
40
|
def test_nfe_same_state(self):
|
|
41
41
|
"""Test NFe same state."""
|
|
42
42
|
for line in self.nfe_same_state.fiscal_line_ids:
|
|
43
|
-
line._onchange_product_id_fiscal()
|
|
44
|
-
|
|
45
43
|
# Restore the original price_unit value,
|
|
46
44
|
# as the product change might have altered it.
|
|
47
45
|
line.price_unit = 100
|
|
48
46
|
|
|
49
|
-
line._onchange_fiscal_operation_id()
|
|
50
|
-
line._onchange_fiscal_taxes()
|
|
51
|
-
|
|
52
47
|
if "Revenda" in line.fiscal_operation_line_id.name:
|
|
53
48
|
self.assertEqual(
|
|
54
49
|
line.cfop_id.code,
|
|
@@ -163,10 +158,6 @@ class TestFiscalDocumentGeneric(TransactionCase):
|
|
|
163
158
|
def test_nfe_other_state(self):
|
|
164
159
|
"""Test NFe other state."""
|
|
165
160
|
for line in self.nfe_other_state.fiscal_line_ids:
|
|
166
|
-
line._onchange_product_id_fiscal()
|
|
167
|
-
line._onchange_fiscal_operation_id()
|
|
168
|
-
line._onchange_fiscal_taxes()
|
|
169
|
-
|
|
170
161
|
if "Revenda" in line.fiscal_operation_line_id.name:
|
|
171
162
|
self.assertEqual(
|
|
172
163
|
line.cfop_id.code,
|
|
@@ -278,10 +269,6 @@ class TestFiscalDocumentGeneric(TransactionCase):
|
|
|
278
269
|
def test_nfe_not_taxpayer(self):
|
|
279
270
|
"""Test NFe not taxpayer."""
|
|
280
271
|
for line in self.nfe_not_taxpayer.fiscal_line_ids:
|
|
281
|
-
line._onchange_product_id_fiscal()
|
|
282
|
-
line._onchange_fiscal_operation_id()
|
|
283
|
-
line._onchange_fiscal_taxes()
|
|
284
|
-
|
|
285
272
|
if "Revenda" in line.fiscal_operation_line_id.name:
|
|
286
273
|
self.assertEqual(
|
|
287
274
|
line.cfop_id.code,
|
|
@@ -380,10 +367,6 @@ class TestFiscalDocumentGeneric(TransactionCase):
|
|
|
380
367
|
def test_nfe_not_taxpayer_not_company(self):
|
|
381
368
|
"""Test NFe not taxpayer not Company."""
|
|
382
369
|
for line in self.nfe_not_taxpayer_pf.fiscal_line_ids:
|
|
383
|
-
line._onchange_product_id_fiscal()
|
|
384
|
-
line._onchange_fiscal_operation_id()
|
|
385
|
-
line._onchange_fiscal_taxes()
|
|
386
|
-
|
|
387
370
|
if "Revenda" in line.fiscal_operation_line_id.name:
|
|
388
371
|
self.assertEqual(
|
|
389
372
|
line.cfop_id.code,
|
|
@@ -482,10 +465,6 @@ class TestFiscalDocumentGeneric(TransactionCase):
|
|
|
482
465
|
def test_nfe_export(self):
|
|
483
466
|
"""Test NFe export."""
|
|
484
467
|
for line in self.nfe_export.fiscal_line_ids:
|
|
485
|
-
line._onchange_product_id_fiscal()
|
|
486
|
-
line._onchange_fiscal_operation_id()
|
|
487
|
-
line._onchange_fiscal_taxes()
|
|
488
|
-
|
|
489
468
|
if "Revenda" in line.fiscal_operation_line_id.name:
|
|
490
469
|
self.assertEqual(
|
|
491
470
|
line.cfop_id.code,
|
|
@@ -576,8 +555,6 @@ class TestFiscalDocumentGeneric(TransactionCase):
|
|
|
576
555
|
def test_nfe_sn_same_state(self):
|
|
577
556
|
"""Test NFe Simples Nacional same state."""
|
|
578
557
|
for line in self.nfe_sn_same_state.fiscal_line_ids:
|
|
579
|
-
line._onchange_product_id_fiscal()
|
|
580
|
-
|
|
581
558
|
# set fake estimate tax
|
|
582
559
|
line.ncm_id.tax_estimate_ids.create(
|
|
583
560
|
{
|
|
@@ -588,9 +565,9 @@ class TestFiscalDocumentGeneric(TransactionCase):
|
|
|
588
565
|
"federal_taxes_national": 33.00,
|
|
589
566
|
}
|
|
590
567
|
)
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
line.
|
|
568
|
+
# força o compute, pois não é chamado automaticamente
|
|
569
|
+
# quando uma informação externa muda.
|
|
570
|
+
line._compute_tax_fields()
|
|
594
571
|
|
|
595
572
|
if "Revenda" in line.fiscal_operation_line_id.name:
|
|
596
573
|
self.assertEqual(
|
|
@@ -689,10 +666,6 @@ class TestFiscalDocumentGeneric(TransactionCase):
|
|
|
689
666
|
def test_nfe_sn_other_state(self):
|
|
690
667
|
"""Test NFe SN other state."""
|
|
691
668
|
for line in self.nfe_sn_other_state.fiscal_line_ids:
|
|
692
|
-
line._onchange_product_id_fiscal()
|
|
693
|
-
line._onchange_fiscal_operation_id()
|
|
694
|
-
line._onchange_fiscal_taxes()
|
|
695
|
-
|
|
696
669
|
if "Revenda" in line.fiscal_operation_line_id.name:
|
|
697
670
|
self.assertEqual(
|
|
698
671
|
line.cfop_id.code,
|
|
@@ -787,10 +760,6 @@ class TestFiscalDocumentGeneric(TransactionCase):
|
|
|
787
760
|
def test_nfe_sn_not_taxpayer(self):
|
|
788
761
|
"""Test NFe SN not taxpayer."""
|
|
789
762
|
for line in self.nfe_sn_not_taxpayer.fiscal_line_ids:
|
|
790
|
-
line._onchange_product_id_fiscal()
|
|
791
|
-
line._onchange_fiscal_operation_id()
|
|
792
|
-
line._onchange_fiscal_taxes()
|
|
793
|
-
|
|
794
763
|
if "Revenda" in line.fiscal_operation_line_id.name:
|
|
795
764
|
self.assertEqual(
|
|
796
765
|
line.cfop_id.code,
|
|
@@ -872,10 +841,6 @@ class TestFiscalDocumentGeneric(TransactionCase):
|
|
|
872
841
|
def test_nfe_sn_export(self):
|
|
873
842
|
"""Test NFe SN export."""
|
|
874
843
|
for line in self.nfe_sn_export.fiscal_line_ids:
|
|
875
|
-
line._onchange_product_id_fiscal()
|
|
876
|
-
line._onchange_fiscal_operation_id()
|
|
877
|
-
line._onchange_fiscal_taxes()
|
|
878
|
-
|
|
879
844
|
if "Revenda" in line.fiscal_operation_line_id.name:
|
|
880
845
|
self.assertEqual(
|
|
881
846
|
line.cfop_id.code,
|
|
@@ -983,10 +948,16 @@ class TestFiscalDocumentGeneric(TransactionCase):
|
|
|
983
948
|
def test_nfe_comments(self):
|
|
984
949
|
self.nfe_not_taxpayer._document_comment()
|
|
985
950
|
additional_data = self.nfe_not_taxpayer.fiscal_line_ids[0].additional_data
|
|
986
|
-
self.
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
951
|
+
if self.env.ref("base.lang_pt_BR").active:
|
|
952
|
+
self.assertEqual(
|
|
953
|
+
additional_data,
|
|
954
|
+
"manual comment test - Valor Aprox. dos Tributos: R$\xa00,00",
|
|
955
|
+
)
|
|
956
|
+
else: # no pt_BR amount formatting available
|
|
957
|
+
self.assertEqual(
|
|
958
|
+
additional_data,
|
|
959
|
+
"manual comment test - Valor Aprox. dos Tributos: R$\xa00.00",
|
|
960
|
+
)
|
|
990
961
|
|
|
991
962
|
def test_fields_freight_insurance_other_costs(self):
|
|
992
963
|
"""Test fields Freight, Insurance and Other Costs when
|
|
@@ -13,12 +13,7 @@ class TestFiscalDocumentNFSe(TransactionCase):
|
|
|
13
13
|
|
|
14
14
|
def test_nfse_same_state(self):
|
|
15
15
|
"""Test NFSe same state."""
|
|
16
|
-
|
|
17
16
|
for line in self.nfse_same_state.fiscal_line_ids:
|
|
18
|
-
line._onchange_product_id_fiscal()
|
|
19
|
-
line._onchange_fiscal_operation_id()
|
|
20
|
-
line._onchange_fiscal_taxes()
|
|
21
|
-
|
|
22
17
|
self.assertEqual(
|
|
23
18
|
line.fiscal_operation_line_id.name,
|
|
24
19
|
"Prestação de Serviço",
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Copyright (C) 2025 Renato Lima - Akretion <renato.lima@akretion.com.br>
|
|
2
|
+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
|
3
|
+
|
|
4
|
+
from psycopg2 import IntegrityError
|
|
5
|
+
|
|
6
|
+
from odoo.exceptions import ValidationError
|
|
7
|
+
from odoo.tests import TransactionCase
|
|
8
|
+
from odoo.tools import mute_logger
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class TestFiscalDocumentSerie(TransactionCase):
|
|
12
|
+
@classmethod
|
|
13
|
+
def setUpClass(cls):
|
|
14
|
+
super().setUpClass()
|
|
15
|
+
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
|
|
16
|
+
|
|
17
|
+
# Company
|
|
18
|
+
cls.company_sn = cls.env.ref("l10n_br_base.empresa_simples_nacional")
|
|
19
|
+
|
|
20
|
+
# Fiscal Document Type
|
|
21
|
+
cls.document_type_nfe = cls.env.ref("l10n_br_fiscal.document_55")
|
|
22
|
+
|
|
23
|
+
cls.document_serie_nfe_5 = cls.env["l10n_br_fiscal.document.serie"].create(
|
|
24
|
+
{
|
|
25
|
+
"code": "5",
|
|
26
|
+
"name": "Serie 5",
|
|
27
|
+
"document_type_id": cls.document_type_nfe.id,
|
|
28
|
+
"company_id": cls.company_sn.id,
|
|
29
|
+
}
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
# Fiscal Document
|
|
33
|
+
cls.document = cls.env["l10n_br_fiscal.document"].create(
|
|
34
|
+
{
|
|
35
|
+
"company_id": cls.company_sn.id,
|
|
36
|
+
"document_type_id": cls.document_type_nfe.id,
|
|
37
|
+
"document_serie_id": cls.document_serie_nfe_5.id,
|
|
38
|
+
"partner_id": cls.env.ref("l10n_br_base.res_partner_cliente1_sp").id,
|
|
39
|
+
"state_edoc": "cancelada",
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
def test_document_serie_duplicated(self):
|
|
44
|
+
"""Test document serie duplicate constraint."""
|
|
45
|
+
document_serie = self.env["l10n_br_fiscal.document.serie"]
|
|
46
|
+
document_serie_values = {
|
|
47
|
+
"code": "10",
|
|
48
|
+
"name": "Serie 10",
|
|
49
|
+
"document_type_id": self.document_type_nfe.id,
|
|
50
|
+
"company_id": self.company_sn.id,
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
with self.assertRaises(IntegrityError), mute_logger("odoo.sql_db"):
|
|
54
|
+
for _ in range(2):
|
|
55
|
+
document_serie.create(document_serie_values)
|
|
56
|
+
|
|
57
|
+
def test_document_serie_code_in_use(self):
|
|
58
|
+
"""Test document serie code in use constraint."""
|
|
59
|
+
with self.assertRaises(ValidationError):
|
|
60
|
+
self.document_serie_nfe_5.write({"code": "7"})
|
|
@@ -35,15 +35,12 @@ class TestTaxBenefit(TransactionCase):
|
|
|
35
35
|
"state": "approved",
|
|
36
36
|
}
|
|
37
37
|
)
|
|
38
|
+
# force update
|
|
39
|
+
cls.nfe_tax_benefit.fiscal_line_ids._compute_fiscal_tax_ids()
|
|
38
40
|
|
|
39
41
|
def test_nfe_tax_benefit(self):
|
|
40
42
|
"""Test NFe with tax benefit."""
|
|
41
|
-
|
|
42
43
|
for line in self.nfe_tax_benefit.fiscal_line_ids:
|
|
43
|
-
line._onchange_product_id_fiscal()
|
|
44
|
-
line._onchange_fiscal_operation_id()
|
|
45
|
-
line._onchange_fiscal_taxes()
|
|
46
|
-
|
|
47
44
|
self.assertEqual(
|
|
48
45
|
line.icms_tax_benefit_id,
|
|
49
46
|
self.tax_benefit,
|