odoo-addon-l10n-br-fiscal 16.0.1.18.2.3__py3-none-any.whl → 16.0.2.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 +2 -12
- odoo/addons/l10n_br_fiscal/i18n/l10n_br_fiscal.pot +8 -828
- odoo/addons/l10n_br_fiscal/i18n/pt_BR.po +304 -850
- odoo/addons/l10n_br_fiscal/migrations/16.0.2.0.0/pre-migration.py +25 -0
- odoo/addons/l10n_br_fiscal/models/__init__.py +0 -12
- odoo/addons/l10n_br_fiscal/models/document.py +62 -20
- odoo/addons/l10n_br_fiscal/models/invalidate_number.py +0 -44
- odoo/addons/l10n_br_fiscal/models/ncm.py +27 -0
- odoo/addons/l10n_br_fiscal/models/tax_definition.py +189 -1
- odoo/addons/l10n_br_fiscal/security/ir.model.access.csv +0 -5
- odoo/addons/l10n_br_fiscal/static/description/index.html +1 -1
- odoo/addons/l10n_br_fiscal/tests/__init__.py +0 -1
- odoo/addons/l10n_br_fiscal/tests/test_fiscal_document_generic.py +0 -48
- odoo/addons/l10n_br_fiscal/tests/test_fiscal_document_nfse.py +0 -2
- odoo/addons/l10n_br_fiscal/tests/test_subsequent_operation.py +2 -1
- odoo/addons/l10n_br_fiscal/tests/test_tax_benefit.py +0 -21
- odoo/addons/l10n_br_fiscal/views/document_view.xml +3 -69
- odoo/addons/l10n_br_fiscal/views/invalidate_number_view.xml +2 -7
- odoo/addons/l10n_br_fiscal/views/l10n_br_fiscal_action.xml +0 -34
- odoo/addons/l10n_br_fiscal/views/l10n_br_fiscal_menu.xml +0 -19
- odoo/addons/l10n_br_fiscal/wizards/__init__.py +0 -6
- odoo/addons/l10n_br_fiscal/wizards/base_wizard_mixin.py +0 -5
- odoo/addons/l10n_br_fiscal/wizards/document_status_wizard.py +2 -0
- {odoo_addon_l10n_br_fiscal-16.0.1.18.2.3.dist-info → odoo_addon_l10n_br_fiscal-16.0.2.1.0.dist-info}/METADATA +3 -3
- {odoo_addon_l10n_br_fiscal-16.0.1.18.2.3.dist-info → odoo_addon_l10n_br_fiscal-16.0.2.1.0.dist-info}/RECORD +28 -52
- odoo/addons/l10n_br_fiscal/models/document_eletronic.py +0 -233
- odoo/addons/l10n_br_fiscal/models/document_event.py +0 -392
- odoo/addons/l10n_br_fiscal/models/document_workflow.py +0 -402
- odoo/addons/l10n_br_fiscal/models/ncm_cest.py +0 -18
- odoo/addons/l10n_br_fiscal/models/ncm_nbm.py +0 -18
- odoo/addons/l10n_br_fiscal/models/ncm_tax_pis_cofins.py +0 -18
- odoo/addons/l10n_br_fiscal/models/tax_definition_benefit.py +0 -119
- odoo/addons/l10n_br_fiscal/models/tax_definition_cfop.py +0 -36
- odoo/addons/l10n_br_fiscal/models/tax_definition_company.py +0 -29
- odoo/addons/l10n_br_fiscal/models/tax_definition_icms.py +0 -36
- odoo/addons/l10n_br_fiscal/models/tax_definition_operation_line.py +0 -37
- odoo/addons/l10n_br_fiscal/models/tax_definition_partner_profile.py +0 -33
- odoo/addons/l10n_br_fiscal/tests/test_workflow.py +0 -118
- odoo/addons/l10n_br_fiscal/views/document_event_report.xml +0 -15
- odoo/addons/l10n_br_fiscal/views/document_event_template.xml +0 -114
- odoo/addons/l10n_br_fiscal/views/document_event_view.xml +0 -68
- odoo/addons/l10n_br_fiscal/wizards/document_cancel_wizard.py +0 -20
- odoo/addons/l10n_br_fiscal/wizards/document_cancel_wizard.xml +0 -30
- odoo/addons/l10n_br_fiscal/wizards/document_correction_wizard.py +0 -17
- odoo/addons/l10n_br_fiscal/wizards/document_correction_wizard.xml +0 -30
- odoo/addons/l10n_br_fiscal/wizards/document_import_wizard_mixin.py +0 -132
- odoo/addons/l10n_br_fiscal/wizards/document_import_wizard_mixin.xml +0 -44
- odoo/addons/l10n_br_fiscal/wizards/document_status_wizard.xml +0 -58
- odoo/addons/l10n_br_fiscal/wizards/invalidate_number_wizard.py +0 -29
- odoo/addons/l10n_br_fiscal/wizards/invalidate_number_wizard.xml +0 -30
- {odoo_addon_l10n_br_fiscal-16.0.1.18.2.3.dist-info → odoo_addon_l10n_br_fiscal-16.0.2.1.0.dist-info}/WHEEL +0 -0
- {odoo_addon_l10n_br_fiscal-16.0.1.18.2.3.dist-info → odoo_addon_l10n_br_fiscal-16.0.2.1.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Copyright (C) 2024 - TODAY - Raphaël Valyi - Akretion <raphael.valyi@akretion.com.br>
|
|
2
|
+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
|
3
|
+
|
|
4
|
+
from openupgradelib import openupgrade
|
|
5
|
+
|
|
6
|
+
to_install = "l10n_br_fiscal_edi"
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def install_new_modules(cr):
|
|
10
|
+
sql = f"""
|
|
11
|
+
UPDATE ir_module_module
|
|
12
|
+
SET state='to install'
|
|
13
|
+
WHERE name = '{to_install}' AND state='uninstalled'
|
|
14
|
+
"""
|
|
15
|
+
openupgrade.logged_query(cr, sql)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@openupgrade.migrate()
|
|
19
|
+
def migrate(env, version):
|
|
20
|
+
install_new_modules(env.cr)
|
|
21
|
+
query = """
|
|
22
|
+
DELETE FROM ir_model_fields
|
|
23
|
+
WHERE model = 'l10n_br_fiscal.document.electronic'
|
|
24
|
+
"""
|
|
25
|
+
openupgrade.logged_query(env.cr, query)
|
|
@@ -3,15 +3,12 @@
|
|
|
3
3
|
from . import data_abstract
|
|
4
4
|
from . import data_product_abstract
|
|
5
5
|
from . import data_ncm_nbs_abstract
|
|
6
|
-
from . import document_workflow
|
|
7
6
|
from . import document_fiscal_mixin_methods
|
|
8
7
|
from . import document_fiscal_mixin_fields
|
|
9
8
|
from . import document_fiscal_mixin
|
|
10
9
|
from . import document_move_mixin
|
|
11
10
|
from . import document_fiscal_line_mixin_methods
|
|
12
11
|
from . import document_fiscal_line_mixin
|
|
13
|
-
from . import document_event
|
|
14
|
-
from . import document_eletronic
|
|
15
12
|
from . import invalidate_number
|
|
16
13
|
from . import comment
|
|
17
14
|
from . import ibpt
|
|
@@ -22,26 +19,17 @@ from . import nbs
|
|
|
22
19
|
from . import service_type
|
|
23
20
|
from . import ncm
|
|
24
21
|
from . import nbm
|
|
25
|
-
from . import ncm_nbm
|
|
26
22
|
from . import cest
|
|
27
|
-
from . import ncm_cest
|
|
28
23
|
from . import tax_group
|
|
29
24
|
from . import tax
|
|
30
25
|
from . import tax_pis_cofins
|
|
31
26
|
from . import tax_pis_cofins_base
|
|
32
27
|
from . import tax_pis_cofins_credit
|
|
33
|
-
from . import ncm_tax_pis_cofins
|
|
34
28
|
from . import tax_ipi_control_seal
|
|
35
29
|
from . import tax_ipi_guideline
|
|
36
30
|
from . import tax_ipi_guideline_class
|
|
37
31
|
from . import tax_estimate
|
|
38
32
|
from . import tax_definition
|
|
39
|
-
from . import tax_definition_benefit
|
|
40
|
-
from . import tax_definition_company
|
|
41
|
-
from . import tax_definition_cfop
|
|
42
|
-
from . import tax_definition_icms
|
|
43
|
-
from . import tax_definition_operation_line
|
|
44
|
-
from . import tax_definition_partner_profile
|
|
45
33
|
from . import icms_regulation
|
|
46
34
|
from . import icms_relief
|
|
47
35
|
from . import document_type
|
|
@@ -10,6 +10,7 @@ from odoo import _, api, fields, models
|
|
|
10
10
|
from odoo.exceptions import ValidationError
|
|
11
11
|
|
|
12
12
|
from ..constants.fiscal import (
|
|
13
|
+
DOCUMENT_ISSUER,
|
|
13
14
|
DOCUMENT_ISSUER_COMPANY,
|
|
14
15
|
DOCUMENT_ISSUER_DICT,
|
|
15
16
|
DOCUMENT_ISSUER_PARTNER,
|
|
@@ -20,10 +21,13 @@ from ..constants.fiscal import (
|
|
|
20
21
|
MODELO_FISCAL_NFCE,
|
|
21
22
|
MODELO_FISCAL_NFE,
|
|
22
23
|
MODELO_FISCAL_NFSE,
|
|
24
|
+
SITUACAO_EDOC,
|
|
23
25
|
SITUACAO_EDOC_AUTORIZADA,
|
|
24
26
|
SITUACAO_EDOC_CANCELADA,
|
|
25
27
|
SITUACAO_EDOC_DENEGADA,
|
|
28
|
+
SITUACAO_EDOC_EM_DIGITACAO,
|
|
26
29
|
SITUACAO_EDOC_INUTILIZADA,
|
|
30
|
+
SITUACAO_FISCAL,
|
|
27
31
|
)
|
|
28
32
|
|
|
29
33
|
|
|
@@ -49,7 +53,6 @@ class Document(models.Model):
|
|
|
49
53
|
_name = "l10n_br_fiscal.document"
|
|
50
54
|
_inherit = [
|
|
51
55
|
"l10n_br_fiscal.document.mixin.fields",
|
|
52
|
-
"l10n_br_fiscal.document.electronic",
|
|
53
56
|
"l10n_br_fiscal.document.move.mixin",
|
|
54
57
|
"mail.thread",
|
|
55
58
|
]
|
|
@@ -62,6 +65,25 @@ class Document(models.Model):
|
|
|
62
65
|
index=True,
|
|
63
66
|
)
|
|
64
67
|
|
|
68
|
+
state_edoc = fields.Selection(
|
|
69
|
+
selection=SITUACAO_EDOC,
|
|
70
|
+
string="Situação e-doc",
|
|
71
|
+
default=SITUACAO_EDOC_EM_DIGITACAO,
|
|
72
|
+
copy=False,
|
|
73
|
+
required=True,
|
|
74
|
+
readonly=True,
|
|
75
|
+
# tracking=True,
|
|
76
|
+
index=True,
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
state_fiscal = fields.Selection(
|
|
80
|
+
selection=SITUACAO_FISCAL,
|
|
81
|
+
string="Situação Fiscal",
|
|
82
|
+
copy=False,
|
|
83
|
+
# tracking=True,
|
|
84
|
+
index=True,
|
|
85
|
+
)
|
|
86
|
+
|
|
65
87
|
fiscal_operation_id = fields.Many2one(
|
|
66
88
|
domain="[('state', '=', 'approved'), "
|
|
67
89
|
"'|', ('fiscal_operation_type', '=', fiscal_operation_type),"
|
|
@@ -141,23 +163,6 @@ class Document(models.Model):
|
|
|
141
163
|
default=EDOC_PURPOSE_NORMAL,
|
|
142
164
|
)
|
|
143
165
|
|
|
144
|
-
event_ids = fields.One2many(
|
|
145
|
-
comodel_name="l10n_br_fiscal.event",
|
|
146
|
-
inverse_name="document_id",
|
|
147
|
-
string="Events",
|
|
148
|
-
copy=False,
|
|
149
|
-
readonly=True,
|
|
150
|
-
)
|
|
151
|
-
|
|
152
|
-
correction_event_ids = fields.One2many(
|
|
153
|
-
comodel_name="l10n_br_fiscal.event",
|
|
154
|
-
inverse_name="document_id",
|
|
155
|
-
domain=[("type", "=", "14")],
|
|
156
|
-
string="Correction Events",
|
|
157
|
-
copy=False,
|
|
158
|
-
readonly=True,
|
|
159
|
-
)
|
|
160
|
-
|
|
161
166
|
document_type = fields.Char(
|
|
162
167
|
string="Document Type Code",
|
|
163
168
|
related="document_type_id.code",
|
|
@@ -172,10 +177,16 @@ class Document(models.Model):
|
|
|
172
177
|
copy=False,
|
|
173
178
|
)
|
|
174
179
|
|
|
175
|
-
#
|
|
176
|
-
#
|
|
180
|
+
# this related "state" field is required for the status bar widget
|
|
181
|
+
# while state_edoc avoids colliding with the state field
|
|
182
|
+
# of objects where the fiscal mixin might be injected.
|
|
177
183
|
state = fields.Selection(related="state_edoc", string="State")
|
|
178
184
|
|
|
185
|
+
issuer = fields.Selection(
|
|
186
|
+
selection=DOCUMENT_ISSUER,
|
|
187
|
+
default=DOCUMENT_ISSUER_COMPANY,
|
|
188
|
+
)
|
|
189
|
+
|
|
179
190
|
document_subsequent_ids = fields.One2many(
|
|
180
191
|
comodel_name="l10n_br_fiscal.subsequent.document",
|
|
181
192
|
inverse_name="source_document_id",
|
|
@@ -405,6 +416,37 @@ class Document(models.Model):
|
|
|
405
416
|
|
|
406
417
|
return action
|
|
407
418
|
|
|
419
|
+
# the following actions are meant to be implemented in other modules such as
|
|
420
|
+
# l10n_br_fiscal_edi. They are defined here so they can be overriden in modules
|
|
421
|
+
# that don't depend on l10n_br_fiscal_edi (such as l10n_br_account).
|
|
422
|
+
def view_pdf(self):
|
|
423
|
+
pass
|
|
424
|
+
|
|
425
|
+
def view_xml(self):
|
|
426
|
+
pass
|
|
427
|
+
|
|
428
|
+
def action_document_confirm(self):
|
|
429
|
+
pass
|
|
430
|
+
|
|
431
|
+
def action_document_send(self):
|
|
432
|
+
pass
|
|
433
|
+
|
|
434
|
+
def action_document_back2draft(self):
|
|
435
|
+
pass
|
|
436
|
+
|
|
437
|
+
def action_document_cancel(self):
|
|
438
|
+
pass
|
|
439
|
+
|
|
440
|
+
def action_document_invalidate(self):
|
|
441
|
+
pass
|
|
442
|
+
|
|
443
|
+
def action_document_correction(self):
|
|
444
|
+
pass
|
|
445
|
+
|
|
446
|
+
def exec_after_SITUACAO_EDOC_DENEGADA(self, old_state, new_state):
|
|
447
|
+
# see https://github.com/OCA/l10n-brazil/pull/3272
|
|
448
|
+
pass
|
|
449
|
+
|
|
408
450
|
def _get_email_template(self, state):
|
|
409
451
|
self.ensure_one()
|
|
410
452
|
return self.document_type_id.document_email_ids.search(
|
|
@@ -82,50 +82,6 @@ class InvalidateNumber(models.Model):
|
|
|
82
82
|
default="draft",
|
|
83
83
|
)
|
|
84
84
|
|
|
85
|
-
event_ids = fields.One2many(
|
|
86
|
-
comodel_name="l10n_br_fiscal.event",
|
|
87
|
-
inverse_name="invalidate_number_id",
|
|
88
|
-
string="Events",
|
|
89
|
-
readonly=True,
|
|
90
|
-
states={"done": [("readonly", True)]},
|
|
91
|
-
)
|
|
92
|
-
|
|
93
|
-
# Authorization Event Related Fields
|
|
94
|
-
authorization_event_id = fields.Many2one(
|
|
95
|
-
comodel_name="l10n_br_fiscal.event",
|
|
96
|
-
string="Authorization Event",
|
|
97
|
-
readonly=True,
|
|
98
|
-
copy=False,
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
authorization_date = fields.Datetime(
|
|
102
|
-
string="Authorization Date",
|
|
103
|
-
readonly=True,
|
|
104
|
-
related="authorization_event_id.protocol_date",
|
|
105
|
-
)
|
|
106
|
-
|
|
107
|
-
authorization_protocol = fields.Char(
|
|
108
|
-
string="Authorization Protocol",
|
|
109
|
-
related="authorization_event_id.protocol_number",
|
|
110
|
-
readonly=True,
|
|
111
|
-
)
|
|
112
|
-
|
|
113
|
-
send_file_id = fields.Many2one(
|
|
114
|
-
comodel_name="ir.attachment",
|
|
115
|
-
related="authorization_event_id.file_request_id",
|
|
116
|
-
string="Send Document File XML",
|
|
117
|
-
ondelete="restrict",
|
|
118
|
-
readonly=True,
|
|
119
|
-
)
|
|
120
|
-
|
|
121
|
-
authorization_file_id = fields.Many2one(
|
|
122
|
-
comodel_name="ir.attachment",
|
|
123
|
-
related="authorization_event_id.file_response_id",
|
|
124
|
-
string="Authorization File XML",
|
|
125
|
-
ondelete="restrict",
|
|
126
|
-
readonly=True,
|
|
127
|
-
)
|
|
128
|
-
|
|
129
85
|
@api.constrains("number_start", "number_end")
|
|
130
86
|
def _check_range(self):
|
|
131
87
|
for record in self:
|
|
@@ -51,6 +51,33 @@ class Ncm(models.Model):
|
|
|
51
51
|
string="Tax Definition",
|
|
52
52
|
)
|
|
53
53
|
|
|
54
|
+
cest_ids = fields.Many2many(
|
|
55
|
+
comodel_name="l10n_br_fiscal.cest",
|
|
56
|
+
relation="fiscal_cest_ncm_rel",
|
|
57
|
+
column1="ncm_id",
|
|
58
|
+
column2="cest_id",
|
|
59
|
+
readonly=True,
|
|
60
|
+
string="CESTs",
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
nbm_ids = fields.Many2many(
|
|
64
|
+
comodel_name="l10n_br_fiscal.nbm",
|
|
65
|
+
relation="fiscal_nbm_ncm_rel",
|
|
66
|
+
column1="ncm_id",
|
|
67
|
+
column2="nbm_id",
|
|
68
|
+
readonly=True,
|
|
69
|
+
string="NBMs",
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
piscofins_ids = fields.Many2many(
|
|
73
|
+
comodel_name="l10n_br_fiscal.tax.pis.cofins",
|
|
74
|
+
relation="fiscal_pis_cofins_ncm_rel",
|
|
75
|
+
column1="ncm_id",
|
|
76
|
+
column2="piscofins_id",
|
|
77
|
+
readonly=True,
|
|
78
|
+
string="PIS/COFINS",
|
|
79
|
+
)
|
|
80
|
+
|
|
54
81
|
_sql_constraints = [
|
|
55
82
|
(
|
|
56
83
|
"fiscal_ncm_code_exception_uniq",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
|
3
3
|
|
|
4
4
|
from odoo import _, api, fields, models
|
|
5
|
-
from odoo.exceptions import UserError
|
|
5
|
+
from odoo.exceptions import UserError, ValidationError
|
|
6
6
|
|
|
7
7
|
from .. import tools
|
|
8
8
|
from ..constants.fiscal import (
|
|
@@ -12,6 +12,7 @@ from ..constants.fiscal import (
|
|
|
12
12
|
OPERATION_STATE,
|
|
13
13
|
OPERATION_STATE_DEFAULT,
|
|
14
14
|
)
|
|
15
|
+
from ..constants.icms import ICMS_TAX_BENEFIT_TYPE
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
class TaxDefinition(models.Model):
|
|
@@ -37,6 +38,19 @@ class TaxDefinition(models.Model):
|
|
|
37
38
|
|
|
38
39
|
display_name = fields.Char(compute="_compute_display_name", store=True)
|
|
39
40
|
|
|
41
|
+
code = fields.Char(
|
|
42
|
+
size=8,
|
|
43
|
+
states={"draft": [("readonly", False)]},
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
name = fields.Char(
|
|
47
|
+
states={"draft": [("readonly", False)]},
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
description = fields.Text(
|
|
51
|
+
states={"draft": [("readonly", False)]},
|
|
52
|
+
)
|
|
53
|
+
|
|
40
54
|
type_in_out = fields.Selection(
|
|
41
55
|
selection=FISCAL_IN_OUT,
|
|
42
56
|
string="Type",
|
|
@@ -234,6 +248,31 @@ class TaxDefinition(models.Model):
|
|
|
234
248
|
domain="['|', ('cst_in_id', '=', cst_id), ('cst_out_id', '=', cst_id)]",
|
|
235
249
|
)
|
|
236
250
|
|
|
251
|
+
fiscal_profile_id = fields.Many2one(
|
|
252
|
+
comodel_name="l10n_br_fiscal.partner.profile", string="Partner Profile"
|
|
253
|
+
)
|
|
254
|
+
|
|
255
|
+
fiscal_operation_line_id = fields.Many2one(
|
|
256
|
+
comodel_name="l10n_br_fiscal.operation.line", string="Operation Line"
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
icms_regulation_id = fields.Many2one(
|
|
260
|
+
comodel_name="l10n_br_fiscal.icms.regulation", string="ICMS Regulation"
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
cfop_id = fields.Many2one(comodel_name="l10n_br_fiscal.cfop", string="CFOP")
|
|
264
|
+
|
|
265
|
+
is_benefit = fields.Boolean(
|
|
266
|
+
string="Benefit?",
|
|
267
|
+
readonly=True,
|
|
268
|
+
states={"draft": [("readonly", False)]},
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
benefit_type = fields.Selection(
|
|
272
|
+
selection=ICMS_TAX_BENEFIT_TYPE,
|
|
273
|
+
states={"draft": [("readonly", False)]},
|
|
274
|
+
)
|
|
275
|
+
|
|
237
276
|
def _get_search_domain(self, tax_definition):
|
|
238
277
|
"""Create domain to be used in contraints methods"""
|
|
239
278
|
domain = [
|
|
@@ -243,6 +282,34 @@ class TaxDefinition(models.Model):
|
|
|
243
282
|
("tax_group_id", "=", tax_definition.tax_group_id.id),
|
|
244
283
|
("tax_id", "=", tax_definition.tax_id.id),
|
|
245
284
|
]
|
|
285
|
+
if tax_definition.icms_regulation_id:
|
|
286
|
+
domain.append(
|
|
287
|
+
("icms_regulation_id", "=", tax_definition.icms_regulation_id.id),
|
|
288
|
+
)
|
|
289
|
+
if tax_definition.icms_regulation_id and tax_definition.is_benefit:
|
|
290
|
+
domain.append(
|
|
291
|
+
("is_benefit", "=", tax_definition.is_benefit),
|
|
292
|
+
)
|
|
293
|
+
if tax_definition.ncm_ids:
|
|
294
|
+
domain.append(
|
|
295
|
+
("ncm_ids", "in", tax_definition.ncm_ids.ids),
|
|
296
|
+
)
|
|
297
|
+
if tax_definition.cest_ids:
|
|
298
|
+
domain.append(
|
|
299
|
+
("cest_ids", "in", tax_definition.cest_ids.ids),
|
|
300
|
+
)
|
|
301
|
+
if tax_definition.nbm_ids:
|
|
302
|
+
domain.append(
|
|
303
|
+
("nbm_ids", "in", tax_definition.nbm_ids.ids),
|
|
304
|
+
)
|
|
305
|
+
if tax_definition.product_ids:
|
|
306
|
+
domain.append(
|
|
307
|
+
("product_ids", "in", tax_definition.product_ids.ids),
|
|
308
|
+
)
|
|
309
|
+
if tax_definition.ncm_exception:
|
|
310
|
+
domain.append(
|
|
311
|
+
("ncm_exception", "=", tax_definition.ncm_exception),
|
|
312
|
+
)
|
|
246
313
|
return domain
|
|
247
314
|
|
|
248
315
|
def action_review(self):
|
|
@@ -411,3 +478,124 @@ class TaxDefinition(models.Model):
|
|
|
411
478
|
self.cst_id = self.tax_id.cst_out_id
|
|
412
479
|
else:
|
|
413
480
|
self.cst_id = self.tax_id.cst_in_id
|
|
481
|
+
|
|
482
|
+
@api.onchange("cfop_id")
|
|
483
|
+
def _onchange_cfop_id(self):
|
|
484
|
+
if self.cfop_id:
|
|
485
|
+
self.type_in_out = self.cfop_id.type_in_out
|
|
486
|
+
|
|
487
|
+
@api.constrains("fiscal_profile_id")
|
|
488
|
+
def _check_fiscal_profile_id(self):
|
|
489
|
+
for record in self:
|
|
490
|
+
if record.fiscal_profile_id:
|
|
491
|
+
domain = [
|
|
492
|
+
("id", "!=", record.id),
|
|
493
|
+
("fiscal_profile_id", "=", record.fiscal_profile_id.id),
|
|
494
|
+
("tax_group_id", "=", record.tax_group_id.id),
|
|
495
|
+
("tax_id", "=", record.tax_id.id),
|
|
496
|
+
]
|
|
497
|
+
|
|
498
|
+
if record.env["l10n_br_fiscal.tax.definition"].search_count(domain):
|
|
499
|
+
raise ValidationError(
|
|
500
|
+
_(
|
|
501
|
+
"Tax Definition already exists "
|
|
502
|
+
"for this Partner Profile and Tax Group !"
|
|
503
|
+
)
|
|
504
|
+
)
|
|
505
|
+
|
|
506
|
+
@api.constrains("fiscal_operation_line_id")
|
|
507
|
+
def _check_fiscal_operation_line_id(self):
|
|
508
|
+
for record in self:
|
|
509
|
+
if record.fiscal_operation_line_id:
|
|
510
|
+
domain = [
|
|
511
|
+
("id", "!=", record.id),
|
|
512
|
+
(
|
|
513
|
+
"fiscal_operation_line_id",
|
|
514
|
+
"=",
|
|
515
|
+
record.fiscal_operation_line_id.id,
|
|
516
|
+
),
|
|
517
|
+
("tax_group_id", "=", record.tax_group_id.id),
|
|
518
|
+
("tax_id", "=", record.tax_id.id),
|
|
519
|
+
]
|
|
520
|
+
|
|
521
|
+
if record.env["l10n_br_fiscal.tax.definition"].search_count(domain):
|
|
522
|
+
raise ValidationError(
|
|
523
|
+
_(
|
|
524
|
+
"Tax Definition already exists "
|
|
525
|
+
"for this Operation Line and Tax Group !"
|
|
526
|
+
)
|
|
527
|
+
)
|
|
528
|
+
|
|
529
|
+
@api.constrains("icms_regulation_id", "state_from_id")
|
|
530
|
+
def _check_icms(self):
|
|
531
|
+
for record in self:
|
|
532
|
+
if record.icms_regulation_id:
|
|
533
|
+
domain = self._get_search_domain(record)
|
|
534
|
+
if record.env["l10n_br_fiscal.tax.definition"].search_count(domain):
|
|
535
|
+
raise ValidationError(
|
|
536
|
+
_(
|
|
537
|
+
"Tax Definition already exists "
|
|
538
|
+
"for this ICMS and Tax Group !"
|
|
539
|
+
)
|
|
540
|
+
)
|
|
541
|
+
|
|
542
|
+
@api.constrains("company_id")
|
|
543
|
+
def _check_company_id(self):
|
|
544
|
+
for record in self:
|
|
545
|
+
if record.company_id:
|
|
546
|
+
domain = [
|
|
547
|
+
("id", "!=", record.id),
|
|
548
|
+
("company_id", "=", record.company_id.id),
|
|
549
|
+
("tax_group_id", "=", record.tax_group_id.id),
|
|
550
|
+
("tax_id", "=", record.tax_id.id),
|
|
551
|
+
]
|
|
552
|
+
|
|
553
|
+
if record.env["l10n_br_fiscal.tax.definition"].search_count(domain):
|
|
554
|
+
raise ValidationError(
|
|
555
|
+
_(
|
|
556
|
+
"Tax Definition already exists "
|
|
557
|
+
"for this Company and Tax Group !"
|
|
558
|
+
)
|
|
559
|
+
)
|
|
560
|
+
|
|
561
|
+
@api.constrains("cfop_id")
|
|
562
|
+
def _check_cfop_id(self):
|
|
563
|
+
for record in self:
|
|
564
|
+
if record.cfop_id:
|
|
565
|
+
domain = [
|
|
566
|
+
("id", "!=", record.id),
|
|
567
|
+
("cfop_id", "=", record.cfop_id.id),
|
|
568
|
+
("tax_group_id", "=", record.tax_group_id.id),
|
|
569
|
+
("tax_id", "=", record.tax_id.id),
|
|
570
|
+
]
|
|
571
|
+
|
|
572
|
+
if record.env["l10n_br_fiscal.tax.definition"].search_count(domain):
|
|
573
|
+
raise ValidationError(
|
|
574
|
+
_(
|
|
575
|
+
"Tax Definition already exists "
|
|
576
|
+
"for this CFOP and Tax Group !"
|
|
577
|
+
)
|
|
578
|
+
)
|
|
579
|
+
|
|
580
|
+
@api.constrains("is_benefit", "code", "benefit_type", "state_from_id")
|
|
581
|
+
def _check_tax_benefit_code(self):
|
|
582
|
+
for record in self:
|
|
583
|
+
if record.is_benefit:
|
|
584
|
+
if record.code:
|
|
585
|
+
if len(record.code) != 8:
|
|
586
|
+
raise ValidationError(
|
|
587
|
+
_("Tax benefit code must be 8 characters!")
|
|
588
|
+
)
|
|
589
|
+
|
|
590
|
+
if record.code[:2].upper() != record.state_from_id.code.upper():
|
|
591
|
+
raise ValidationError(
|
|
592
|
+
_("Tax benefit code must be start with state code!")
|
|
593
|
+
)
|
|
594
|
+
|
|
595
|
+
if record.code[3:4] != record.benefit_type:
|
|
596
|
+
raise ValidationError(
|
|
597
|
+
_(
|
|
598
|
+
"The tax benefit code must contain "
|
|
599
|
+
"the type of benefit!"
|
|
600
|
+
)
|
|
601
|
+
)
|
|
@@ -93,14 +93,9 @@
|
|
|
93
93
|
"uom_alternative_user","UOM alternative for User","model_uom_uom_alternative","l10n_br_fiscal.group_user",1,0,0,0
|
|
94
94
|
"uom_alternative_manager","UOM alternative for Manager","model_uom_uom_alternative","l10n_br_fiscal.group_manager",1,0,0,0
|
|
95
95
|
"uom_alternative_maintenance","UOM alternative for Maintenance","model_uom_uom_alternative","l10n_br_fiscal.group_data_maintenance",1,1,1,1
|
|
96
|
-
"l10n_br_fiscal_event_user","Fiscal Document Event for User","model_l10n_br_fiscal_event","l10n_br_fiscal.group_user",1,1,1,0
|
|
97
96
|
"l10n_br_fiscal_invalidate_number_user","user_l10n_br_fiscal_invalidate_number","model_l10n_br_fiscal_invalidate_number","l10n_br_fiscal.group_user",1,0,0,0
|
|
98
97
|
"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
|
|
99
98
|
"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
|
|
100
99
|
"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
|
|
101
100
|
"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
|
|
102
|
-
"l10n_br_fiscal_document_cancel_wizard_user",l10n_br_fiscal_document_cancel_wizard,model_l10n_br_fiscal_document_cancel_wizard,base.group_user,1,1,1,1
|
|
103
|
-
"l10n_br_fiscal_document_correction_wizard_user",l10n_br_fiscal_document_correction_wizard,model_l10n_br_fiscal_document_correction_wizard,base.group_user,1,1,1,1
|
|
104
101
|
"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
|
|
105
|
-
"l10n_br_fiscal_invalidate_number_wizard_user",l10n_br_fiscal_invalidate_number_wizard,model_l10n_br_fiscal_invalidate_number_wizard,base.group_user,1,1,1,1
|
|
106
|
-
"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
|
|
@@ -367,7 +367,7 @@ ul.auto-toc {
|
|
|
367
367
|
!! This file is generated by oca-gen-addon-readme !!
|
|
368
368
|
!! changes will be overwritten. !!
|
|
369
369
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
370
|
-
!! source digest: sha256:
|
|
370
|
+
!! source digest: sha256:958ff988bce427270583558f8837a31a21cc7cf7cd5fd5b2aee912ba7c5ee700
|
|
371
371
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
|
372
372
|
<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/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-brazil/tree/16.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-16-0/l10n-brazil-16-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=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
|
373
373
|
<p><img alt="image" src="https://raw.githubusercontent.com/OCA/l10n-brazil/16.0/l10n_br_fiscal/static/img/fiscal_dashboard.png" /></p>
|
|
@@ -5,12 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
from odoo.tests import TransactionCase
|
|
7
7
|
|
|
8
|
-
from ..constants.fiscal import (
|
|
9
|
-
SITUACAO_EDOC_A_ENVIAR,
|
|
10
|
-
SITUACAO_EDOC_AUTORIZADA,
|
|
11
|
-
SITUACAO_EDOC_CANCELADA,
|
|
12
|
-
SITUACAO_EDOC_EM_DIGITACAO,
|
|
13
|
-
)
|
|
14
8
|
from ..constants.icms import ICMS_ORIGIN_TAX_IMPORTED
|
|
15
9
|
|
|
16
10
|
|
|
@@ -172,26 +166,9 @@ class TestFiscalDocumentGeneric(TransactionCase):
|
|
|
172
166
|
|
|
173
167
|
self.nfe_same_state.action_document_confirm()
|
|
174
168
|
|
|
175
|
-
self.assertEqual(
|
|
176
|
-
self.nfe_same_state.state_edoc,
|
|
177
|
-
SITUACAO_EDOC_A_ENVIAR,
|
|
178
|
-
"Document is not in To Sent state",
|
|
179
|
-
)
|
|
180
|
-
|
|
181
|
-
self.nfe_same_state.action_document_send()
|
|
182
|
-
|
|
183
|
-
self.assertEqual(
|
|
184
|
-
self.nfe_same_state.state_edoc,
|
|
185
|
-
SITUACAO_EDOC_AUTORIZADA,
|
|
186
|
-
"Document is not in Authorized state",
|
|
187
|
-
)
|
|
188
|
-
|
|
189
169
|
# Total value of the products
|
|
190
170
|
self.assertEqual(self.nfe_same_state.amount_price_gross, 200)
|
|
191
171
|
|
|
192
|
-
result = self.nfe_same_state.action_document_cancel()
|
|
193
|
-
self.assertTrue(result)
|
|
194
|
-
|
|
195
172
|
def test_nfe_other_state(self):
|
|
196
173
|
"""Test NFe other state."""
|
|
197
174
|
|
|
@@ -1164,28 +1141,3 @@ class TestFiscalDocumentGeneric(TransactionCase):
|
|
|
1164
1141
|
"Unexpected value for the field"
|
|
1165
1142
|
" Other Values in Fiscal Document line",
|
|
1166
1143
|
)
|
|
1167
|
-
|
|
1168
|
-
def test_nfe_purchase_same_state(self):
|
|
1169
|
-
self.nfe_purchase_same_state.action_document_confirm()
|
|
1170
|
-
|
|
1171
|
-
self.assertEqual(
|
|
1172
|
-
self.nfe_purchase_same_state.state_edoc,
|
|
1173
|
-
SITUACAO_EDOC_AUTORIZADA,
|
|
1174
|
-
"Document is not in Authorized state",
|
|
1175
|
-
)
|
|
1176
|
-
|
|
1177
|
-
self.nfe_purchase_same_state.action_document_back2draft()
|
|
1178
|
-
|
|
1179
|
-
self.assertEqual(
|
|
1180
|
-
self.nfe_purchase_same_state.state_edoc,
|
|
1181
|
-
SITUACAO_EDOC_EM_DIGITACAO,
|
|
1182
|
-
"Document is not in Draft state",
|
|
1183
|
-
)
|
|
1184
|
-
|
|
1185
|
-
self.nfe_purchase_same_state.action_document_cancel()
|
|
1186
|
-
|
|
1187
|
-
self.assertEqual(
|
|
1188
|
-
self.nfe_purchase_same_state.state_edoc,
|
|
1189
|
-
SITUACAO_EDOC_CANCELADA,
|
|
1190
|
-
"Document is not in Canceled state",
|
|
1191
|
-
)
|
|
@@ -33,7 +33,8 @@ class TestSubsequentOperation(TransactionCase):
|
|
|
33
33
|
line._onchange_product_id_fiscal()
|
|
34
34
|
line._onchange_fiscal_taxes()
|
|
35
35
|
|
|
36
|
-
self.nfe_simples_faturamento.
|
|
36
|
+
self.nfe_simples_faturamento.state_edoc = "a_enviar"
|
|
37
|
+
self.nfe_simples_faturamento._generates_subsequent_operations()
|
|
37
38
|
|
|
38
39
|
subsequent_documents = self.nfe_simples_faturamento.document_subsequent_ids
|
|
39
40
|
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
from odoo.tests import TransactionCase
|
|
5
5
|
|
|
6
|
-
from ..constants.fiscal import SITUACAO_EDOC_A_ENVIAR, SITUACAO_EDOC_AUTORIZADA
|
|
7
|
-
|
|
8
6
|
|
|
9
7
|
class TestTaxBenefit(TransactionCase):
|
|
10
8
|
def setUp(self):
|
|
@@ -53,22 +51,3 @@ class TestTaxBenefit(TransactionCase):
|
|
|
53
51
|
self.tax_benefit,
|
|
54
52
|
"Document line must have tax benefit",
|
|
55
53
|
)
|
|
56
|
-
|
|
57
|
-
self.nfe_tax_benefit.action_document_confirm()
|
|
58
|
-
|
|
59
|
-
self.assertEqual(
|
|
60
|
-
self.nfe_tax_benefit.state_edoc,
|
|
61
|
-
SITUACAO_EDOC_A_ENVIAR,
|
|
62
|
-
"Document is not in To Send state",
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
self.nfe_tax_benefit.action_document_send()
|
|
66
|
-
|
|
67
|
-
self.assertEqual(
|
|
68
|
-
self.nfe_tax_benefit.state_edoc,
|
|
69
|
-
SITUACAO_EDOC_AUTORIZADA,
|
|
70
|
-
"Document is not in Authorized state",
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
result = self.nfe_tax_benefit.action_document_cancel()
|
|
74
|
-
self.assertTrue(result)
|