odoo-addon-l10n-br-fiscal 16.0.7.0.0.3__py3-none-any.whl → 16.0.8.0.0.2__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.

Files changed (24) hide show
  1. odoo/addons/l10n_br_fiscal/README.rst +1 -1
  2. odoo/addons/l10n_br_fiscal/__manifest__.py +1 -4
  3. odoo/addons/l10n_br_fiscal/i18n/l10n_br_fiscal.pot +74 -144
  4. odoo/addons/l10n_br_fiscal/models/__init__.py +0 -2
  5. odoo/addons/l10n_br_fiscal/models/document.py +14 -85
  6. odoo/addons/l10n_br_fiscal/models/document_mixin_methods.py +1 -21
  7. odoo/addons/l10n_br_fiscal/models/operation.py +1 -12
  8. odoo/addons/l10n_br_fiscal/security/ir.model.access.csv +0 -4
  9. odoo/addons/l10n_br_fiscal/static/description/index.html +1 -1
  10. odoo/addons/l10n_br_fiscal/tests/__init__.py +0 -1
  11. odoo/addons/l10n_br_fiscal/views/document_view.xml +0 -18
  12. odoo/addons/l10n_br_fiscal/views/l10n_br_fiscal_action.xml +0 -32
  13. odoo/addons/l10n_br_fiscal/views/l10n_br_fiscal_menu.xml +0 -18
  14. odoo/addons/l10n_br_fiscal/views/operation_view.xml +0 -7
  15. {odoo_addon_l10n_br_fiscal-16.0.7.0.0.3.dist-info → odoo_addon_l10n_br_fiscal-16.0.8.0.0.2.dist-info}/METADATA +3 -2
  16. {odoo_addon_l10n_br_fiscal-16.0.7.0.0.3.dist-info → odoo_addon_l10n_br_fiscal-16.0.8.0.0.2.dist-info}/RECORD +18 -24
  17. odoo/addons/l10n_br_fiscal/demo/subsequent_operation_demo.xml +0 -10
  18. odoo/addons/l10n_br_fiscal/models/subsequent_document.py +0 -203
  19. odoo/addons/l10n_br_fiscal/models/subsequent_operation.py +0 -54
  20. odoo/addons/l10n_br_fiscal/tests/test_subsequent_operation.py +0 -70
  21. odoo/addons/l10n_br_fiscal/views/subsequent_document_view.xml +0 -43
  22. odoo/addons/l10n_br_fiscal/views/subsequent_operation_view.xml +0 -21
  23. {odoo_addon_l10n_br_fiscal-16.0.7.0.0.3.dist-info → odoo_addon_l10n_br_fiscal-16.0.8.0.0.2.dist-info}/WHEEL +0 -0
  24. {odoo_addon_l10n_br_fiscal-16.0.7.0.0.3.dist-info → odoo_addon_l10n_br_fiscal-16.0.8.0.0.2.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,70 +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
-
30
- for line in self.nfe_simples_faturamento.fiscal_line_ids:
31
- line._onchange_product_id_fiscal()
32
- line._onchange_fiscal_taxes()
33
-
34
- self.nfe_simples_faturamento.state_edoc = "a_enviar"
35
- self.nfe_simples_faturamento._generates_subsequent_operations()
36
-
37
- subsequent_documents = self.nfe_simples_faturamento.document_subsequent_ids
38
-
39
- for document in subsequent_documents:
40
- self.assertTrue(
41
- document.subsequent_document_id, "Subsequent document was not created"
42
- )
43
-
44
- # Subsequent Document operation
45
- self.assertEqual(
46
- document.subsequent_document_id.fiscal_operation_id.id,
47
- self.so_simples_faturamento.subsequent_operation_id.id,
48
- "Operation of the generated document is incorrect",
49
- )
50
-
51
- # Subsequent Lines
52
- for product in document.subsequent_document_id.fiscal_line_ids:
53
- # Document Line ICMS tax
54
- self.assertEqual(
55
- product.icms_tax_id.id,
56
- self.tax_icms_12.id,
57
- "ICMS tax value is not 12%",
58
- )
59
-
60
- # Document Line PIS tax
61
- self.assertEqual(
62
- product.pis_tax_id.id, self.pis_tax_0.id, "PIS tax value is not 0%"
63
- )
64
-
65
- # Document Line COFINS tax
66
- self.assertEqual(
67
- product.cofins_tax_id.id,
68
- self.cofins_tax_0.id,
69
- "COFINS tax value is not 0%",
70
- )
@@ -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>