odoo-addon-l10n-br-fiscal 16.0.2.17.0__py3-none-any.whl → 16.0.19.4.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.
- odoo/addons/l10n_br_fiscal/README.rst +11 -4
- odoo/addons/l10n_br_fiscal/__manifest__.py +20 -12
- 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.cfop.csv +620 -620
- 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.legal.nature.csv +82 -0
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal.nbs.csv +791 -764
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal.operation.indicator.csv +27 -0
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal.partner.profile.csv +11 -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 +32 -0
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal.tax.group.csv +3 -0
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal_icms_tax_definition_data.xml +340 -352
- odoo/addons/l10n_br_fiscal/data/operation_data.xml +1 -1
- odoo/addons/l10n_br_fiscal/data/simplified_tax_data.xml +5 -5
- odoo/addons/l10n_br_fiscal/data/uom.alias.csv +25 -0
- odoo/addons/l10n_br_fiscal/data/uom_data.xml +104 -33
- odoo/addons/l10n_br_fiscal/demo/__init__.py +21 -15
- odoo/addons/l10n_br_fiscal/demo/company_demo.xml +6 -0
- odoo/addons/l10n_br_fiscal/demo/fiscal_document_demo.xml +3 -377
- odoo/addons/l10n_br_fiscal/demo/fiscal_document_nfse_demo.xml +0 -12
- odoo/addons/l10n_br_fiscal/demo/fiscal_operation_demo.xml +2 -2
- odoo/addons/l10n_br_fiscal/demo/icms_tax_definition_demo.xml +5 -2
- odoo/addons/l10n_br_fiscal/demo/res_users_demo.xml +2 -2
- odoo/addons/l10n_br_fiscal/i18n/l10n_br_fiscal.pot +1161 -804
- odoo/addons/l10n_br_fiscal/i18n/pt_BR.po +22 -22
- odoo/addons/l10n_br_fiscal/migrations/16.0.13.0.0/pre-migration.py +25 -0
- odoo/addons/l10n_br_fiscal/migrations/16.0.14.0.0/pre-migration.py +30 -0
- odoo/addons/l10n_br_fiscal/migrations/16.0.14.0.5/pre-migration.py +15 -0
- odoo/addons/l10n_br_fiscal/migrations/16.0.4.0.0/pre-migration.py +220 -0
- odoo/addons/l10n_br_fiscal/migrations/16.0.5.0.0/pre-migration.py +33 -0
- odoo/addons/l10n_br_fiscal/migrations/16.0.5.2.0/pre-migration.py +21 -0
- odoo/addons/l10n_br_fiscal/models/__init__.py +3 -8
- odoo/addons/l10n_br_fiscal/models/cest.py +0 -8
- odoo/addons/l10n_br_fiscal/models/cfop.py +91 -0
- odoo/addons/l10n_br_fiscal/models/city_taxation_code.py +1 -3
- odoo/addons/l10n_br_fiscal/models/comment.py +2 -2
- odoo/addons/l10n_br_fiscal/models/cst.py +0 -1
- odoo/addons/l10n_br_fiscal/models/data_abstract.py +26 -0
- odoo/addons/l10n_br_fiscal/models/data_ncm_nbs_abstract.py +1 -1
- odoo/addons/l10n_br_fiscal/models/document.py +131 -222
- odoo/addons/l10n_br_fiscal/models/document_line.py +82 -5
- odoo/addons/l10n_br_fiscal/models/document_line_mixin.py +1952 -138
- odoo/addons/l10n_br_fiscal/models/document_mixin.py +741 -6
- odoo/addons/l10n_br_fiscal/models/document_related.py +12 -9
- odoo/addons/l10n_br_fiscal/models/document_serie.py +33 -0
- odoo/addons/l10n_br_fiscal/models/document_type.py +0 -6
- odoo/addons/l10n_br_fiscal/models/ibpt.py +1 -1
- odoo/addons/l10n_br_fiscal/models/icms_regulation.py +2 -2
- odoo/addons/l10n_br_fiscal/models/invalidate_number.py +4 -5
- odoo/addons/l10n_br_fiscal/models/legal_nature.py +20 -0
- odoo/addons/l10n_br_fiscal/models/nbm.py +0 -8
- odoo/addons/l10n_br_fiscal/models/ncm.py +0 -12
- odoo/addons/l10n_br_fiscal/models/operation.py +49 -15
- 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 +75 -6
- odoo/addons/l10n_br_fiscal/models/partner_profile.py +6 -0
- odoo/addons/l10n_br_fiscal/models/product_mixin.py +24 -21
- odoo/addons/l10n_br_fiscal/models/product_template.py +23 -13
- odoo/addons/l10n_br_fiscal/models/res_company.py +31 -9
- odoo/addons/l10n_br_fiscal/models/res_partner.py +38 -6
- odoo/addons/l10n_br_fiscal/models/simplified_tax.py +0 -3
- odoo/addons/l10n_br_fiscal/models/simplified_tax_range.py +8 -0
- odoo/addons/l10n_br_fiscal/models/tax.py +144 -55
- odoo/addons/l10n_br_fiscal/models/tax_classification.py +81 -0
- odoo/addons/l10n_br_fiscal/models/tax_definition.py +72 -23
- odoo/addons/l10n_br_fiscal/models/tax_pis_cofins.py +0 -3
- odoo/addons/l10n_br_fiscal/models/tax_pis_cofins_base.py +1 -1
- odoo/addons/l10n_br_fiscal/models/tax_pis_cofins_credit.py +1 -1
- odoo/addons/l10n_br_fiscal/models/uom_uom.py +15 -30
- odoo/addons/l10n_br_fiscal/security/fiscal_security.xml +11 -27
- odoo/addons/l10n_br_fiscal/security/ir.model.access.csv +11 -10
- odoo/addons/l10n_br_fiscal/static/description/index.html +27 -21
- odoo/addons/l10n_br_fiscal/static/src/js/list_renderer_with_button.esm.js +38 -0
- odoo/addons/l10n_br_fiscal/tests/__init__.py +3 -2
- odoo/addons/l10n_br_fiscal/tests/test_document_edition.py +308 -0
- odoo/addons/l10n_br_fiscal/tests/test_fiscal_document_generic.py +23 -129
- odoo/addons/l10n_br_fiscal/tests/test_fiscal_document_nfse.py +5 -15
- odoo/addons/l10n_br_fiscal/tests/test_fiscal_document_serie.py +60 -0
- odoo/addons/l10n_br_fiscal/tests/test_ibpt.py +4 -3
- odoo/addons/l10n_br_fiscal/tests/test_icms_regulation.py +2 -2
- odoo/addons/l10n_br_fiscal/tests/test_ncm.py +4 -1
- odoo/addons/l10n_br_fiscal/tests/test_tax_benefit.py +17 -22
- odoo/addons/l10n_br_fiscal/tests/test_tax_classification.py +110 -0
- odoo/addons/l10n_br_fiscal/tools.py +1 -1
- odoo/addons/l10n_br_fiscal/views/cest_view.xml +2 -4
- odoo/addons/l10n_br_fiscal/views/cfop_view.xml +25 -5
- odoo/addons/l10n_br_fiscal/views/city_taxation_code.xml +1 -4
- odoo/addons/l10n_br_fiscal/views/cnae_view.xml +2 -4
- odoo/addons/l10n_br_fiscal/views/comment_view.xml +2 -4
- odoo/addons/l10n_br_fiscal/views/cst_view.xml +6 -8
- odoo/addons/l10n_br_fiscal/views/{document_fiscal_line_mixin_view.xml → document_line_mixin_view.xml} +525 -385
- odoo/addons/l10n_br_fiscal/views/document_line_view.xml +101 -82
- odoo/addons/l10n_br_fiscal/views/document_related_view.xml +44 -46
- odoo/addons/l10n_br_fiscal/views/document_serie_view.xml +2 -6
- odoo/addons/l10n_br_fiscal/views/document_type_view.xml +0 -8
- odoo/addons/l10n_br_fiscal/views/document_view.xml +303 -370
- odoo/addons/l10n_br_fiscal/views/icms_regulation_view.xml +14 -16
- odoo/addons/l10n_br_fiscal/views/icms_relief_view.xml +8 -10
- odoo/addons/l10n_br_fiscal/views/invalidate_number_view.xml +46 -48
- odoo/addons/l10n_br_fiscal/views/l10n_br_fiscal_action.xml +166 -280
- odoo/addons/l10n_br_fiscal/views/l10n_br_fiscal_menu.xml +25 -99
- odoo/addons/l10n_br_fiscal/views/legal_nature_view.xml +40 -0
- odoo/addons/l10n_br_fiscal/views/nbm_view.xml +5 -6
- odoo/addons/l10n_br_fiscal/views/nbs_view.xml +5 -6
- odoo/addons/l10n_br_fiscal/views/ncm_view.xml +12 -15
- odoo/addons/l10n_br_fiscal/views/operation_dashboard_view.xml +13 -12
- odoo/addons/l10n_br_fiscal/views/operation_indicator_view.xml +75 -0
- odoo/addons/l10n_br_fiscal/views/operation_line_view.xml +22 -21
- odoo/addons/l10n_br_fiscal/views/operation_view.xml +4 -19
- odoo/addons/l10n_br_fiscal/views/partner_profile_view.xml +3 -6
- odoo/addons/l10n_br_fiscal/views/product_genre_view.xml +7 -9
- odoo/addons/l10n_br_fiscal/views/product_product_view.xml +37 -14
- odoo/addons/l10n_br_fiscal/views/product_template_view.xml +34 -14
- odoo/addons/l10n_br_fiscal/views/res_company_view.xml +55 -52
- odoo/addons/l10n_br_fiscal/views/res_config_settings_view.xml +23 -28
- odoo/addons/l10n_br_fiscal/views/res_partner_view.xml +22 -2
- odoo/addons/l10n_br_fiscal/views/service_type_view.xml +7 -8
- odoo/addons/l10n_br_fiscal/views/simplified_tax_range_view.xml +0 -2
- odoo/addons/l10n_br_fiscal/views/simplified_tax_view.xml +0 -2
- odoo/addons/l10n_br_fiscal/views/tax_classification.xml +110 -0
- odoo/addons/l10n_br_fiscal/views/tax_definition_view.xml +157 -129
- odoo/addons/l10n_br_fiscal/views/tax_estimate_view.xml +0 -2
- odoo/addons/l10n_br_fiscal/views/tax_group_view.xml +3 -6
- odoo/addons/l10n_br_fiscal/views/tax_ipi_control_seal_view.xml +0 -2
- odoo/addons/l10n_br_fiscal/views/tax_ipi_guideline_class_view.xml +0 -2
- odoo/addons/l10n_br_fiscal/views/tax_ipi_guideline_view.xml +2 -4
- odoo/addons/l10n_br_fiscal/views/tax_pis_cofins_base_view.xml +2 -4
- odoo/addons/l10n_br_fiscal/views/tax_pis_cofins_credit_view.xml +2 -4
- odoo/addons/l10n_br_fiscal/views/tax_pis_cofins_view.xml +5 -7
- odoo/addons/l10n_br_fiscal/views/tax_view.xml +5 -7
- odoo/addons/l10n_br_fiscal/views/uom_uom.xml +24 -17
- odoo/addons/l10n_br_fiscal/wizards/__init__.py +1 -0
- odoo/addons/l10n_br_fiscal/wizards/base_wizard_mixin.py +1 -1
- odoo/addons/l10n_br_fiscal/wizards/document_import_wizard_mixin.py +129 -0
- odoo/addons/l10n_br_fiscal/wizards/document_import_wizard_mixin.xml +41 -0
- {odoo_addon_l10n_br_fiscal-16.0.2.17.0.dist-info → odoo_addon_l10n_br_fiscal-16.0.19.4.0.dist-info}/METADATA +15 -6
- odoo_addon_l10n_br_fiscal-16.0.19.4.0.dist-info/RECORD +210 -0
- {odoo_addon_l10n_br_fiscal-16.0.2.17.0.dist-info → odoo_addon_l10n_br_fiscal-16.0.19.4.0.dist-info}/WHEEL +1 -1
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal_email_template.xml +0 -68
- odoo/addons/l10n_br_fiscal/data/partner_profile_data.xml +0 -96
- odoo/addons/l10n_br_fiscal/data/uom_alternative_data.xml +0 -58
- odoo/addons/l10n_br_fiscal/demo/l10n_br_fiscal_document_email.xml +0 -54
- odoo/addons/l10n_br_fiscal/demo/subsequent_operation_demo.xml +0 -10
- odoo/addons/l10n_br_fiscal/models/document_email.py +0 -74
- odoo/addons/l10n_br_fiscal/models/document_line_mixin_methods.py +0 -913
- odoo/addons/l10n_br_fiscal/models/document_mixin_fields.py +0 -473
- odoo/addons/l10n_br_fiscal/models/document_mixin_methods.py +0 -269
- odoo/addons/l10n_br_fiscal/models/document_move_mixin.py +0 -261
- odoo/addons/l10n_br_fiscal/models/subsequent_document.py +0 -203
- odoo/addons/l10n_br_fiscal/models/subsequent_operation.py +0 -54
- odoo/addons/l10n_br_fiscal/models/uom_uom_alternative.py +0 -22
- odoo/addons/l10n_br_fiscal/tests/test_subsequent_operation.py +0 -71
- odoo/addons/l10n_br_fiscal/tests/test_uom_uom.py +0 -22
- odoo/addons/l10n_br_fiscal/views/document_email_view.xml +0 -48
- odoo/addons/l10n_br_fiscal/views/subsequent_document_view.xml +0 -43
- odoo/addons/l10n_br_fiscal/views/subsequent_operation_view.xml +0 -21
- odoo_addon_l10n_br_fiscal-16.0.2.17.0.dist-info/RECORD +0 -205
- {odoo_addon_l10n_br_fiscal-16.0.2.17.0.dist-info → odoo_addon_l10n_br_fiscal-16.0.19.4.0.dist-info}/top_level.txt +0 -0
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
# Copyright 2018 KMEE INFORMATICA LTDA
|
|
2
|
-
# Gabriel Cardoso de Faria <gabriel.cardoso@kmee.com.br>
|
|
3
|
-
# License AGPL-3 or later (http://www.gnu.org/licenses/agpl)
|
|
4
|
-
#
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
from odoo import api, fields, models
|
|
8
|
-
|
|
9
|
-
from ..constants.fiscal import (
|
|
10
|
-
MODELO_FISCAL_CFE,
|
|
11
|
-
MODELO_FISCAL_CUPOM_FISCAL_ECF,
|
|
12
|
-
MODELO_FISCAL_NFCE,
|
|
13
|
-
SITUACAO_EDOC_CANCELADA,
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
SITUACAO_SUBSEQUENTE = (
|
|
17
|
-
("manual", "Manualmente"),
|
|
18
|
-
("nota_de_cupom", "Gerar Nota Fiscal de Cupons Fiscais"),
|
|
19
|
-
("nota_de_remessa", "Gerar Nota Fiscal de Remessa"),
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class SubsequentDocument(models.Model):
|
|
24
|
-
_name = "l10n_br_fiscal.subsequent.document"
|
|
25
|
-
_description = "Subsequent Document"
|
|
26
|
-
|
|
27
|
-
source_document_id = fields.Many2one(
|
|
28
|
-
string="Source document",
|
|
29
|
-
comodel_name="l10n_br_fiscal.document",
|
|
30
|
-
required=True,
|
|
31
|
-
ondelete="cascade",
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
subsequent_operation_id = fields.Many2one(
|
|
35
|
-
string="Subsequent Operation",
|
|
36
|
-
comodel_name="l10n_br_fiscal.subsequent.operation",
|
|
37
|
-
required=True,
|
|
38
|
-
)
|
|
39
|
-
|
|
40
|
-
fiscal_operation_id = fields.Many2one(
|
|
41
|
-
string="Related operation",
|
|
42
|
-
comodel_name="l10n_br_fiscal.operation",
|
|
43
|
-
required=True,
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
subsequent_document_id = fields.Many2one(
|
|
47
|
-
string="Subsequent Document",
|
|
48
|
-
comodel_name="l10n_br_fiscal.document",
|
|
49
|
-
ondelete="set null",
|
|
50
|
-
copy=False,
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
operation_performed = fields.Boolean(
|
|
54
|
-
compute="_compute_operation_performed",
|
|
55
|
-
default=False,
|
|
56
|
-
copy=False,
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
# def _subsequent_payment_type(self):
|
|
60
|
-
# return (self.operation_id.ind_forma_pagamento or
|
|
61
|
-
# self.source_document_id.ind_forma_pagamento)
|
|
62
|
-
#
|
|
63
|
-
# def _subsequent_payment_condition(self):
|
|
64
|
-
# return (self.operation_id.condicao_pagamento_id or
|
|
65
|
-
# self.source_document_id.condicao_pagamento_id)
|
|
66
|
-
|
|
67
|
-
def _subsequent_company(self):
|
|
68
|
-
return self.fiscal_operation_id.company_id or self.source_document_id.company_id
|
|
69
|
-
|
|
70
|
-
def _subsequent_partner(self):
|
|
71
|
-
return (
|
|
72
|
-
self.subsequent_operation_id.partner_id
|
|
73
|
-
or self.source_document_id.partner_id
|
|
74
|
-
)
|
|
75
|
-
|
|
76
|
-
def _subsequent_referenced(self):
|
|
77
|
-
if self.subsequent_operation_id.reference_document:
|
|
78
|
-
return self.env.context.get(
|
|
79
|
-
"referenciado_ids",
|
|
80
|
-
self.source_document_id._prepare_referenced_subsequent(),
|
|
81
|
-
)
|
|
82
|
-
return []
|
|
83
|
-
|
|
84
|
-
def generate_subsequent_document(self):
|
|
85
|
-
self._generate_subsequent_document()
|
|
86
|
-
|
|
87
|
-
def _generate_subsequent_document(self):
|
|
88
|
-
if self.operation_performed:
|
|
89
|
-
return self.subsequent_document_id
|
|
90
|
-
|
|
91
|
-
new_doc = self.source_document_id.copy()
|
|
92
|
-
|
|
93
|
-
new_doc.partner_id = self._subsequent_partner()
|
|
94
|
-
new_doc.company_id = self._subsequent_company()
|
|
95
|
-
new_doc.fiscal_operation_id = self.fiscal_operation_id
|
|
96
|
-
new_doc.document_type_id = (
|
|
97
|
-
self.subsequent_operation_id.operation_document_type_id
|
|
98
|
-
)
|
|
99
|
-
new_doc.document_serie_id = new_doc.document_type_id.get_document_serie(
|
|
100
|
-
new_doc.company_id, new_doc.fiscal_operation_id
|
|
101
|
-
)
|
|
102
|
-
|
|
103
|
-
# new_doc.condicao_pagamento_id = \
|
|
104
|
-
# self._subsequent_payment_condition()
|
|
105
|
-
# new_doc.tipo_pagamento = self._subsequent_payment_type()
|
|
106
|
-
|
|
107
|
-
#
|
|
108
|
-
# Reference document
|
|
109
|
-
#
|
|
110
|
-
reference_ids = self._subsequent_referenced()
|
|
111
|
-
new_doc._document_reference(reference_ids)
|
|
112
|
-
|
|
113
|
-
new_doc._onchange_fiscal_operation_id()
|
|
114
|
-
new_doc.fiscal_line_ids.write(
|
|
115
|
-
{"fiscal_operation_id": new_doc.fiscal_operation_id.id}
|
|
116
|
-
)
|
|
117
|
-
|
|
118
|
-
for item in new_doc.fiscal_line_ids:
|
|
119
|
-
item._onchange_fiscal_operation_id()
|
|
120
|
-
item._onchange_fiscal_operation_line_id()
|
|
121
|
-
item._onchange_fiscal_taxes()
|
|
122
|
-
|
|
123
|
-
document = new_doc
|
|
124
|
-
document.action_document_confirm()
|
|
125
|
-
self.subsequent_document_id = document
|
|
126
|
-
|
|
127
|
-
@api.depends("subsequent_document_id.state_edoc")
|
|
128
|
-
def _compute_operation_performed(self):
|
|
129
|
-
for subseq in self:
|
|
130
|
-
if not subseq.subsequent_document_id:
|
|
131
|
-
subseq.operation_performed = False
|
|
132
|
-
elif subseq.subsequent_document_id.state_edoc == SITUACAO_EDOC_CANCELADA:
|
|
133
|
-
subseq.operation_performed = False
|
|
134
|
-
else:
|
|
135
|
-
subseq.operation_performed = True
|
|
136
|
-
|
|
137
|
-
def show_subsequent_document(self):
|
|
138
|
-
return {
|
|
139
|
-
"name": "Subsequent Document",
|
|
140
|
-
"type": "ir.actions.act_window",
|
|
141
|
-
"target": "current",
|
|
142
|
-
"views": [[False, "form"]],
|
|
143
|
-
"res_model": "l10n_br_fiscal.document",
|
|
144
|
-
"domain": [["id", "in", [self.subsequent_document_id.id]]],
|
|
145
|
-
"res_id": self.subsequent_document_id.id,
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
def show_source_document(self):
|
|
149
|
-
return {
|
|
150
|
-
"name": "Source Document",
|
|
151
|
-
"type": "ir.actions.act_window",
|
|
152
|
-
"target": "current",
|
|
153
|
-
"views": [[False, "form"]],
|
|
154
|
-
"res_model": "l10n_br_fiscal.document",
|
|
155
|
-
"domain": [["id", "in", [self.source_document_id.id]]],
|
|
156
|
-
"res_id": self.source_document_id.id,
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
def unlink(self):
|
|
160
|
-
for subsequent_id in self:
|
|
161
|
-
if subsequent_id.operation_performed:
|
|
162
|
-
raise UserWarning(
|
|
163
|
-
"The document cannot be deleted: the "
|
|
164
|
-
"subsequent document has already been "
|
|
165
|
-
"generated."
|
|
166
|
-
)
|
|
167
|
-
return super().unlink()
|
|
168
|
-
|
|
169
|
-
def _confirms_document_generation(self):
|
|
170
|
-
"""We check if we can generate the subsequent document
|
|
171
|
-
:return: True: allowing generation
|
|
172
|
-
"""
|
|
173
|
-
result = False
|
|
174
|
-
|
|
175
|
-
if self.subsequent_operation_id.generation_situation in [
|
|
176
|
-
x for x, y in SITUACAO_SUBSEQUENTE
|
|
177
|
-
]:
|
|
178
|
-
coupon = self.source_document_id.filtered(
|
|
179
|
-
lambda document: document.document_type_id.code
|
|
180
|
-
in (
|
|
181
|
-
MODELO_FISCAL_CFE,
|
|
182
|
-
MODELO_FISCAL_NFCE,
|
|
183
|
-
MODELO_FISCAL_CUPOM_FISCAL_ECF,
|
|
184
|
-
)
|
|
185
|
-
)
|
|
186
|
-
if (
|
|
187
|
-
coupon
|
|
188
|
-
and self.subsequent_operation_id.generation_situation == "nota_de_cupom"
|
|
189
|
-
):
|
|
190
|
-
result = True
|
|
191
|
-
elif (
|
|
192
|
-
self.subsequent_operation_id.generation_situation == "manual"
|
|
193
|
-
and self.env.context.get("manual", False)
|
|
194
|
-
):
|
|
195
|
-
result = True
|
|
196
|
-
elif self.subsequent_operation_id.generation_situation == "nota_de_remessa":
|
|
197
|
-
result = True
|
|
198
|
-
elif (
|
|
199
|
-
self.source_document_id.state_edoc
|
|
200
|
-
== self.subsequent_operation_id.generation_situation
|
|
201
|
-
):
|
|
202
|
-
result = True
|
|
203
|
-
return result
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
# Copyright (C) 2020 KMEE
|
|
2
|
-
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
from odoo import fields, models
|
|
6
|
-
|
|
7
|
-
from ..constants.fiscal import SITUACAO_EDOC
|
|
8
|
-
|
|
9
|
-
SUBSEQUENT_CONDITION = [
|
|
10
|
-
("manual", "Manualmente"),
|
|
11
|
-
("nota_de_cupom", "Gerar Nota Fiscal de Cupons Fiscais"),
|
|
12
|
-
("nota_de_remessa", "Gerar Nota Fiscal de Remessa"),
|
|
13
|
-
]
|
|
14
|
-
|
|
15
|
-
SUBSEQUENT_OPERATION = SITUACAO_EDOC + SUBSEQUENT_CONDITION
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class SubsequentOperation(models.Model):
|
|
19
|
-
"""We must be aware that some subsequent operations do not generate
|
|
20
|
-
financial moves"""
|
|
21
|
-
|
|
22
|
-
_name = "l10n_br_fiscal.subsequent.operation"
|
|
23
|
-
_description = "Subsequent Operation"
|
|
24
|
-
_rec_name = "fiscal_operation_id"
|
|
25
|
-
_order = "sequence"
|
|
26
|
-
|
|
27
|
-
sequence = fields.Integer(
|
|
28
|
-
default=10,
|
|
29
|
-
help="Gives the sequence order when displaying a list",
|
|
30
|
-
)
|
|
31
|
-
fiscal_operation_id = fields.Many2one(
|
|
32
|
-
comodel_name="l10n_br_fiscal.operation",
|
|
33
|
-
string="Origin operation",
|
|
34
|
-
required=True,
|
|
35
|
-
ondelete="cascade",
|
|
36
|
-
)
|
|
37
|
-
subsequent_operation_id = fields.Many2one(
|
|
38
|
-
comodel_name="l10n_br_fiscal.operation",
|
|
39
|
-
string="Operation to be performed",
|
|
40
|
-
)
|
|
41
|
-
partner_id = fields.Many2one(comodel_name="res.partner", string="Partner")
|
|
42
|
-
generation_situation = fields.Selection(
|
|
43
|
-
selection=SUBSEQUENT_OPERATION,
|
|
44
|
-
required=True,
|
|
45
|
-
default="manual",
|
|
46
|
-
)
|
|
47
|
-
reference_document = fields.Boolean(
|
|
48
|
-
string="Referencing source document",
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
operation_document_type_id = fields.Many2one(
|
|
52
|
-
comodel_name="l10n_br_fiscal.document.type",
|
|
53
|
-
string="Document Type",
|
|
54
|
-
)
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# Copyright 2019 KMEE INFORMATICA LTDA
|
|
2
|
-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
3
|
-
|
|
4
|
-
from odoo import fields, models
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class UomUomAlternative(models.Model):
|
|
8
|
-
_name = "uom.uom.alternative"
|
|
9
|
-
_description = "Alternative UOM"
|
|
10
|
-
_rec_name = "code"
|
|
11
|
-
|
|
12
|
-
code = fields.Char()
|
|
13
|
-
|
|
14
|
-
uom_id = fields.Many2one(comodel_name="uom.uom")
|
|
15
|
-
|
|
16
|
-
_sql_constraints = [
|
|
17
|
-
(
|
|
18
|
-
"uom_alternative_unique",
|
|
19
|
-
"UNIQUE(code, uom_id)",
|
|
20
|
-
"You can note repeat the alternative name",
|
|
21
|
-
)
|
|
22
|
-
]
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
# @ 2020 KMEE - www.kmee.com.br
|
|
2
|
-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
|
3
|
-
|
|
4
|
-
from odoo.tests.common import TransactionCase
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class TestSubsequentOperation(TransactionCase):
|
|
8
|
-
def setUp(self):
|
|
9
|
-
super().setUp()
|
|
10
|
-
|
|
11
|
-
self.nfe_simples_faturamento = self.env.ref(
|
|
12
|
-
"l10n_br_fiscal.demo_nfe_so_simples_faturamento"
|
|
13
|
-
).copy()
|
|
14
|
-
|
|
15
|
-
self.so_simples_faturamento = self.env.ref(
|
|
16
|
-
"l10n_br_fiscal.so_simples_faturamento"
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
self.tax_icms_12 = self.env.ref("l10n_br_fiscal.tax_icms_12")
|
|
20
|
-
|
|
21
|
-
self.pis_tax_0 = self.env.ref("l10n_br_fiscal.tax_pis_0")
|
|
22
|
-
|
|
23
|
-
self.cofins_tax_0 = self.env.ref("l10n_br_fiscal.tax_cofins_0")
|
|
24
|
-
|
|
25
|
-
def test_subsequent_operation_simple_faturamento(self):
|
|
26
|
-
"""Test Fiscal Subsequent Operation Simples Faturamento"""
|
|
27
|
-
|
|
28
|
-
self.nfe_simples_faturamento._onchange_fiscal_operation_id()
|
|
29
|
-
self.nfe_simples_faturamento._onchange_document_serie_id()
|
|
30
|
-
|
|
31
|
-
for line in self.nfe_simples_faturamento.fiscal_line_ids:
|
|
32
|
-
line._onchange_product_id_fiscal()
|
|
33
|
-
line._onchange_fiscal_taxes()
|
|
34
|
-
|
|
35
|
-
self.nfe_simples_faturamento.state_edoc = "a_enviar"
|
|
36
|
-
self.nfe_simples_faturamento._generates_subsequent_operations()
|
|
37
|
-
|
|
38
|
-
subsequent_documents = self.nfe_simples_faturamento.document_subsequent_ids
|
|
39
|
-
|
|
40
|
-
for document in subsequent_documents:
|
|
41
|
-
self.assertTrue(
|
|
42
|
-
document.subsequent_document_id, "Subsequent document was not created"
|
|
43
|
-
)
|
|
44
|
-
|
|
45
|
-
# Subsequent Document operation
|
|
46
|
-
self.assertEqual(
|
|
47
|
-
document.subsequent_document_id.fiscal_operation_id.id,
|
|
48
|
-
self.so_simples_faturamento.subsequent_operation_id.id,
|
|
49
|
-
"Operation of the generated document is incorrect",
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
# Subsequent Lines
|
|
53
|
-
for product in document.subsequent_document_id.fiscal_line_ids:
|
|
54
|
-
# Document Line ICMS tax
|
|
55
|
-
self.assertEqual(
|
|
56
|
-
product.icms_tax_id.id,
|
|
57
|
-
self.tax_icms_12.id,
|
|
58
|
-
"ICMS tax value is not 12%",
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
# Document Line PIS tax
|
|
62
|
-
self.assertEqual(
|
|
63
|
-
product.pis_tax_id.id, self.pis_tax_0.id, "PIS tax value is not 0%"
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
# Document Line COFINS tax
|
|
67
|
-
self.assertEqual(
|
|
68
|
-
product.cofins_tax_id.id,
|
|
69
|
-
self.cofins_tax_0.id,
|
|
70
|
-
"COFINS tax value is not 0%",
|
|
71
|
-
)
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# Copyright (C) 2020 KMEE INFORMATICA LTDA
|
|
2
|
-
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
|
3
|
-
|
|
4
|
-
from odoo.tests.common import TransactionCase
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class TestUomUom(TransactionCase):
|
|
8
|
-
def setUp(self):
|
|
9
|
-
super().setUp()
|
|
10
|
-
self.uom_uom_kg = self.env.ref("uom.product_uom_kgm")
|
|
11
|
-
|
|
12
|
-
def test_uom_uom_alternative(self):
|
|
13
|
-
uom_uom_alternative = self.env["uom.uom.alternative"].create(
|
|
14
|
-
{"code": "kg", "uom_id": self.uom_uom_kg.id}
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
self.assertIn(uom_uom_alternative, self.uom_uom_kg.alternative_ids)
|
|
18
|
-
|
|
19
|
-
self.assertEqual(
|
|
20
|
-
self.env["uom.uom"].search([("code", "=", "KG")]),
|
|
21
|
-
self.env["uom.uom"].search([("code", "=", "kg")]),
|
|
22
|
-
)
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8" ?>
|
|
2
|
-
<odoo>
|
|
3
|
-
|
|
4
|
-
<record id="document_email_tree" model="ir.ui.view">
|
|
5
|
-
<field name="name">l10n_br_fiscal.document.email.tree</field>
|
|
6
|
-
<field name="model">l10n_br_fiscal.document.email</field>
|
|
7
|
-
<field name="arch" type="xml">
|
|
8
|
-
<tree>
|
|
9
|
-
<field name="name" />
|
|
10
|
-
<field name="document_type_id" />
|
|
11
|
-
<field name="issuer" />
|
|
12
|
-
<field name="state_edoc" />
|
|
13
|
-
<field name="email_template_id" />
|
|
14
|
-
</tree>
|
|
15
|
-
</field>
|
|
16
|
-
</record>
|
|
17
|
-
|
|
18
|
-
<record id="document_email_form" model="ir.ui.view">
|
|
19
|
-
<field name="name">l10n_br_fiscal.document.email.form</field>
|
|
20
|
-
<field name="model">l10n_br_fiscal.document.email</field>
|
|
21
|
-
<field name="arch" type="xml">
|
|
22
|
-
<form string="Fiscal Document Email">
|
|
23
|
-
<field name="id" invisible="1" />
|
|
24
|
-
<sheet>
|
|
25
|
-
<div class="oe_button_box" name="button_box">
|
|
26
|
-
|
|
27
|
-
<field name="active" invisible="1" />
|
|
28
|
-
<widget
|
|
29
|
-
name="web_ribbon"
|
|
30
|
-
title="Archived"
|
|
31
|
-
bg_color="bg-danger"
|
|
32
|
-
attrs="{'invisible': [('active', '=', True)]}"
|
|
33
|
-
/>
|
|
34
|
-
|
|
35
|
-
</div>
|
|
36
|
-
<group>
|
|
37
|
-
<field name="document_type_id" />
|
|
38
|
-
<field name="issuer" />
|
|
39
|
-
<field name="state_edoc" />
|
|
40
|
-
<field name="email_template_id" />
|
|
41
|
-
<field name="company_id" groups="base.group_multi_company" />
|
|
42
|
-
</group>
|
|
43
|
-
</sheet>
|
|
44
|
-
</form>
|
|
45
|
-
</field>
|
|
46
|
-
</record>
|
|
47
|
-
|
|
48
|
-
</odoo>
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" ?>
|
|
2
|
-
<!--
|
|
3
|
-
Copyright 2020 KMEE INFORMATICA LTDA
|
|
4
|
-
License AGPL-3 or later (http://www.gnu.org/licenses/agpl)
|
|
5
|
-
-->
|
|
6
|
-
<odoo>
|
|
7
|
-
<record model="ir.ui.view" id="subsequent_document_tree">
|
|
8
|
-
<field name="name">l10n_br_fiscal.subsequent.document.tree</field>
|
|
9
|
-
<field name="model">l10n_br_fiscal.subsequent.document</field>
|
|
10
|
-
<field name="arch" type="xml">
|
|
11
|
-
<tree create="false" edit="false" delete="false">
|
|
12
|
-
<field name="subsequent_document_id" />
|
|
13
|
-
<field name="subsequent_operation_id" />
|
|
14
|
-
<field name="fiscal_operation_id" invisible="True" />
|
|
15
|
-
<field name="operation_performed" />
|
|
16
|
-
<button
|
|
17
|
-
name="show_subsequent_document"
|
|
18
|
-
type="object"
|
|
19
|
-
string="Show Document"
|
|
20
|
-
attrs="{'invisible': [('subsequent_document_id', '=', False)]}"
|
|
21
|
-
/>
|
|
22
|
-
</tree>
|
|
23
|
-
</field>
|
|
24
|
-
</record>
|
|
25
|
-
<record model="ir.ui.view" id="source_document_tree">
|
|
26
|
-
<field name="name">source.document.tree</field>
|
|
27
|
-
<field name="model">l10n_br_fiscal.subsequent.document</field>
|
|
28
|
-
<field name="arch" type="xml">
|
|
29
|
-
<tree create="false" edit="false" delete="false">
|
|
30
|
-
<field name="source_document_id" />
|
|
31
|
-
<field name="subsequent_operation_id" string="Source Operation" />
|
|
32
|
-
<field name="fiscal_operation_id" invisible="True" />
|
|
33
|
-
<field name="operation_performed" />
|
|
34
|
-
<button
|
|
35
|
-
name="show_source_document"
|
|
36
|
-
type="object"
|
|
37
|
-
string="Show Document"
|
|
38
|
-
attrs="{'invisible': [('source_document_id', '=', False)]}"
|
|
39
|
-
/>
|
|
40
|
-
</tree>
|
|
41
|
-
</field>
|
|
42
|
-
</record>
|
|
43
|
-
</odoo>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8" ?>
|
|
2
|
-
<!-- Copyright 2020 KMEE INFORMATICA LTDA
|
|
3
|
-
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
|
4
|
-
<odoo>
|
|
5
|
-
|
|
6
|
-
<record model="ir.ui.view" id="subsequent_operation_tree">
|
|
7
|
-
<field name="name">l10n_br_fiscal.subsequent.operation.tree</field>
|
|
8
|
-
<field name="model">l10n_br_fiscal.subsequent.operation</field>
|
|
9
|
-
<field name="arch" type="xml">
|
|
10
|
-
<tree editable="bottom">
|
|
11
|
-
<field name="sequence" widget="handle" />
|
|
12
|
-
<field name="subsequent_operation_id" />
|
|
13
|
-
<field name="operation_document_type_id" />
|
|
14
|
-
<field name="partner_id" />
|
|
15
|
-
<field name="generation_situation" />
|
|
16
|
-
<field name="reference_document" />
|
|
17
|
-
</tree>
|
|
18
|
-
</field>
|
|
19
|
-
</record>
|
|
20
|
-
|
|
21
|
-
</odoo>
|