odoo-addon-l10n-br-fiscal-edi 15.0.1.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.
Files changed (42) hide show
  1. odoo/addons/l10n_br_fiscal_edi/README.rst +124 -0
  2. odoo/addons/l10n_br_fiscal_edi/__init__.py +2 -0
  3. odoo/addons/l10n_br_fiscal_edi/__manifest__.py +41 -0
  4. odoo/addons/l10n_br_fiscal_edi/i18n/l10n_br_fiscal_edi.pot +896 -0
  5. odoo/addons/l10n_br_fiscal_edi/models/__init__.py +4 -0
  6. odoo/addons/l10n_br_fiscal_edi/models/document.py +294 -0
  7. odoo/addons/l10n_br_fiscal_edi/models/document_event.py +392 -0
  8. odoo/addons/l10n_br_fiscal_edi/models/document_workflow.py +387 -0
  9. odoo/addons/l10n_br_fiscal_edi/models/invalidate_number.py +53 -0
  10. odoo/addons/l10n_br_fiscal_edi/readme/CONTRIBUTORS.md +5 -0
  11. odoo/addons/l10n_br_fiscal_edi/readme/DESCRIPTION.md +6 -0
  12. odoo/addons/l10n_br_fiscal_edi/readme/ROADMAP.md +6 -0
  13. odoo/addons/l10n_br_fiscal_edi/readme/USAGE.md +7 -0
  14. odoo/addons/l10n_br_fiscal_edi/security/ir.model.access.csv +7 -0
  15. odoo/addons/l10n_br_fiscal_edi/static/description/icon.png +0 -0
  16. odoo/addons/l10n_br_fiscal_edi/static/description/index.html +460 -0
  17. odoo/addons/l10n_br_fiscal_edi/tests/__init__.py +1 -0
  18. odoo/addons/l10n_br_fiscal_edi/tests/test_fiscal_document_generic.py +1191 -0
  19. odoo/addons/l10n_br_fiscal_edi/tests/test_tax_benefit.py +74 -0
  20. odoo/addons/l10n_br_fiscal_edi/tests/test_workflow.py +118 -0
  21. odoo/addons/l10n_br_fiscal_edi/views/document_event_report.xml +15 -0
  22. odoo/addons/l10n_br_fiscal_edi/views/document_event_template.xml +114 -0
  23. odoo/addons/l10n_br_fiscal_edi/views/document_event_view.xml +68 -0
  24. odoo/addons/l10n_br_fiscal_edi/views/document_view.xml +77 -0
  25. odoo/addons/l10n_br_fiscal_edi/views/invalidate_number_view.xml +19 -0
  26. odoo/addons/l10n_br_fiscal_edi/views/l10n_br_fiscal_action.xml +38 -0
  27. odoo/addons/l10n_br_fiscal_edi/views/l10n_br_fiscal_menu.xml +23 -0
  28. odoo/addons/l10n_br_fiscal_edi/wizards/__init__.py +7 -0
  29. odoo/addons/l10n_br_fiscal_edi/wizards/base_wizard_mixin.py +13 -0
  30. odoo/addons/l10n_br_fiscal_edi/wizards/document_cancel_wizard.py +20 -0
  31. odoo/addons/l10n_br_fiscal_edi/wizards/document_cancel_wizard.xml +30 -0
  32. odoo/addons/l10n_br_fiscal_edi/wizards/document_correction_wizard.py +17 -0
  33. odoo/addons/l10n_br_fiscal_edi/wizards/document_correction_wizard.xml +30 -0
  34. odoo/addons/l10n_br_fiscal_edi/wizards/document_import_wizard_mixin.py +132 -0
  35. odoo/addons/l10n_br_fiscal_edi/wizards/document_import_wizard_mixin.xml +44 -0
  36. odoo/addons/l10n_br_fiscal_edi/wizards/document_status_wizard.xml +58 -0
  37. odoo/addons/l10n_br_fiscal_edi/wizards/invalidate_number_wizard.py +33 -0
  38. odoo/addons/l10n_br_fiscal_edi/wizards/invalidate_number_wizard.xml +30 -0
  39. odoo_addon_l10n_br_fiscal_edi-15.0.1.0.0.2.dist-info/METADATA +141 -0
  40. odoo_addon_l10n_br_fiscal_edi-15.0.1.0.0.2.dist-info/RECORD +42 -0
  41. odoo_addon_l10n_br_fiscal_edi-15.0.1.0.0.2.dist-info/WHEEL +5 -0
  42. odoo_addon_l10n_br_fiscal_edi-15.0.1.0.0.2.dist-info/top_level.txt +1 -0
