odoo-addon-l10n-br-fiscal 17.0.1.0.0.11__py3-none-any.whl → 18.0.5.0.0.1__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 +10 -10
- odoo/addons/l10n_br_fiscal/__init__.py +1 -0
- odoo/addons/l10n_br_fiscal/__manifest__.py +3 -2
- odoo/addons/l10n_br_fiscal/constants/fiscal.py +51 -24
- odoo/addons/l10n_br_fiscal/data/ir_cron.xml +19 -34
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal.document.type.csv +1 -0
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal_cfop_data.xml +0 -2
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal_data.xml +6 -8
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal_icms_tax_definition_data.xml +4055 -4033
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal_server_action.xml +0 -2
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal_tax_icms_data.xml +54 -50
- odoo/addons/l10n_br_fiscal/data/operation_data.xml +198 -182
- odoo/addons/l10n_br_fiscal/data/product_data.xml +0 -2
- odoo/addons/l10n_br_fiscal/data/res_partner_data.xml +0 -2
- odoo/addons/l10n_br_fiscal/data/simplified_tax_data.xml +0 -2
- odoo/addons/l10n_br_fiscal/data/uom_data.xml +0 -2
- odoo/addons/l10n_br_fiscal/demo/city_taxation_code_demo.xml +0 -2
- odoo/addons/l10n_br_fiscal/demo/company_demo.xml +0 -3
- odoo/addons/l10n_br_fiscal/demo/fiscal_document_demo.xml +40 -228
- odoo/addons/l10n_br_fiscal/demo/fiscal_document_nfse_demo.xml +0 -5
- odoo/addons/l10n_br_fiscal/demo/fiscal_operation_demo.xml +2 -4
- odoo/addons/l10n_br_fiscal/demo/icms_tax_definition_demo.xml +0 -2
- odoo/addons/l10n_br_fiscal/demo/partner_demo.xml +0 -2
- odoo/addons/l10n_br_fiscal/demo/product_demo.xml +0 -1705
- odoo/addons/l10n_br_fiscal/demo/res_users_demo.xml +0 -2
- odoo/addons/l10n_br_fiscal/hooks.py +68 -0
- odoo/addons/l10n_br_fiscal/i18n/l10n_br_fiscal.pot +232 -201
- odoo/addons/l10n_br_fiscal/i18n/pt_BR.po +1272 -1344
- odoo/addons/l10n_br_fiscal/migrations/18.0.2.0.0/pre-migration.py +25 -0
- odoo/addons/l10n_br_fiscal/migrations/18.0.3.0.0/pre-migration.py +30 -0
- odoo/addons/l10n_br_fiscal/models/cfop.py +1 -1
- odoo/addons/l10n_br_fiscal/models/cnae.py +2 -2
- odoo/addons/l10n_br_fiscal/models/comment.py +12 -27
- odoo/addons/l10n_br_fiscal/models/cst.py +2 -2
- odoo/addons/l10n_br_fiscal/models/data_abstract.py +11 -24
- odoo/addons/l10n_br_fiscal/models/document.py +57 -9
- odoo/addons/l10n_br_fiscal/models/document_line.py +65 -5
- odoo/addons/l10n_br_fiscal/models/document_line_mixin.py +118 -38
- odoo/addons/l10n_br_fiscal/models/document_line_mixin_methods.py +261 -295
- odoo/addons/l10n_br_fiscal/models/document_mixin.py +8 -16
- odoo/addons/l10n_br_fiscal/models/document_mixin_methods.py +49 -177
- odoo/addons/l10n_br_fiscal/models/document_related.py +1 -1
- odoo/addons/l10n_br_fiscal/models/document_serie.py +35 -2
- odoo/addons/l10n_br_fiscal/models/document_type.py +0 -1
- odoo/addons/l10n_br_fiscal/models/ibpt.py +1 -1
- odoo/addons/l10n_br_fiscal/models/icms_regulation.py +1 -1
- odoo/addons/l10n_br_fiscal/models/invalidate_number.py +6 -7
- odoo/addons/l10n_br_fiscal/models/legal_nature.py +1 -1
- odoo/addons/l10n_br_fiscal/models/nbm.py +2 -2
- odoo/addons/l10n_br_fiscal/models/nbs.py +4 -4
- odoo/addons/l10n_br_fiscal/models/ncm.py +4 -4
- odoo/addons/l10n_br_fiscal/models/operation.py +2 -2
- odoo/addons/l10n_br_fiscal/models/operation_dashboard.py +3 -2
- odoo/addons/l10n_br_fiscal/models/operation_line.py +1 -1
- odoo/addons/l10n_br_fiscal/models/partner_profile.py +7 -1
- odoo/addons/l10n_br_fiscal/models/product_template.py +1 -1
- odoo/addons/l10n_br_fiscal/models/res_partner.py +9 -0
- odoo/addons/l10n_br_fiscal/models/tax.py +12 -4
- odoo/addons/l10n_br_fiscal/models/tax_group.py +6 -6
- odoo/addons/l10n_br_fiscal/models/tax_pis_cofins.py +4 -4
- odoo/addons/l10n_br_fiscal/models/tax_pis_cofins_base.py +3 -3
- odoo/addons/l10n_br_fiscal/models/tax_pis_cofins_credit.py +3 -3
- odoo/addons/l10n_br_fiscal/security/fiscal_security.xml +6 -18
- odoo/addons/l10n_br_fiscal/security/ir.model.access.csv +1 -2
- odoo/addons/l10n_br_fiscal/static/description/index.html +8 -8
- odoo/addons/l10n_br_fiscal/tests/__init__.py +1 -0
- odoo/addons/l10n_br_fiscal/tests/test_document_edition.py +200 -14
- odoo/addons/l10n_br_fiscal/tests/test_fiscal_document_generic.py +16 -44
- 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/views/cest_view.xml +2 -2
- odoo/addons/l10n_br_fiscal/views/cfop_view.xml +2 -2
- odoo/addons/l10n_br_fiscal/views/city_taxation_code.xml +2 -2
- odoo/addons/l10n_br_fiscal/views/cnae_view.xml +2 -2
- odoo/addons/l10n_br_fiscal/views/comment_view.xml +2 -2
- odoo/addons/l10n_br_fiscal/views/cst_view.xml +2 -2
- odoo/addons/l10n_br_fiscal/views/document_line_mixin_view.xml +1 -1
- odoo/addons/l10n_br_fiscal/views/document_line_view.xml +6 -4
- odoo/addons/l10n_br_fiscal/views/document_related_view.xml +2 -2
- odoo/addons/l10n_br_fiscal/views/document_serie_view.xml +2 -2
- odoo/addons/l10n_br_fiscal/views/document_type_view.xml +2 -2
- odoo/addons/l10n_br_fiscal/views/document_view.xml +29 -29
- odoo/addons/l10n_br_fiscal/views/icms_regulation_view.xml +2 -2
- odoo/addons/l10n_br_fiscal/views/icms_relief_view.xml +2 -2
- odoo/addons/l10n_br_fiscal/views/invalidate_number_view.xml +2 -2
- odoo/addons/l10n_br_fiscal/views/l10n_br_fiscal_action.xml +36 -36
- odoo/addons/l10n_br_fiscal/views/l10n_br_fiscal_menu.xml +0 -9
- odoo/addons/l10n_br_fiscal/views/legal_nature_view.xml +2 -2
- odoo/addons/l10n_br_fiscal/views/nbm_view.xml +5 -5
- odoo/addons/l10n_br_fiscal/views/nbs_view.xml +5 -5
- odoo/addons/l10n_br_fiscal/views/ncm_view.xml +5 -5
- odoo/addons/l10n_br_fiscal/views/operation_dashboard_view.xml +7 -8
- odoo/addons/l10n_br_fiscal/views/operation_line_view.xml +2 -2
- odoo/addons/l10n_br_fiscal/views/operation_view.xml +4 -4
- odoo/addons/l10n_br_fiscal/views/partner_profile_view.xml +2 -2
- odoo/addons/l10n_br_fiscal/views/product_genre_view.xml +2 -2
- odoo/addons/l10n_br_fiscal/views/product_product_view.xml +38 -11
- odoo/addons/l10n_br_fiscal/views/product_template_view.xml +22 -9
- odoo/addons/l10n_br_fiscal/views/res_config_settings_view.xml +8 -8
- odoo/addons/l10n_br_fiscal/views/res_partner_view.xml +9 -0
- odoo/addons/l10n_br_fiscal/views/service_type_view.xml +5 -5
- odoo/addons/l10n_br_fiscal/views/simplified_tax_range_view.xml +2 -2
- odoo/addons/l10n_br_fiscal/views/simplified_tax_view.xml +4 -4
- odoo/addons/l10n_br_fiscal/views/tax_definition_view.xml +4 -4
- odoo/addons/l10n_br_fiscal/views/tax_estimate_view.xml +2 -2
- odoo/addons/l10n_br_fiscal/views/tax_group_view.xml +2 -2
- odoo/addons/l10n_br_fiscal/views/tax_ipi_control_seal_view.xml +2 -2
- odoo/addons/l10n_br_fiscal/views/tax_ipi_guideline_class_view.xml +2 -2
- odoo/addons/l10n_br_fiscal/views/tax_ipi_guideline_view.xml +2 -2
- odoo/addons/l10n_br_fiscal/views/tax_pis_cofins_base_view.xml +2 -2
- odoo/addons/l10n_br_fiscal/views/tax_pis_cofins_credit_view.xml +2 -2
- odoo/addons/l10n_br_fiscal/views/tax_pis_cofins_view.xml +2 -2
- odoo/addons/l10n_br_fiscal/views/tax_view.xml +2 -2
- odoo/addons/l10n_br_fiscal/views/uom_uom.xml +2 -2
- odoo/addons/l10n_br_fiscal/wizards/base_wizard_mixin.py +1 -1
- {odoo_addon_l10n_br_fiscal-17.0.1.0.0.11.dist-info → odoo_addon_l10n_br_fiscal-18.0.5.0.0.1.dist-info}/METADATA +16 -16
- {odoo_addon_l10n_br_fiscal-17.0.1.0.0.11.dist-info → odoo_addon_l10n_br_fiscal-18.0.5.0.0.1.dist-info}/RECORD +120 -116
- {odoo_addon_l10n_br_fiscal-17.0.1.0.0.11.dist-info → odoo_addon_l10n_br_fiscal-18.0.5.0.0.1.dist-info}/WHEEL +0 -0
- {odoo_addon_l10n_br_fiscal-17.0.1.0.0.11.dist-info → odoo_addon_l10n_br_fiscal-18.0.5.0.0.1.dist-info}/top_level.txt +0 -0
|
@@ -10,6 +10,7 @@ from ..constants.fiscal import (
|
|
|
10
10
|
NFE_IND_IE_DEST,
|
|
11
11
|
NFE_IND_IE_DEST_9,
|
|
12
12
|
NFE_IND_IE_DEST_DEFAULT,
|
|
13
|
+
PUBLIC_ENTIRY_TYPE,
|
|
13
14
|
TAX_FRAMEWORK,
|
|
14
15
|
TAX_FRAMEWORK_NORMAL,
|
|
15
16
|
)
|
|
@@ -76,6 +77,11 @@ class ResPartner(models.Model):
|
|
|
76
77
|
"other government-controlled organizations.",
|
|
77
78
|
)
|
|
78
79
|
|
|
80
|
+
public_entity_type = fields.Selection(
|
|
81
|
+
selection=PUBLIC_ENTIRY_TYPE,
|
|
82
|
+
string="Tipo de Entidade Governamental",
|
|
83
|
+
)
|
|
84
|
+
|
|
79
85
|
ind_final = fields.Selection(
|
|
80
86
|
selection=FINAL_CUSTOMER,
|
|
81
87
|
string="Final Consumption Operation",
|
|
@@ -107,6 +113,8 @@ class ResPartner(models.Model):
|
|
|
107
113
|
tracking=True,
|
|
108
114
|
)
|
|
109
115
|
|
|
116
|
+
rntrc_code = fields.Char(string="RNTRC Code", size=12, tracking=True)
|
|
117
|
+
|
|
110
118
|
def _inverse_fiscal_profile(self):
|
|
111
119
|
for p in self:
|
|
112
120
|
p._onchange_fiscal_profile_id()
|
|
@@ -123,6 +131,7 @@ class ResPartner(models.Model):
|
|
|
123
131
|
p.tax_framework = p.fiscal_profile_id.tax_framework
|
|
124
132
|
p.ind_ie_dest = p.fiscal_profile_id.ind_ie_dest
|
|
125
133
|
p.is_public_entity = p.fiscal_profile_id.is_public_entity
|
|
134
|
+
p.public_entity_type = p.fiscal_profile_id.public_entity_type
|
|
126
135
|
|
|
127
136
|
@api.onchange("ind_ie_dest")
|
|
128
137
|
def _onchange_ind_ie_dest(self):
|
|
@@ -226,7 +226,11 @@ class Tax(models.Model):
|
|
|
226
226
|
)
|
|
227
227
|
|
|
228
228
|
_sql_constraints = [
|
|
229
|
-
(
|
|
229
|
+
(
|
|
230
|
+
"fiscal_tax_code_uniq",
|
|
231
|
+
"unique (name)",
|
|
232
|
+
"Tax already exists with this name!",
|
|
233
|
+
)
|
|
230
234
|
]
|
|
231
235
|
|
|
232
236
|
@api.model
|
|
@@ -450,9 +454,13 @@ class Tax(models.Model):
|
|
|
450
454
|
and cfop.destination == CFOP_DESTINATION_EXTERNAL
|
|
451
455
|
and partner.ind_ie_dest == NFE_IND_IE_DEST_9
|
|
452
456
|
and tax_dict.get("tax_value")
|
|
453
|
-
and
|
|
454
|
-
|
|
455
|
-
|
|
457
|
+
and (
|
|
458
|
+
operation_line.fiscal_operation_type == FISCAL_OUT
|
|
459
|
+
or (
|
|
460
|
+
operation_line.fiscal_operation_type == FISCAL_IN
|
|
461
|
+
and operation_line.fiscal_operation_id.fiscal_type != "return_in"
|
|
462
|
+
)
|
|
463
|
+
)
|
|
456
464
|
):
|
|
457
465
|
icms_tax_difal, _ = company.icms_regulation_id.map_tax_def_icms_difal(
|
|
458
466
|
company, partner, product, ncm, nbm, cest, operation_line, ind_final
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Copyright (C) 2019 Renato Lima - Akretion <renato.lima@akretion.com.br>
|
|
2
2
|
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
|
3
3
|
|
|
4
|
-
from odoo import
|
|
4
|
+
from odoo import fields, models
|
|
5
5
|
|
|
6
6
|
from ..constants.fiscal import TAX_DOMAIN
|
|
7
7
|
|
|
@@ -29,10 +29,10 @@ class TaxGroup(models.Model):
|
|
|
29
29
|
|
|
30
30
|
tax_scope = fields.Selection(
|
|
31
31
|
selection=[
|
|
32
|
-
("city",
|
|
33
|
-
("state",
|
|
34
|
-
("federal",
|
|
35
|
-
("other",
|
|
32
|
+
("city", "City"),
|
|
33
|
+
("state", "State"),
|
|
34
|
+
("federal", "Federal"),
|
|
35
|
+
("other", "Other"),
|
|
36
36
|
],
|
|
37
37
|
required=True,
|
|
38
38
|
)
|
|
@@ -75,6 +75,6 @@ class TaxGroup(models.Model):
|
|
|
75
75
|
(
|
|
76
76
|
"fiscal_tax_group_code_uniq",
|
|
77
77
|
"unique (name)",
|
|
78
|
-
|
|
78
|
+
"Tax Group already exists with this name!",
|
|
79
79
|
)
|
|
80
80
|
]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Copyright (C) 2019 Renato Lima - Akretion <renato.lima@akretion.com.br>
|
|
2
2
|
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
|
3
3
|
|
|
4
|
-
from odoo import
|
|
4
|
+
from odoo import api, fields, models
|
|
5
5
|
|
|
6
6
|
from .. import tools
|
|
7
7
|
from ..constants.fiscal import (
|
|
@@ -22,9 +22,9 @@ class TaxPisCofins(models.Model):
|
|
|
22
22
|
|
|
23
23
|
piscofins_type = fields.Selection(
|
|
24
24
|
selection=[
|
|
25
|
-
("ncm",
|
|
26
|
-
("product",
|
|
27
|
-
("company",
|
|
25
|
+
("ncm", "NCM"),
|
|
26
|
+
("product", "Product"),
|
|
27
|
+
("company", "Company"),
|
|
28
28
|
],
|
|
29
29
|
default="ncm",
|
|
30
30
|
string="Type",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Copyright (C) 2019 Renato Lima - Akretion
|
|
2
2
|
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
|
3
3
|
|
|
4
|
-
from odoo import
|
|
4
|
+
from odoo import fields, models
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
class TaxPisCofinsBase(models.Model):
|
|
@@ -13,8 +13,8 @@ class TaxPisCofinsBase(models.Model):
|
|
|
13
13
|
|
|
14
14
|
_sql_constraints = [
|
|
15
15
|
(
|
|
16
|
-
"
|
|
16
|
+
"code_unique",
|
|
17
17
|
"unique (code)",
|
|
18
|
-
|
|
18
|
+
"Already exists with this code!",
|
|
19
19
|
)
|
|
20
20
|
]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Copyright (C) 2019 Renato Lima - Akretion
|
|
2
2
|
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
|
3
3
|
|
|
4
|
-
from odoo import
|
|
4
|
+
from odoo import fields, models
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
class TaxPisCofinsCredit(models.Model):
|
|
@@ -13,8 +13,8 @@ class TaxPisCofinsCredit(models.Model):
|
|
|
13
13
|
|
|
14
14
|
_sql_constraints = [
|
|
15
15
|
(
|
|
16
|
-
"
|
|
16
|
+
"code_unique",
|
|
17
17
|
"unique (code)",
|
|
18
|
-
|
|
18
|
+
"Already exists with this code!",
|
|
19
19
|
)
|
|
20
20
|
]
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8" ?>
|
|
2
2
|
<odoo noupdate="1">
|
|
3
|
-
|
|
4
3
|
<record id="module_category_l10n_br_fiscal_management" model="ir.module.category">
|
|
5
4
|
<field name="name">Brazilian Fiscal</field>
|
|
6
5
|
<field
|
|
@@ -39,45 +38,34 @@
|
|
|
39
38
|
<field name="name">Fiscal Tax Estimate multi-company</field>
|
|
40
39
|
<field name="model_id" ref="model_l10n_br_fiscal_tax_estimate" />
|
|
41
40
|
<field eval="True" name="global" />
|
|
42
|
-
<field
|
|
43
|
-
name="domain_force"
|
|
44
|
-
>['|',('company_id','=',False),('company_id','in',company_ids)]</field>
|
|
41
|
+
<field name="domain_force">[('company_id', 'in', company_ids + [False])]</field>
|
|
45
42
|
</record>
|
|
46
43
|
|
|
47
|
-
<record id="
|
|
44
|
+
<record id="l10n_br_fiscal_operation_rule" model="ir.rule">
|
|
48
45
|
<field name="name">Fiscal Operation multi-company</field>
|
|
49
46
|
<field name="model_id" ref="model_l10n_br_fiscal_operation" />
|
|
50
47
|
<field eval="True" name="global" />
|
|
51
|
-
<field
|
|
52
|
-
name="domain_force"
|
|
53
|
-
>['|',('company_id','=',False),('company_id','in',company_ids)]</field>
|
|
48
|
+
<field name="domain_force">[('company_id', 'in', company_ids + [False])]</field>
|
|
54
49
|
</record>
|
|
55
50
|
|
|
56
51
|
<record id="l10n_br_fiscal_document_serie_rule" model="ir.rule">
|
|
57
52
|
<field name="name">Fiscal Document Serie multi-company</field>
|
|
58
53
|
<field name="model_id" ref="model_l10n_br_fiscal_document_serie" />
|
|
59
54
|
<field eval="True" name="global" />
|
|
60
|
-
<field
|
|
61
|
-
name="domain_force"
|
|
62
|
-
>['|',('company_id','=',False),('company_id','in',company_ids)]</field>
|
|
55
|
+
<field name="domain_force">[('company_id', 'in', company_ids + [False])]</field>
|
|
63
56
|
</record>
|
|
64
57
|
|
|
65
58
|
<record id="l10n_br_fiscal_document_rule" model="ir.rule">
|
|
66
59
|
<field name="name">Fiscal Document multi-company</field>
|
|
67
60
|
<field name="model_id" ref="model_l10n_br_fiscal_document" />
|
|
68
61
|
<field eval="True" name="global" />
|
|
69
|
-
<field
|
|
70
|
-
name="domain_force"
|
|
71
|
-
>['|',('company_id','=',False),('company_id','in',company_ids)]</field>
|
|
62
|
+
<field name="domain_force">[('company_id', 'in', company_ids + [False])]</field>
|
|
72
63
|
</record>
|
|
73
64
|
|
|
74
65
|
<record id="l10n_br_fiscal_document_line_rule" model="ir.rule">
|
|
75
66
|
<field name="name">Fiscal Document line multi-company</field>
|
|
76
67
|
<field name="model_id" ref="model_l10n_br_fiscal_document_line" />
|
|
77
68
|
<field eval="True" name="global" />
|
|
78
|
-
<field
|
|
79
|
-
name="domain_force"
|
|
80
|
-
>['|',('company_id','=',False),('company_id','in',company_ids)]</field>
|
|
69
|
+
<field name="domain_force">[('company_id', 'in', company_ids + [False])]</field>
|
|
81
70
|
</record>
|
|
82
|
-
|
|
83
71
|
</odoo>
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"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
68
|
"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
69
|
"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
|
|
70
|
-
"l10n_br_fiscal_partner_profile_user","Fiscal Partner Profile for User","model_l10n_br_fiscal_partner_profile","
|
|
70
|
+
"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
71
|
"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
72
|
"l10n_br_fiscal_document_user","Fiscal Document for User","model_l10n_br_fiscal_document","l10n_br_fiscal.group_user",1,1,1,0
|
|
73
73
|
"l10n_br_fiscal_document_manager","Fiscal Document for Manager","model_l10n_br_fiscal_document","l10n_br_fiscal.group_manager",1,1,1,1
|
|
@@ -94,6 +94,5 @@
|
|
|
94
94
|
"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
95
|
"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
96
|
"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
97
|
"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
98
|
"l10n_br_fiscal_document_import_wizard_mixin_user",l10n_br_fiscal_document_import_wizard_mixin_user,model_l10n_br_fiscal_document_import_wizard_mixin,base.group_user,1,1,1,1
|
|
@@ -372,10 +372,10 @@ 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:9b476f778818f11bdbac8619f6f6de8e9fd857792cfb19d7408154b19de9ca0b
|
|
376
376
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
|
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/
|
|
378
|
-
<p><img alt="image" src="https://raw.githubusercontent.com/OCA/l10n-brazil/
|
|
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
|
+
<p><img alt="image" src="https://raw.githubusercontent.com/OCA/l10n-brazil/18.0/l10n_br_fiscal/static/img/fiscal_dashboard.png" /></p>
|
|
379
379
|
<div class="section" id="classificacoes-fiscais">
|
|
380
380
|
<h2>Classificações fiscais</h2>
|
|
381
381
|
<p>Primeramente, este módulo traz uma variedade de cadastros fiscais para
|
|
@@ -513,8 +513,8 @@ como:</p>
|
|
|
513
513
|
<li>ST</li>
|
|
514
514
|
<li>retenções</li>
|
|
515
515
|
</ul>
|
|
516
|
-
<p><img alt="image1" src="https://raw.githubusercontent.com/OCA/l10n-brazil/
|
|
517
|
-
<p><img alt="image2" src="https://raw.githubusercontent.com/OCA/l10n-brazil/
|
|
516
|
+
<p><img alt="image1" src="https://raw.githubusercontent.com/OCA/l10n-brazil/18.0/l10n_br_fiscal/static/img/fiscal_line.png" /></p>
|
|
517
|
+
<p><img alt="image2" src="https://raw.githubusercontent.com/OCA/l10n-brazil/18.0/l10n_br_fiscal/static/img/fiscal_total.png" /></p>
|
|
518
518
|
<p>É notório que o cálculo dos impostos no Brasil é muito especial e muito
|
|
519
519
|
trabalhoso. Geralmente é o motivo pelo qual os ERPs internacionais não
|
|
520
520
|
tem grande fatia de mercado brasileiro.</p>
|
|
@@ -543,7 +543,7 @@ Tributária)…</p>
|
|
|
543
543
|
<div class="section" id="operacoes-fiscais">
|
|
544
544
|
<h2>Operações fiscais</h2>
|
|
545
545
|
<blockquote>
|
|
546
|
-
<img alt="image3" src="https://raw.githubusercontent.com/OCA/l10n-brazil/
|
|
546
|
+
<img alt="image3" src="https://raw.githubusercontent.com/OCA/l10n-brazil/18.0/l10n_br_fiscal/static/img/fiscal_operation.png" /></blockquote>
|
|
547
547
|
<p>No Odoo nativo, o conceito mais parecido com a operação fiscal e o
|
|
548
548
|
<tt class="docutils literal">account.fiscal.position</tt>. E ate a versão 10.0, era o que a gente
|
|
549
549
|
usava. Porém, a posição fiscal do Odoo não resolve muito os nossos
|
|
@@ -610,7 +610,7 @@ l10n_br_sale, l10n_br_purchase…</p>
|
|
|
610
610
|
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/l10n-brazil/issues">GitHub Issues</a>.
|
|
611
611
|
In case of trouble, please check there if your issue has already been reported.
|
|
612
612
|
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
|
613
|
-
<a class="reference external" href="https://github.com/OCA/l10n-brazil/issues/new?body=module:%20l10n_br_fiscal%0Aversion:%
|
|
613
|
+
<a class="reference external" href="https://github.com/OCA/l10n-brazil/issues/new?body=module:%20l10n_br_fiscal%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
|
614
614
|
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
|
615
615
|
</div>
|
|
616
616
|
<div class="section" id="credits">
|
|
@@ -659,7 +659,7 @@ mission is to support the collaborative development of Odoo features and
|
|
|
659
659
|
promote its widespread use.</p>
|
|
660
660
|
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p>
|
|
661
661
|
<p><a class="reference external image-reference" href="https://github.com/renatonlima"><img alt="renatonlima" src="https://github.com/renatonlima.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/rvalyi"><img alt="rvalyi" src="https://github.com/rvalyi.png?size=40px" /></a></p>
|
|
662
|
-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-brazil/tree/
|
|
662
|
+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-brazil/tree/18.0/l10n_br_fiscal">OCA/l10n-brazil</a> project on GitHub.</p>
|
|
663
663
|
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
|
664
664
|
</div>
|
|
665
665
|
</div>
|
|
@@ -3,15 +3,43 @@
|
|
|
3
3
|
|
|
4
4
|
from unittest import mock
|
|
5
5
|
|
|
6
|
-
from odoo
|
|
7
|
-
from odoo.tests
|
|
6
|
+
from odoo import Command
|
|
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):
|
|
13
14
|
super().setUpClass()
|
|
14
|
-
cls.
|
|
15
|
+
cls.user = cls.env["res.users"].create(
|
|
16
|
+
{
|
|
17
|
+
"name": "Fiscal User",
|
|
18
|
+
"login": "fiscaluser",
|
|
19
|
+
"password": "fiscaluser",
|
|
20
|
+
"groups_id": [
|
|
21
|
+
Command.set(cls.env.user.groups_id.ids),
|
|
22
|
+
Command.link(cls.env.ref("l10n_br_fiscal.group_user").id),
|
|
23
|
+
Command.link(cls.env.ref("base.group_multi_company").id),
|
|
24
|
+
],
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
cls.user.partner_id.email = "accountman@test.com"
|
|
28
|
+
companies = cls.env["res.company"].search([])
|
|
29
|
+
cls.user.write(
|
|
30
|
+
{
|
|
31
|
+
"company_ids": [Command.set(companies.ids)],
|
|
32
|
+
"company_id": cls.env.ref("l10n_br_base.empresa_lucro_presumido"),
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
cls.env = cls.env(
|
|
37
|
+
user=cls.user, context=dict(cls.env.context, tracking_disable=True)
|
|
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
|
|
15
43
|
|
|
16
44
|
def test_basic_doc_edition(self):
|
|
17
45
|
doc_form = Form(
|
|
@@ -75,20 +103,46 @@ class TestDocumentEdition(TransactionCase):
|
|
|
75
103
|
line_form.fiscal_operation_line_id,
|
|
76
104
|
self.env.ref("l10n_br_fiscal.fo_venda_revenda"),
|
|
77
105
|
)
|
|
106
|
+
self.assertEqual(
|
|
107
|
+
line_form.ipi_tax_id, self.env.ref("l10n_br_fiscal.tax_ipi_nt")
|
|
108
|
+
)
|
|
78
109
|
|
|
79
|
-
|
|
80
|
-
|
|
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
|
|
81
125
|
|
|
82
126
|
doc = doc_form.save()
|
|
83
|
-
|
|
84
|
-
self.assertEqual(
|
|
85
|
-
self.assertEqual(
|
|
86
|
-
self.assertEqual(
|
|
87
|
-
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
|
+
)
|
|
88
138
|
self.assertEqual(
|
|
89
|
-
|
|
90
|
-
self.ref("l10n_br_fiscal.
|
|
139
|
+
line.icms_tax_id.id,
|
|
140
|
+
self.ref("l10n_br_fiscal.tax_icms_18"),
|
|
91
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)
|
|
92
146
|
|
|
93
147
|
def test_product_fiscal_factor(self):
|
|
94
148
|
doc_form = Form(
|
|
@@ -96,7 +150,6 @@ class TestDocumentEdition(TransactionCase):
|
|
|
96
150
|
default_fiscal_operation_type="out",
|
|
97
151
|
)
|
|
98
152
|
)
|
|
99
|
-
doc_form.company_id = self.env.ref("l10n_br_base.empresa_lucro_presumido")
|
|
100
153
|
doc_form.partner_id = self.env.ref("l10n_br_base.res_partner_cliente1_sp")
|
|
101
154
|
doc_form.fiscal_operation_id = self.env.ref("l10n_br_fiscal.fo_venda")
|
|
102
155
|
doc_form.ind_final = "1"
|
|
@@ -119,7 +172,6 @@ class TestDocumentEdition(TransactionCase):
|
|
|
119
172
|
default_fiscal_operation_type="out",
|
|
120
173
|
)
|
|
121
174
|
)
|
|
122
|
-
doc_form.company_id = self.env.ref("l10n_br_base.empresa_lucro_presumido")
|
|
123
175
|
doc_form.partner_id = self.env.ref("l10n_br_base.res_partner_cliente1_sp")
|
|
124
176
|
doc_form.fiscal_operation_id = self.env.ref("l10n_br_fiscal.fo_venda")
|
|
125
177
|
doc_form.ind_final = "1"
|
|
@@ -141,3 +193,137 @@ class TestDocumentEdition(TransactionCase):
|
|
|
141
193
|
self.assertEqual(doc.fiscal_line_ids[0].fiscal_price, 112)
|
|
142
194
|
self.assertEqual(doc.fiscal_line_ids[0].quantity, 10)
|
|
143
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)
|