@@ -0,0 +1,74 @@
1
+ # Copyright 2023 Akretion - Renato Lima <renato.lima@akretion.com.br>
2
+ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3
+
4
+ from odoo.tests import SavepointCase
5
+
6
+ from ..constants.fiscal import SITUACAO_EDOC_A_ENVIAR
7
+
8
+
9
+ class TestTaxBenefit(SavepointCase):
10
+ def setUp(self):
11
+ super().setUp()
12
+ self.nfe_tax_benefit = self.env.ref("l10n_br_fiscal.demo_nfe_tax_benefit")
13
+ self.tax_benefit = self.env["l10n_br_fiscal.tax.definition"].create(
14
+ {
15
+ "icms_regulation_id": self.env.ref(
16
+ "l10n_br_fiscal.tax_icms_regulation"
17
+ ).id,
18
+ "tax_group_id": self.env.ref("l10n_br_fiscal.tax_group_icms").id,
19
+ "code": "SP810001",
20
+ "name": "TAX BENEFIT DEMO",
21
+ "description": "TAX BENEFIT DEMO",
22
+ "benefit_type": "1",
23
+ "is_benefit": True,
24
+ "is_taxed": True,
25
+ "is_debit_credit": True,
26
+ "custom_tax": True,
27
+ "tax_id": self.env.ref("l10n_br_fiscal.tax_icms_12_red_26_57").id,
28
+ "cst_id": self.env.ref("l10n_br_fiscal.cst_icms_20").id,
29
+ "state_from_id": self.env.ref("base.state_br_sp").id,
30
+ "state_to_ids": [(6, 0, self.env.ref("base.state_br_mg").ids)],
31
+ "ncms": "73269090",
32
+ "ncm_ids": [(6, 0, self.env.ref("l10n_br_fiscal.ncm_73269090").ids)],
33
+ "state": "approved",
34
+ }
35
+ )
36
+
37
+ def test_nfe_tax_benefit(self):
38
+ """Test NFe with tax benefit."""
39
+
40
+ self.nfe_tax_benefit._onchange_document_serie_id()
41
+ self.nfe_tax_benefit._onchange_fiscal_operation_id()
42
+
43
+ for line in self.nfe_tax_benefit.fiscal_line_ids:
44
+ line._onchange_product_id_fiscal()
45
+ line._onchange_commercial_quantity()
46
+ line._onchange_ncm_id()
47
+ line._onchange_fiscal_operation_id()
48
+ line._onchange_fiscal_operation_line_id()
49
+ line._onchange_fiscal_taxes()
50
+
51
+ self.assertEqual(
52
+ line.icms_tax_benefit_id,
53
+ self.tax_benefit,
54
+ "Document line must have tax benefit",
55
+ )
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)
@@ -0,0 +1,118 @@
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 import TransactionCase
5
+
6
+ from odoo.addons.l10n_br_fiscal.constants.fiscal import (
7
+ SITUACAO_EDOC_A_ENVIAR,
8
+ SITUACAO_EDOC_AUTORIZADA,
9
+ SITUACAO_EDOC_CANCELADA,
10
+ SITUACAO_EDOC_EM_DIGITACAO,
11
+ SITUACAO_EDOC_REJEITADA,
12
+ )
13
+
14
+
15
+ class TestWorkflow(TransactionCase):
16
+ @classmethod
17
+ def setUpClass(cls):
18
+ super().setUpClass()
19
+ cls.fiscal_document = cls.env["l10n_br_fiscal.document"].create(
20
+ {
21
+ "document_type_id": cls.env.ref(
22
+ "l10n_br_fiscal.document_55_serie_1"
23
+ ).id,
24
+ "fiscal_operation_type": "out",
25
+ }
26
+ )
27
+
28
+ def test_no_electronic_01_confirm(self):
29
+ self.fiscal_document.document_electronic = False
30
+ assert (
31
+ self.fiscal_document.state_edoc == SITUACAO_EDOC_EM_DIGITACAO
32
+ ), "Error with document workflow, state 'SITUACAO_EDOC_A_ENVIAR' "
33
+
34
+ self.fiscal_document.action_document_confirm()
35
+ assert (
36
+ self.fiscal_document.state_edoc == SITUACAO_EDOC_A_ENVIAR
37
+ ), "Error with document workflow, state 'SITUACAO_EDOC_A_ENVIAR' "
38
+
39
+ self.fiscal_document.action_document_send()
40
+ assert (
41
+ self.fiscal_document.state_edoc == SITUACAO_EDOC_AUTORIZADA
42
+ ), "Error with document workflow, state 'SITUACAO_EDOC_AUTORIZADA' "
43
+
44
+ def test_electronic_01_confirm(self):
45
+ self.fiscal_document.document_electronic = True
46
+
47
+ assert (
48
+ self.fiscal_document.state_edoc == SITUACAO_EDOC_EM_DIGITACAO
49
+ ), "Error with document workflow, state 'SITUACAO_EDOC_A_ENVIAR' "
50
+
51
+ self.fiscal_document.action_document_confirm()
52
+ assert (
53
+ self.fiscal_document.state_edoc == SITUACAO_EDOC_A_ENVIAR
54
+ ), "Error with document workflow, state 'SITUACAO_EDOC_A_ENVIAR' "
55
+
56
+ self.fiscal_document.action_document_send()
57
+ assert (
58
+ self.fiscal_document.state_edoc == SITUACAO_EDOC_AUTORIZADA
59
+ ), "Error with document workflow, state 'SITUACAO_EDOC_AUTORIZADA' "
60
+
61
+ def test_electronic_01_rejeitada(self):
62
+ self.fiscal_document.document_electronic = True
63
+
64
+ assert (
65
+ self.fiscal_document.state_edoc == SITUACAO_EDOC_EM_DIGITACAO
66
+ ), "Error with document workflow, state 'SITUACAO_EDOC_A_ENVIAR' "
67
+
68
+ self.fiscal_document.action_document_confirm()
69
+ self.fiscal_document._change_state(SITUACAO_EDOC_REJEITADA)
70
+
71
+ assert (
72
+ self.fiscal_document.state_edoc == SITUACAO_EDOC_REJEITADA
73
+ ), "Error with document workflow, state 'SITUACAO_EDOC_REJEITADA' "
74
+
75
+ self.fiscal_document.action_document_send()
76
+ assert (
77
+ self.fiscal_document.state_edoc == SITUACAO_EDOC_AUTORIZADA
78
+ ), "Error with document workflow, state 'SITUACAO_EDOC_AUTORIZADA' "
79
+
80
+ def test_no_electronic_01_draft_cancel(self):
81
+ self.fiscal_document.document_electronic = False
82
+
83
+ assert (
84
+ self.fiscal_document.state_edoc == SITUACAO_EDOC_EM_DIGITACAO
85
+ ), "Error with document workflow, state 'SITUACAO_EDOC_A_ENVIAR' "
86
+
87
+ self.fiscal_document._document_cancel("Test")
88
+
89
+ assert (
90
+ self.fiscal_document.state_edoc == SITUACAO_EDOC_CANCELADA
91
+ ), "Error with document workflow, state 'SITUACAO_EDOC_REJEITADA' "
92
+
93
+ def test_electronic_01_draft_cancel(self):
94
+ self.fiscal_document.document_electronic = True
95
+
96
+ assert (
97
+ self.fiscal_document.state_edoc == SITUACAO_EDOC_EM_DIGITACAO
98
+ ), "Error with document workflow, state 'SITUACAO_EDOC_A_ENVIAR' "
99
+
100
+ self.fiscal_document._document_cancel("Test")
101
+
102
+ assert (
103
+ self.fiscal_document.state_edoc == SITUACAO_EDOC_CANCELADA
104
+ ), "Error with document workflow, state 'SITUACAO_EDOC_REJEITADA' "
105
+
106
+ def test_electronic_01_back2draft(self):
107
+ self.fiscal_document.document_electronic = True
108
+
109
+ assert (
110
+ self.fiscal_document.state_edoc == SITUACAO_EDOC_EM_DIGITACAO
111
+ ), "Error with document workflow, state 'SITUACAO_EDOC_A_ENVIAR' "
112
+
113
+ self.fiscal_document.action_document_confirm()
114
+ self.fiscal_document.action_document_back2draft()
115
+
116
+ assert (
117
+ self.fiscal_document.state_edoc == SITUACAO_EDOC_EM_DIGITACAO
118
+ ), "Error with document workflow, state 'SITUACAO_EDOC_A_ENVIAR' "
@@ -0,0 +1,15 @@
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <odoo>
3
+ <record id="action_report_document_event" model="ir.actions.report">
4
+ <field name="name">Document Event</field>
5
+ <field name="model">l10n_br_fiscal.event</field>
6
+ <field name="report_type">qweb-pdf</field>
7
+ <field name="report_name">l10n_br_fiscal.main_report_document_event</field>
8
+ <field name="report_file">l10n_br_fiscal.report_document_event</field>
9
+ <field
10
+ name="print_report_name"
11
+ >dict(object.fields_get(allfields=['type'])['type']['selection'])[object.type]</field>
12
+ <field name="binding_model_id" ref="model_l10n_br_fiscal_event" />
13
+ <field name="binding_type">report</field>
14
+ </record>
15
+ </odoo>
@@ -0,0 +1,114 @@
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <odoo>
3
+ <template id="report_document_event">
4
+ <t t-set="o" t-value="doc" />
5
+ <t t-set="o" t-value="o.with_context(lang=o.document_id.partner_id.lang)" />
6
+ <div class="page" style="font-size:16px;">
7
+ <style type="text/css">
8
+ .col-1,
9
+ .col-2,
10
+ .col-3,
11
+ .col-4,
12
+ .col-5,
13
+ .col-6,
14
+ .col-7,
15
+ .col-8,
16
+ .col-9,
17
+ .col-10,
18
+ .col-11,
19
+ .col-12 {
20
+ padding: 5px 5px 5px 5px;
21
+ }
22
+ .bt {
23
+ border-top: 1px solid black;
24
+ }
25
+ .bb {
26
+ border-bottom: 1px solid black;
27
+ }
28
+ .bl {
29
+ border-left: 1px solid black;
30
+ }
31
+ .br {
32
+ border-right: 1px solid black;
33
+ }
34
+ row {
35
+ cols: 10;
36
+ }
37
+ </style>
38
+
39
+ <div class="oe_structure" />
40
+
41
+ <div id="header" class="row bt bb bl br">
42
+ <div class="col-12" style="text-align: center; font-size: 36px;">
43
+ <span t-field="o.type" />
44
+ </div>
45
+ </div>
46
+ <div class="row bb bl br">
47
+ <div id="document_key" class="col-6">
48
+ <strong style="font-size:18px;">Document Key:</strong>
49
+ <p t-field="o.document_id.document_key" />
50
+ </div>
51
+ <div id="company_cnpj_cpf" class="col-6 bl">
52
+ <strong style="font-size:18px;">CNPJ:</strong>
53
+ <p t-field="o.document_id.company_cnpj_cpf" />
54
+ </div>
55
+ </div>
56
+ <div class="row bb bl br">
57
+ <div id="document_number" class="col-3">
58
+ <strong style="font-size:18px;">Document Number:</strong>
59
+ <p t-field="o.document_number" />
60
+ </div>
61
+ <div id="document_serie_code" class="col-3 bl">
62
+ <strong style="font-size:18px;">Document Serie:</strong>
63
+ <p t-field="o.document_serie_id.code" />
64
+ </div>
65
+ <div id="environment" class="col-6 bl">
66
+ <strong style="font-size:18px;">Environment:</strong>
67
+ <p t-field="o.environment" />
68
+ </div>
69
+ </div>
70
+ <div class="row bb bl br">
71
+ <div id="protocol_number" class="col-6">
72
+ <strong style="font-size:18px;">Protocol Number:</strong>
73
+ <p t-field="o.protocol_number" />
74
+ </div>
75
+ <div id="protocol_date" class="col-6 bl">
76
+ <strong style="font-size:18px;">Protocol Date:</strong>
77
+ <p t-field="o.protocol_date" />
78
+ </div>
79
+ </div>
80
+ <div id="justification" class="row bb bl br">
81
+ <div class="col-12" t-if="o.justification">
82
+ <strong style="font-size:18px;">Justification:</strong>
83
+ <p t-field="o.justification" />
84
+ </div>
85
+ </div>
86
+ <div id="cce_notes" class="row bb bl br">
87
+ <div class="col-12" style="font-size:10px;" t-if="o.type == '14'">
88
+ A Carta de Correção é disciplinada pelo parágrafo 1o-A do artigo 7o do Convênio S/N, de 15 de dezembro de 1970 e pode ser utilizada para regularização de erro ocorrido na emissão de documento fiscal, desde que o erro não seja relacionado com:<br
89
+ />
90
+ <br />
91
+ I - as variáveis que determinam o valor do imposto tais como: base de cálculo, alíquota, diferença de preço, quantidade, valor da operação ou da prestação;<br
92
+ />
93
+ II - a correção de dados cadastrais que impliquem mudança do remetente ou do destinatário;<br
94
+ />
95
+ III - a data de emissão ou de saída.<br />
96
+ </div>
97
+ </div>
98
+ </div>
99
+ </template>
100
+
101
+ <template id="main_report_document_event">
102
+ <t t-call="web.html_container">
103
+ <div class="article">
104
+ <t t-foreach="docs" t-as="doc">
105
+ <t
106
+ t-call="l10n_br_fiscal.report_document_event"
107
+ t-lang="doc.document_id.partner_id.lang"
108
+ />
109
+ </t>
110
+ </div>
111
+ </t>
112
+ </template>
113
+
114
+ </odoo>
@@ -0,0 +1,68 @@
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <odoo>
3
+
4
+ <record id="event_search" model="ir.ui.view">
5
+ <field name="name">l10n_br_fiscal.event.search</field>
6
+ <field name="model">l10n_br_fiscal.event</field>
7
+ <field name="arch" type="xml">
8
+ <search string="Fiscal Document Event">
9
+ <field name="origin" />
10
+ </search>
11
+ </field>
12
+ </record>
13
+
14
+ <record id="event_tree" model="ir.ui.view">
15
+ <field name="name">l10n_br_fiscal.event.tree</field>
16
+ <field name="model">l10n_br_fiscal.event</field>
17
+ <field name="arch" type="xml">
18
+ <tree edit="false" create="false">
19
+ <field name="type" />
20
+ <field name="company_id" />
21
+ <field name="response" />
22
+ <field name="origin" />
23
+ <field name="write_date" />
24
+ <field name="protocol_date" />
25
+ <field name="status_code" />
26
+ <field name="message" />
27
+ <field name="state" />
28
+ </tree>
29
+ </field>
30
+ </record>
31
+
32
+ <record id="event_form" model="ir.ui.view">
33
+ <field name="name">l10n_br_fiscal.event.form</field>
34
+ <field name="model">l10n_br_fiscal.event</field>
35
+ <field name="arch" type="xml">
36
+ <form string="Eventos Eletronicos" edit="false" create="false">
37
+ <header>
38
+ <field name="state" widget="statusbar" />
39
+ </header>
40
+ <sheet>
41
+ <group>
42
+ <field name="type" />
43
+ <field name="company_id" />
44
+ <field name="document_id" />
45
+ <field name="document_type_id" />
46
+ <field name="invalidate_number_id" />
47
+ <field name="sequence" />
48
+ <field name="justification" />
49
+ <field name="partner_id" />
50
+ <field name="file_request_id" />
51
+ <field name="file_response_id" />
52
+ <field name="protocol_number" />
53
+ <field name="lot_receipt_number" />
54
+ <field name="response" />
55
+ <field name="origin" />
56
+ <field name="write_date" />
57
+ <field name="file_path" />
58
+ <field name="protocol_date" />
59
+ <field name="status_code" />
60
+ <field name="message" />
61
+ <field name="state" />
62
+ </group>
63
+ </sheet>
64
+ </form>
65
+ </field>
66
+ </record>
67
+
68
+ </odoo>
@@ -0,0 +1,77 @@
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <odoo>
3
+
4
+ <record id="document_form" model="ir.ui.view">
5
+ <field name="name">l10n_br_fiscal_edi.document.form</field>
6
+ <field name="model">l10n_br_fiscal.document</field>
7
+ <field name="priority">5</field>
8
+ <field name="inherit_id" ref="l10n_br_fiscal.document_form" />
9
+ <field name="arch" type="xml">
10
+ <xpath expr="//page[@name='delivery']" position="after">
11
+ <page name="others" string="EDI">
12
+ <group>
13
+ <field name="operation_name" />
14
+ <field
15
+ name="status_description"
16
+ attrs="{'invisible': [('document_electronic', '=', '0')]}"
17
+ />
18
+ </group>
19
+ <group>
20
+ <group name="authorization" string="Authorization" colspan="4">
21
+ <field name="authorization_event_id" />
22
+ <field name="authorization_date" />
23
+ <field name="authorization_protocol" />
24
+ <field name="send_file_id" />
25
+ <field name="authorization_file_id" />
26
+ <field name="file_report_id" />
27
+ </group>
28
+ <group
29
+ name="cancel"
30
+ string="Cancellation"
31
+ colspan="4"
32
+ attrs="{'invisible': [('state_edoc', '!=', 'cancelada')]}"
33
+ >
34
+ <field name="cancel_event_id" />
35
+ <field name="cancel_date" />
36
+ <field name="cancel_protocol_number" />
37
+ <field name="cancel_reason" />
38
+ <field name="cancel_file_id" />
39
+ </group>
40
+ <group
41
+ name="corrections"
42
+ string="Corrections"
43
+ colspan="4"
44
+ attrs="{'invisible': [('correction_event_ids', '=', [])]}"
45
+ >
46
+ <field name="correction_event_ids" nolabel="1">
47
+ <tree>
48
+ <field name="id" />
49
+ <field name="justification" />
50
+ <field name="create_date" />
51
+ <field name="state" />
52
+ <button
53
+ name="print_document_event"
54
+ icon="fa-print"
55
+ type="object"
56
+ />
57
+ </tree>
58
+ </field>
59
+ </group>
60
+ <group name="events" string="Events and Services" colspan="4">
61
+ <field name="event_ids" nolabel="1">
62
+ <tree>
63
+ <field name="id" />
64
+ <field name="type" />
65
+ <field name="origin" />
66
+ <field name="create_date" />
67
+ <field name="state" />
68
+ </tree>
69
+ </field>
70
+ </group>
71
+ </group>
72
+ </page>
73
+ </xpath>
74
+ </field>
75
+ </record>
76
+
77
+ </odoo>
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <odoo>
3
+
4
+ <record id="invalidate_number_form" model="ir.ui.view">
5
+ <field name="name">l10n_br_fiscal_edi.invalidate.number.form</field>
6
+ <field name="model">l10n_br_fiscal.invalidate.number</field>
7
+ <field name="inherit_id" ref="l10n_br_fiscal.invalidate_number_form" />
8
+ <field name="arch" type="xml">
9
+ <xpath expr="//group[@name='invalidation']" position="after">
10
+ <notebook>
11
+ <page string="Events">
12
+ <field name="event_ids" />
13
+ </page>
14
+ </notebook>
15
+ </xpath>
16
+ </field>
17
+ </record>
18
+
19
+ </odoo>
@@ -0,0 +1,38 @@
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <odoo>
3
+
4
+ <!-- Document Event -->
5
+ <record id="event_action" model="ir.actions.act_window">
6
+ <field name="name">Fiscal Event</field>
7
+ <field name="type">ir.actions.act_window</field>
8
+ <field name="res_model">l10n_br_fiscal.event</field>
9
+ <field name="view_mode">kanban,tree,form</field>
10
+ <field name="search_view_id" ref="event_search" />
11
+ <field name="view_id" ref="event_tree" />
12
+ <field name="help" type="html">
13
+ <p class="o_view_nocontent_smiling_face">
14
+ Create a new Event
15
+ </p><p>
16
+ Odoo helps you easily track all activities
17
+ related to a fiscal operation.
18
+ </p>
19
+ </field>
20
+ </record>
21
+
22
+ <!-- Invalidate Number -->
23
+ <record id="invalidate_number_action" model="ir.actions.act_window">
24
+ <field name="name">Invalidate Number</field>
25
+ <field name="type">ir.actions.act_window</field>
26
+ <field name="res_model">l10n_br_fiscal.invalidate.number</field>
27
+ <field name="view_mode">tree,form</field>
28
+ <field name="help" type="html">
29
+ <p class="o_view_nocontent_smiling_face">
30
+ Create a new Invalidation
31
+ </p><p>
32
+ Odoo helps you easily track all activities
33
+ related to a fiscal operation.
34
+ </p>
35
+ </field>
36
+ </record>
37
+
38
+ </odoo>
@@ -0,0 +1,23 @@
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <odoo>
3
+
4
+ <!-- Invalidate Number -->
5
+ <menuitem
6
+ id="invalidate_number_menu"
7
+ action="invalidate_number_action"
8
+ name="Invalidate Number"
9
+ parent="l10n_br_fiscal.document_sub_menu"
10
+ sequence="40"
11
+ />
12
+
13
+ <!-- Fiscal Events -->
14
+ <menuitem
15
+ id="event_menu"
16
+ action="event_action"
17
+ name="Fiscal Event"
18
+ groups="l10n_br_fiscal.group_user,l10n_br_fiscal.group_manager"
19
+ parent="l10n_br_fiscal.document_sub_menu"
20
+ sequence="50"
21
+ />
22
+
23
+ </odoo>
@@ -0,0 +1,7 @@
1
+ # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
2
+
3
+ from . import base_wizard_mixin
4
+ from . import document_cancel_wizard
5
+ from . import document_correction_wizard
6
+ from . import invalidate_number_wizard
7
+ from . import document_import_wizard_mixin
@@ -0,0 +1,13 @@
1
+ # Copyright (C) 2020 Renato Lima - Akretion <renato.lima@akretion.com.br>
2
+ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3
+
4
+ from odoo import fields, models
5
+
6
+
7
+ class BaseWizardMixin(models.TransientModel):
8
+ _inherit = "l10n_br_fiscal.base.wizard.mixin"
9
+
10
+ event_id = fields.Many2one(
11
+ comodel_name="l10n_br_fiscal.event",
12
+ string="Fiscal Event",
13
+ )
@@ -0,0 +1,20 @@
1
+ # Copyright 2019 KMEE
2
+ # Copyright (C) 2020 Renato Lima - Akretion <renato.lima@akretion.com.br>
3
+ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
4
+
5
+ from odoo import models
6
+
7
+
8
+ class DocumentCancelWizard(models.TransientModel):
9
+ _name = "l10n_br_fiscal.document.cancel.wizard"
10
+ _description = "Fiscal Document Cancel Wizard"
11
+ _inherit = "l10n_br_fiscal.base.wizard.mixin"
12
+
13
+ def do_cancel(self):
14
+ self.document_id._document_cancel(self.justification)
15
+
16
+ def doit(self):
17
+ for wizard in self:
18
+ if wizard.document_id:
19
+ wizard.do_cancel()
20
+ self._close()
@@ -0,0 +1,30 @@
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <!-- Copyright 2019 KMEE
3
+ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
4
+ <odoo>
5
+
6
+ <record id="document_cancel_wizard_form" model="ir.ui.view">
7
+ <field name="name">l10n_br_fiscal.document.cancel.wizard</field>
8
+ <field name="model">l10n_br_fiscal.document.cancel.wizard</field>
9
+ <field name="arch" type="xml">
10
+ <form string="Cancelamento de documento fiscal">
11
+ <group>
12
+ <field name="justification" />
13
+ </group>
14
+ <footer>
15
+ <button name="doit" string="OK" class="btn-primary" type="object" />
16
+ <button string="Cancel" class="btn-default" special="cancel" />
17
+ </footer>
18
+ </form>
19
+ </field>
20
+ </record>
21
+
22
+ <record id="document_cancel_wizard_action" model="ir.actions.act_window">
23
+ <field name="name">Cancelamento de documento fiscal</field>
24
+ <field name="res_model">l10n_br_fiscal.document.cancel.wizard</field>
25
+ <field name="view_mode">form</field>
26
+ <field name="context">{}</field>
27
+ <field name="target">new</field>
28
+ </record>
29
+
30
+ </odoo>
@@ -0,0 +1,17 @@
1
+ # Copyright 2019 KMEE
2
+ # Copyright (C) 2020 Renato Lima - Akretion <renato.lima@akretion.com.br>
3
+ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
4
+
5
+ from odoo import models
6
+
7
+
8
+ class DocumentCorrectionWizard(models.TransientModel):
9
+ _name = "l10n_br_fiscal.document.correction.wizard"
10
+ _description = "Fiscal Document Correction Wizard"
11
+ _inherit = "l10n_br_fiscal.base.wizard.mixin"
12
+
13
+ def doit(self):
14
+ for wizard in self:
15
+ if wizard.document_id:
16
+ wizard.document_id._document_correction(wizard.justification)
17
+ self._close()