odoo-addon-l10n-br-fiscal-edi 16.0.1.5.1.1__py3-none-any.whl → 16.0.1.5.3__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.
@@ -11,7 +11,7 @@ Common EDI fiscal features
11
11
  !! This file is generated by oca-gen-addon-readme !!
12
12
  !! changes will be overwritten. !!
13
13
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
14
- !! source digest: sha256:726b520c38c5c0483bbe86174f1ebe9956805e3ed2b3beaa06651354c8e27767
14
+ !! source digest: sha256:92732823cfc88d315f27dfbc57eb35ff3f13f3229c9ea8b943383aa89109d1e0
15
15
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
16
16
 
17
17
  .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -9,7 +9,7 @@
9
9
  "maintainers": ["renatonlima", "rvalyi", "mileo"],
10
10
  "website": "https://github.com/OCA/l10n-brazil",
11
11
  "development_status": "Beta",
12
- "version": "16.0.1.5.1",
12
+ "version": "16.0.1.5.3",
13
13
  "depends": [
14
14
  "l10n_br_fiscal",
15
15
  ],
@@ -372,7 +372,7 @@ ul.auto-toc {
372
372
  !! This file is generated by oca-gen-addon-readme !!
373
373
  !! changes will be overwritten. !!
374
374
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
375
- !! source digest: sha256:726b520c38c5c0483bbe86174f1ebe9956805e3ed2b3beaa06651354c8e27767
375
+ !! source digest: sha256:92732823cfc88d315f27dfbc57eb35ff3f13f3229c9ea8b943383aa89109d1e0
376
376
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
377
377
  <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-brazil/tree/16.0/l10n_br_fiscal_edi"><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_edi"><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&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
378
378
  <p>Este módulo estende o módulo <tt class="docutils literal">l10n_br_fiscal</tt> e cuida da parte de EDI
@@ -16,6 +16,7 @@ class TestWorkflow(TransactionCase):
16
16
  @classmethod
17
17
  def setUpClass(cls):
18
18
  super().setUpClass()
19
+ cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
19
20
  cls.fiscal_document = cls.env["l10n_br_fiscal.document"].create(
20
21
  {
21
22
  "document_type_id": cls.env.ref(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: odoo-addon-l10n_br_fiscal_edi
3
- Version: 16.0.1.5.1.1
3
+ Version: 16.0.1.5.3
4
4
  Requires-Python: >=3.10
5
5
  Requires-Dist: odoo-addon-l10n_br_fiscal>=16.0dev,<16.1dev
6
6
  Requires-Dist: odoo>=16.0a,<16.1dev
@@ -29,7 +29,7 @@ Common EDI fiscal features
29
29
  !! This file is generated by oca-gen-addon-readme !!
30
30
  !! changes will be overwritten. !!
31
31
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
32
- !! source digest: sha256:726b520c38c5c0483bbe86174f1ebe9956805e3ed2b3beaa06651354c8e27767
32
+ !! source digest: sha256:92732823cfc88d315f27dfbc57eb35ff3f13f3229c9ea8b943383aa89109d1e0
33
33
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
34
34
 
35
35
  .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -1,6 +1,6 @@
1
- odoo/addons/l10n_br_fiscal_edi/README.rst,sha256=ogm2fwcmoXlvcsL42Gu4187u-vqs0RfbqikA9qO1yRs,5009
1
+ odoo/addons/l10n_br_fiscal_edi/README.rst,sha256=byPO4lmLZWZ-hZdIvcegbtU0zUEexuiv94rhMTl9ghU,5009
2
2
  odoo/addons/l10n_br_fiscal_edi/__init__.py,sha256=0XNpxETgFdVxFDEw03O8oL3NtTSk3we-HEZW2sPKzIU,43
3
- odoo/addons/l10n_br_fiscal_edi/__manifest__.py,sha256=6FcfN6rUBnXYQedKsG6PlzBdWBfvrFla5axfQQFYz-U,1244
3
+ odoo/addons/l10n_br_fiscal_edi/__manifest__.py,sha256=8cBVcwa8ZjzsKBaAo78bf-5IIYVTHrkYPlp5I2pYcyY,1244
4
4
  odoo/addons/l10n_br_fiscal_edi/i18n/l10n_br_fiscal_edi.pot,sha256=ddMjyyTOwE9jb9rOgLNR6yXtEssN49x24UtsFZrgMB8,38421
5
5
  odoo/addons/l10n_br_fiscal_edi/models/__init__.py,sha256=Zz-kP7XRE72a4jf5pfkNr_MHaaHJx9V5WEdQZGuncGg,116
6
6
  odoo/addons/l10n_br_fiscal_edi/models/document.py,sha256=XrGyV3o1-y82iAHxTIeZ-1DUYkmsUf-cU8vD3ftpASw,8802
@@ -13,11 +13,9 @@ odoo/addons/l10n_br_fiscal_edi/readme/ROADMAP.md,sha256=m63hi9coIwXI0oDmvu6XmdEo
13
13
  odoo/addons/l10n_br_fiscal_edi/readme/USAGE.md,sha256=2UZfDrf29LJ8y6c17XzwNOvi5JEpcfxNi_pKjpKbJPg,447
14
14
  odoo/addons/l10n_br_fiscal_edi/security/ir.model.access.csv,sha256=0PgIE8SotB9ZWx7s2-JlAO5y1It10wcHrJZOlbkC7EM,1175
15
15
  odoo/addons/l10n_br_fiscal_edi/static/description/icon.png,sha256=6xBPJauaFOF0KDHfHgQopSc28kKvxMaeoQFQWZtfZDo,9455
16
- odoo/addons/l10n_br_fiscal_edi/static/description/index.html,sha256=SFAgv-_vJwrdqJrhqEKCNOw4T99OrNwTwHMiERnGQKw,15387
16
+ odoo/addons/l10n_br_fiscal_edi/static/description/index.html,sha256=Nr-TBvQfsfOen1A8-P-wMW4XK6ZpQLFTYyDbHERvTU8,15387
17
17
  odoo/addons/l10n_br_fiscal_edi/tests/__init__.py,sha256=4Q04RgcX7CPzogoxW39Muu0BAMmpfaRZKp67SpjYOBU,28
18
- odoo/addons/l10n_br_fiscal_edi/tests/test_fiscal_document_generic.py,sha256=rOFTa8P8mO5d25E0pos4srlFcvzpYTLpJCTWvrJ3JBg,43226
19
- odoo/addons/l10n_br_fiscal_edi/tests/test_tax_benefit.py,sha256=gEwHr3jTkQzSE8dFY9hpgOVtBuMIycuwa4Poixiecdc,2754
20
- odoo/addons/l10n_br_fiscal_edi/tests/test_workflow.py,sha256=x9R7em-prpncCphy4xsBafOzsRniZpKqnI0i1ZRD6gU,4476
18
+ odoo/addons/l10n_br_fiscal_edi/tests/test_workflow.py,sha256=S35Cqec8i9Ucthf8a6JOJ6HBhzwOyzXB7MuZdUUrcE0,4556
21
19
  odoo/addons/l10n_br_fiscal_edi/views/document_event_report.xml,sha256=72eMAfCeToJ89C5w33RlUO8Hz1t3gMR8Qfg5Aah8r5Y,743
22
20
  odoo/addons/l10n_br_fiscal_edi/views/document_event_template.xml,sha256=4IO4RXdGE0wOCv4P7hfYioCwDMJEf_jBZdJY4edvLLY,4059
23
21
  odoo/addons/l10n_br_fiscal_edi/views/document_event_view.xml,sha256=qIgWNvmidGjGZvrNTtOxZzYkvNHI0PbFQqdREFvjDeU,2712
@@ -36,7 +34,7 @@ odoo/addons/l10n_br_fiscal_edi/wizards/document_import_wizard_mixin.xml,sha256=h
36
34
  odoo/addons/l10n_br_fiscal_edi/wizards/document_status_wizard.xml,sha256=S9hSkgbBKCt78bTe3sRupfnIcmZZ8KWhaZ9q_PKYvgc,2483
37
35
  odoo/addons/l10n_br_fiscal_edi/wizards/invalidate_number_wizard.py,sha256=o9eXRV-iWUsgsozBzM193C4J_8aurGl1aIICdYthpXA,1328
38
36
  odoo/addons/l10n_br_fiscal_edi/wizards/invalidate_number_wizard.xml,sha256=H0JzzzbJmWziLZjZ8acQsqJcgsaYD3M6I3OydoNFuUc,1215
39
- odoo_addon_l10n_br_fiscal_edi-16.0.1.5.1.1.dist-info/METADATA,sha256=bWY-ttpRh_HB59PXmTaVjbV8pfcAt7kiWSzDSG19lcw,5672
40
- odoo_addon_l10n_br_fiscal_edi-16.0.1.5.1.1.dist-info/WHEEL,sha256=9fEMia4zL7ZuZbnCOrcYogUhmn4XFIVaJ8G4YGI31xc,81
41
- odoo_addon_l10n_br_fiscal_edi-16.0.1.5.1.1.dist-info/top_level.txt,sha256=QE6RBQ0QX5f4eFuUcGgU5Kbq1A_qJcDs-e_vpr6pmfU,4
42
- odoo_addon_l10n_br_fiscal_edi-16.0.1.5.1.1.dist-info/RECORD,,
37
+ odoo_addon_l10n_br_fiscal_edi-16.0.1.5.3.dist-info/METADATA,sha256=mm0cds89z5qSPT6-_o80f6a0ugD4FQF7Dx7GDuUbWfc,5670
38
+ odoo_addon_l10n_br_fiscal_edi-16.0.1.5.3.dist-info/WHEEL,sha256=9fEMia4zL7ZuZbnCOrcYogUhmn4XFIVaJ8G4YGI31xc,81
39
+ odoo_addon_l10n_br_fiscal_edi-16.0.1.5.3.dist-info/top_level.txt,sha256=QE6RBQ0QX5f4eFuUcGgU5Kbq1A_qJcDs-e_vpr6pmfU,4
40
+ odoo_addon_l10n_br_fiscal_edi-16.0.1.5.3.dist-info/RECORD,,
@@ -1,1173 +0,0 @@
1
- # @ 2020 Akretion - www.akretion.com.br -
2
- # Magno Costa <magno.costa@akretion.com.br>
3
- # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
4
-
5
-
6
- from odoo.tests import TransactionCase
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
- from ..constants.icms import ICMS_ORIGIN_TAX_IMPORTED
15
-
16
-
17
- class TestFiscalDocumentGeneric(TransactionCase):
18
- @classmethod
19
- def setUpClass(cls):
20
- super().setUpClass()
21
- # Contribuinte
22
- cls.nfe_same_state = cls.env.ref("l10n_br_fiscal.demo_nfe_same_state")
23
- cls.nfe_other_state = cls.env.ref("l10n_br_fiscal.demo_nfe_other_state")
24
- cls.nfe_not_taxpayer = cls.env.ref("l10n_br_fiscal.demo_nfe_nao_contribuinte")
25
-
26
- cls.nfe_not_taxpayer_pf = cls.env.ref(
27
- "l10n_br_fiscal.demo_nfe_nao_contribuinte_pf"
28
- )
29
-
30
- cls.nfe_export = cls.env.ref("l10n_br_fiscal.demo_nfe_export")
31
-
32
- # Simples Nacional
33
- cls.nfe_sn_same_state = cls.env.ref("l10n_br_fiscal.demo_nfe_sn_same_state")
34
- cls.nfe_sn_other_state = cls.env.ref("l10n_br_fiscal.demo_nfe_sn_other_state")
35
- cls.nfe_sn_not_taxpayer = cls.env.ref(
36
- "l10n_br_fiscal.demo_nfe_sn_nao_contribuinte"
37
- )
38
- cls.nfe_sn_export = cls.env.ref("l10n_br_fiscal.demo_nfe_sn_export")
39
-
40
- # Compra
41
- cls.nfe_purchase_same_state = cls.env.ref(
42
- "l10n_br_fiscal.demo_nfe_purchase_same_state"
43
- )
44
-
45
- def test_nfe_same_state(self):
46
- """Test NFe same state."""
47
-
48
- self.nfe_same_state._onchange_fiscal_operation_id()
49
-
50
- for line in self.nfe_same_state.fiscal_line_ids:
51
- # Save the original price_unit value of the line as defined in
52
- # the NFe demo data.
53
- original_price_unit = line.price_unit
54
-
55
- line._onchange_product_id_fiscal()
56
-
57
- # Restore the original price_unit value,
58
- # as the product change might have altered it.
59
- line.price_unit = original_price_unit
60
-
61
- line._onchange_commercial_quantity()
62
- line._onchange_fiscal_operation_id()
63
- line._onchange_fiscal_operation_line_id()
64
- line._onchange_fiscal_taxes()
65
-
66
- if "Revenda" in line.fiscal_operation_line_id.name:
67
- self.assertEqual(
68
- line.cfop_id.code,
69
- "5102",
70
- "Error to mappping CFOP 5102"
71
- " for Revenda de Contribuinte Dentro do Estado.",
72
- )
73
- else:
74
- self.assertEqual(
75
- line.cfop_id.code,
76
- "5101",
77
- "Error to mapping CFOP 5101"
78
- " for Venda de Contribuinte Dentro do Estado.",
79
- )
80
-
81
- icms_internal_sp = [
82
- self.env.ref("l10n_br_fiscal.tax_icms_4"),
83
- self.env.ref("l10n_br_fiscal.tax_icms_7"),
84
- self.env.ref("l10n_br_fiscal.tax_icms_12"),
85
- self.env.ref("l10n_br_fiscal.tax_icms_18"),
86
- self.env.ref("l10n_br_fiscal.tax_icms_25"),
87
- ]
88
-
89
- is_icms_internal = line.icms_tax_id in icms_internal_sp
90
-
91
- # ICMS
92
- self.assertTrue(
93
- is_icms_internal,
94
- "Error to mapping ICMS Inernal for {}"
95
- " for Venda de Contribuinte Dentro do "
96
- "Estado.".format(self.nfe_same_state.partner_id.state_id.name),
97
- )
98
- self.assertEqual(
99
- line.icms_cst_id.code,
100
- "00",
101
- "Error to mapping CST 00 from ICMS 12%"
102
- " for Venda de Contribuinte Dentro do Estado.",
103
- )
104
-
105
- # ICMS FCP
106
- self.assertFalse(
107
- line.icmsfcp_tax_id,
108
- "Error to mapping ICMS FCP 2%"
109
- " for Venda de Contribuinte Dentro do Estado.",
110
- )
111
-
112
- # IPI
113
- if "Revenda" in line.fiscal_operation_line_id.name:
114
- self.assertEqual(
115
- line.ipi_tax_id.name,
116
- "IPI NT",
117
- "Error to mapping IPI NT"
118
- " for Revenda de Contribuinte Dentro do Estado.",
119
- )
120
- self.assertEqual(
121
- line.ipi_cst_id.code,
122
- "53",
123
- "Error to mapping CST 53 from IPI NT"
124
- " to Revenda de Contribuinte Dentro do Estado.",
125
- )
126
- else:
127
- self.assertEqual(
128
- line.ipi_tax_id.name,
129
- "IPI 5%",
130
- "Error to mapping IPI 5%"
131
- " for Venda de Contribuinte Dentro do Estado.",
132
- )
133
- self.assertEqual(
134
- line.ipi_cst_id.code,
135
- "50",
136
- "Error to mapping CST 50 from IPI 5%"
137
- " to Venda de Contribuinte Dentro do Estado.",
138
- )
139
-
140
- # PIS
141
- self.assertEqual(
142
- line.pis_tax_id.name,
143
- "PIS 0,65%",
144
- "Error to mapping PIS 0,65%"
145
- " for Venda de Contribuinte Dentro do Estado.",
146
- )
147
- self.assertEqual(
148
- line.pis_cst_id.code,
149
- "01",
150
- "Error to mapping CST 01 - Operação Tributável com Alíquota"
151
- " Básica from PIS 0,65% to Venda de Contribuinte Dentro do Estado.",
152
- )
153
-
154
- # PIS
155
- self.assertEqual(
156
- line.cofins_tax_id.name,
157
- "COFINS 3%",
158
- "Error to mapping COFINS 3%"
159
- " for Venda de Contribuinte Dentro do Estado.",
160
- )
161
- self.assertEqual(
162
- line.cofins_cst_id.code,
163
- "01",
164
- "Error to mapping CST 01 - Operação Tributável com Alíquota Básica"
165
- " Básica to COFINS 3% de Venda de Contribuinte Dentro do Estado.",
166
- )
167
-
168
- product_total = line.price_unit * line.quantity
169
- self.assertEqual(line.price_gross, product_total)
170
-
171
- # self.nfe_same_state.action_document_confirm()
172
-
173
- self.assertEqual(
174
- self.nfe_same_state.state_edoc,
175
- SITUACAO_EDOC_A_ENVIAR,
176
- "Document is not in To Sent state",
177
- )
178
-
179
- self.nfe_same_state.action_document_send()
180
-
181
- # self.assertEqual(
182
- # self.nfe_same_state.state_edoc,
183
- # SITUACAO_EDOC_AUTORIZADA,
184
- # "Document is not in Authorized state",
185
- # )
186
-
187
- # Total value of the products
188
- # self.assertEqual(self.nfe_same_state.amount_price_gross, 200)
189
-
190
- # result = self.nfe_same_state.action_document_cancel()
191
- # self.assertTrue(result)
192
-
193
- def test_nfe_other_state(self):
194
- """Test NFe other state."""
195
-
196
- self.nfe_other_state._onchange_fiscal_operation_id()
197
-
198
- for line in self.nfe_other_state.fiscal_line_ids:
199
- line._onchange_product_id_fiscal()
200
- line._onchange_commercial_quantity()
201
- line._onchange_fiscal_operation_id()
202
- line._onchange_fiscal_operation_line_id()
203
- line._onchange_fiscal_taxes()
204
-
205
- if "Revenda" in line.fiscal_operation_line_id.name:
206
- self.assertEqual(
207
- line.cfop_id.code,
208
- "6102",
209
- "Error to mapping CFOP 6102"
210
- " for Revenda de Contribuinte p/ Fora do Estado.",
211
- )
212
- else:
213
- self.assertEqual(
214
- line.cfop_id.code,
215
- "6101",
216
- "Error to mapping CFOP 6101"
217
- " for Venda de Contribuinte p/ Fora do Estado.",
218
- )
219
-
220
- # ICMS
221
- if line.product_id.icms_origin in ICMS_ORIGIN_TAX_IMPORTED:
222
- self.assertEqual(
223
- line.icms_tax_id.name,
224
- "ICMS 4%",
225
- "Error to mapping ICMS 4%"
226
- " for Venda de Contribuinte p/ Fora do Estado.",
227
- )
228
- self.assertEqual(
229
- line.icms_cst_id.code,
230
- "00",
231
- "Error to mapping CST 00 from ICMS 4%"
232
- " for Venda de Contribuinte p/ Fora do Estado.",
233
- )
234
- else:
235
- self.assertEqual(
236
- line.icms_tax_id.name,
237
- "ICMS 7%",
238
- "Error to mapping ICMS 7%"
239
- " for Venda de Contribuinte p/ Fora do Estado.",
240
- )
241
- self.assertEqual(
242
- line.icms_cst_id.code,
243
- "00",
244
- "Error to mapping CST 00 from ICMS 7%"
245
- " for Venda de Contribuinte p/ Fora do Estado.",
246
- )
247
-
248
- # ICMS FCP
249
- self.assertFalse(
250
- line.icmsfcp_tax_id,
251
- "Error to mapping ICMS FCP 2%"
252
- " for Venda de Contribuinte Dentro do Estado.",
253
- )
254
-
255
- # IPI
256
- if "Revenda" in line.fiscal_operation_line_id.name:
257
- self.assertEqual(
258
- line.ipi_tax_id.name,
259
- "IPI NT",
260
- "Error to mapping IPI NT"
261
- " for Revenda de Contribuinte Dentro do Estado.",
262
- )
263
- self.assertEqual(
264
- line.ipi_cst_id.code,
265
- "53",
266
- "Error to mapping CST 53 from IPI NT"
267
- " to Revenda de Contribuinte Dentro do Estado.",
268
- )
269
- else:
270
- self.assertEqual(
271
- line.ipi_tax_id.name,
272
- "IPI 5%",
273
- "Error to mapping IPI 5%"
274
- " for Venda de Contribuinte Dentro do Estado.",
275
- )
276
- self.assertEqual(
277
- line.ipi_cst_id.code,
278
- "50",
279
- "Error to mapping CST 50 from IPI 5%"
280
- " to Venda de Contribuinte Dentro do Estado.",
281
- )
282
-
283
- # PIS
284
- self.assertEqual(
285
- line.pis_tax_id.name,
286
- "PIS 0,65%",
287
- "Error to mapping PIS 0,65%"
288
- " for Venda de Contribuinte p/ Fora do Estado.",
289
- )
290
- self.assertEqual(
291
- line.pis_cst_id.code,
292
- "01",
293
- "Error to mapping CST 01 - Operação Tributável com Alíquota"
294
- " Básica from PIS 0,65% for"
295
- " Venda de Contribuinte p/ Fora do Estado.",
296
- )
297
-
298
- # PIS
299
- self.assertEqual(
300
- line.cofins_tax_id.name,
301
- "COFINS 3%",
302
- "Error to mapping COFINS 3%"
303
- " for Venda de Contribuinte p/ Fora do Estado.",
304
- )
305
- self.assertEqual(
306
- line.cofins_cst_id.code,
307
- "01",
308
- "Error to mapping CST 01 -"
309
- " Operação Tributável com Alíquota Básica"
310
- "from COFINS 3% for Venda de Contribuinte p/ Fora do Estado.",
311
- )
312
-
313
- def test_nfe_not_taxpayer(self):
314
- """Test NFe not taxpayer."""
315
-
316
- self.nfe_not_taxpayer._onchange_fiscal_operation_id()
317
-
318
- for line in self.nfe_not_taxpayer.fiscal_line_ids:
319
- line._onchange_product_id_fiscal()
320
- line._onchange_commercial_quantity()
321
- line._onchange_fiscal_operation_id()
322
- line._onchange_fiscal_operation_line_id()
323
- line._onchange_fiscal_taxes()
324
-
325
- if "Revenda" in line.fiscal_operation_line_id.name:
326
- self.assertEqual(
327
- line.cfop_id.code,
328
- "6108",
329
- "Error to mapping CFOP 6108"
330
- " for Revenda de Contribuinte p/ Não Contribuinte.",
331
- )
332
- else:
333
- self.assertEqual(
334
- line.cfop_id.code,
335
- "6107",
336
- "Error to mapping CFOP 6107"
337
- " for Venda de Contribuinte p/ Não Contribuinte.",
338
- )
339
-
340
- # ICMS
341
- self.assertEqual(
342
- line.icms_tax_id.name,
343
- "ICMS 12%",
344
- "Error to mapping ICMS 12%"
345
- " for Venda de Contribuinte p/ Não Contribuinte.",
346
- )
347
- self.assertEqual(
348
- line.icms_cst_id.code,
349
- "00",
350
- "Error to mapping CST 00 from ICMS 12%"
351
- " for Venda de Contribuinte p/ Não Contribuinte.",
352
- )
353
-
354
- # ICMS FCP
355
- self.assertEqual(
356
- line.icmsfcp_tax_id.name,
357
- "FCP 2%",
358
- "Erro ao mapear ICMS FCP 2%"
359
- " para Venda de Contribuinte p/ Não Contribuinte.",
360
- )
361
-
362
- # IPI
363
- if "Revenda" in line.fiscal_operation_line_id.name:
364
- self.assertEqual(
365
- line.ipi_tax_id.name,
366
- "IPI NT",
367
- "Error to mapping IPI NT"
368
- " for Revenda de Contribuinte Dentro do Estado.",
369
- )
370
- self.assertEqual(
371
- line.ipi_cst_id.code,
372
- "53",
373
- "Error to mapping CST 53 from IPI NT"
374
- " to Revenda de Contribuinte Dentro do Estado.",
375
- )
376
- else:
377
- self.assertEqual(
378
- line.ipi_tax_id.name,
379
- "IPI 5%",
380
- "Error to mapping IPI 5%"
381
- " for Venda de Contribuinte Dentro do Estado.",
382
- )
383
- self.assertEqual(
384
- line.ipi_cst_id.code,
385
- "50",
386
- "Error to mapping CST 50 from IPI 5%"
387
- " to Venda de Contribuinte Dentro do Estado.",
388
- )
389
-
390
- # PIS
391
- self.assertEqual(
392
- line.pis_tax_id.name,
393
- "PIS 0,65%",
394
- "Error to mapping PIS 0,65%"
395
- " for Venda de Contribuinte p/ Não Contribuinte.",
396
- )
397
- self.assertEqual(
398
- line.pis_cst_id.code,
399
- "01",
400
- "Error to mapping CST 01 - Operação Tributável com Alíquota"
401
- " Básica from PIS 0,65% for"
402
- " Venda de Contribuinte p/ Não Contribuinte.",
403
- )
404
-
405
- # PIS
406
- self.assertEqual(
407
- line.cofins_tax_id.name,
408
- "COFINS 3%",
409
- "Error to mapping COFINS 3%"
410
- " for Venda de Contribuinte p/ Não Contribuinte.",
411
- )
412
- self.assertEqual(
413
- line.cofins_cst_id.code,
414
- "01",
415
- "Error to mapping CST 01 -"
416
- " Operação Tributável com Alíquota Básica"
417
- "from COFINS 3% for Venda de Contribuinte p/ Não Contribuinte.",
418
- )
419
-
420
- def test_nfe_not_taxpayer_not_company(self):
421
- """Test NFe not taxpayer not Company."""
422
-
423
- self.nfe_not_taxpayer_pf._onchange_fiscal_operation_id()
424
-
425
- for line in self.nfe_not_taxpayer_pf.fiscal_line_ids:
426
- line._onchange_product_id_fiscal()
427
- line._onchange_commercial_quantity()
428
- line._onchange_fiscal_operation_id()
429
- line._onchange_fiscal_operation_line_id()
430
- line._onchange_fiscal_taxes()
431
-
432
- if "Revenda" in line.fiscal_operation_line_id.name:
433
- self.assertEqual(
434
- line.cfop_id.code,
435
- "6108",
436
- "Error to mapping CFOP 6108"
437
- " for Revenda de Contribuinte p/ Não Contribuinte.",
438
- )
439
- else:
440
- self.assertEqual(
441
- line.cfop_id.code,
442
- "6107",
443
- "Error to mapping CFOP 6107"
444
- " for Venda de Contribuinte p/ Não Contribuinte.",
445
- )
446
-
447
- # ICMS
448
- self.assertEqual(
449
- line.icms_tax_id.name,
450
- "ICMS 12%",
451
- "Error to mapping ICMS 12%"
452
- " for Venda de Contribuinte p/ Não Contribuinte.",
453
- )
454
- self.assertEqual(
455
- line.icms_cst_id.code,
456
- "00",
457
- "Error to mapping CST 00 from ICMS 12%"
458
- " for Venda de Contribuinte p/ Não Contribuinte.",
459
- )
460
-
461
- # ICMS FCP
462
- self.assertEqual(
463
- line.icmsfcp_tax_id.name,
464
- "FCP 2%",
465
- "Erro ao mapear ICMS FCP 2%"
466
- " para Venda de Contribuinte p/ Não Contribuinte.",
467
- )
468
-
469
- # IPI
470
- if "Revenda" in line.fiscal_operation_line_id.name:
471
- self.assertEqual(
472
- line.ipi_tax_id.name,
473
- "IPI NT",
474
- "Error to mapping IPI NT"
475
- " for Revenda de Contribuinte Dentro do Estado.",
476
- )
477
- self.assertEqual(
478
- line.ipi_cst_id.code,
479
- "53",
480
- "Error to mapping CST 53 from IPI NT"
481
- " to Revenda de Contribuinte Dentro do Estado.",
482
- )
483
- else:
484
- self.assertEqual(
485
- line.ipi_tax_id.name,
486
- "IPI 5%",
487
- "Error to mapping IPI 5%"
488
- " for Venda de Contribuinte Dentro do Estado.",
489
- )
490
- self.assertEqual(
491
- line.ipi_cst_id.code,
492
- "50",
493
- "Error to mapping CST 50 from IPI 5%"
494
- " to Venda de Contribuinte Dentro do Estado.",
495
- )
496
-
497
- # PIS
498
- self.assertEqual(
499
- line.pis_tax_id.name,
500
- "PIS 0,65%",
501
- "Error to mapping PIS 0,65%"
502
- " for Venda de Contribuinte p/ Não Contribuinte.",
503
- )
504
- self.assertEqual(
505
- line.pis_cst_id.code,
506
- "01",
507
- "Error to mapping CST 01 - Operação Tributável com Alíquota"
508
- " Básica from PIS 0,65% for"
509
- " Venda de Contribuinte p/ Não Contribuinte.",
510
- )
511
-
512
- # PIS
513
- self.assertEqual(
514
- line.cofins_tax_id.name,
515
- "COFINS 3%",
516
- "Error to mapping COFINS 3%"
517
- " for Venda de Contribuinte p/ Não Contribuinte.",
518
- )
519
- self.assertEqual(
520
- line.cofins_cst_id.code,
521
- "01",
522
- "Error to mapping CST 01 -"
523
- " Operação Tributável com Alíquota Básica"
524
- "from COFINS 3% for Venda de Contribuinte p/ Não Contribuinte.",
525
- )
526
-
527
- def test_nfe_export(self):
528
- """Test NFe export."""
529
-
530
- self.nfe_export._onchange_fiscal_operation_id()
531
-
532
- for line in self.nfe_export.fiscal_line_ids:
533
- line._onchange_product_id_fiscal()
534
- line._onchange_commercial_quantity()
535
- line._onchange_fiscal_operation_id()
536
- line._onchange_fiscal_operation_line_id()
537
- line._onchange_fiscal_taxes()
538
-
539
- if "Revenda" in line.fiscal_operation_line_id.name:
540
- self.assertEqual(
541
- line.cfop_id.code,
542
- "7102",
543
- "Error to mapping CFOP 7102"
544
- " for Revenda de Contribuinte p/ o Exterior.",
545
- )
546
- else:
547
- self.assertEqual(
548
- line.cfop_id.code,
549
- "7101",
550
- "Error to mapping CFOP 7101"
551
- " for Venda de Contribuinte p/ o Exterior.",
552
- )
553
-
554
- # ICMS - TODO field missing
555
- # self.assertEqual(
556
- # line.icms_tax_id.name, 'ICMS 7%',
557
- # "Error to mapping ICMS 7%"
558
- # " for Venda de Contribuinte p/ o Exterior.")
559
- # self.assertEqual(
560
- # line.icms_cst_id.code, '00',
561
- # "Error to mapping CST 00 from ICMS 7%"
562
- # " for Venda de Contribuinte p/ o Exterior.")
563
-
564
- # ICMS FCP
565
- # self.assertEqual(
566
- # line.icmsfcp_tax_id.name, 'FCP 2%',
567
- # "Erro ao mapear ICMS FCP 2%"
568
- # " para Venda de Contribuinte p/ o Exterior.")
569
-
570
- # IPI
571
- if "Revenda" in line.fiscal_operation_line_id.name:
572
- self.assertEqual(
573
- line.ipi_tax_id.name,
574
- "IPI NT",
575
- "Error to mapping IPI NT"
576
- " for Revenda de Contribuinte Dentro do Estado.",
577
- )
578
- self.assertEqual(
579
- line.ipi_cst_id.code,
580
- "53",
581
- "Error to mapping CST 53 from IPI NT"
582
- " to Revenda de Contribuinte Dentro do Estado.",
583
- )
584
- else:
585
- self.assertEqual(
586
- line.ipi_tax_id.name,
587
- "IPI 5%",
588
- "Error to mapping IPI 5%"
589
- " for Venda de Contribuinte Dentro do Estado.",
590
- )
591
- self.assertEqual(
592
- line.ipi_cst_id.code,
593
- "50",
594
- "Error to mapping CST 50 from IPI 5%"
595
- " to Venda de Contribuinte Dentro do Estado.",
596
- )
597
-
598
- # PIS
599
- self.assertEqual(
600
- line.pis_tax_id.name,
601
- "PIS 0,65%",
602
- "Error to mapping PIS 0,65%"
603
- " for Venda de Contribuinte p/ o Exterior.",
604
- )
605
- self.assertEqual(
606
- line.pis_cst_id.code,
607
- "01",
608
- "Error to mapping CST 01 - Operação Tributável com Alíquota"
609
- " Básica from PIS 0,65% for"
610
- " Venda de Contribuinte p/ o Exterior.",
611
- )
612
-
613
- # PIS
614
- self.assertEqual(
615
- line.cofins_tax_id.name,
616
- "COFINS 3%",
617
- "Error to mapping COFINS 3%"
618
- " for Venda de Contribuinte p/ o Exterior.",
619
- )
620
- self.assertEqual(
621
- line.cofins_cst_id.code,
622
- "01",
623
- "Error to mapping CST 01 -"
624
- " Operação Tributável com Alíquota Básica"
625
- "from COFINS 3% for Venda de Contribuinte p/ o Exterior.",
626
- )
627
-
628
- def test_nfe_sn_same_state(self):
629
- """Test NFe Simples Nacional same state."""
630
-
631
- self.nfe_sn_same_state._onchange_fiscal_operation_id()
632
-
633
- for line in self.nfe_sn_same_state.fiscal_line_ids:
634
- line._onchange_product_id_fiscal()
635
- line._onchange_commercial_quantity()
636
-
637
- # set fake estimate tax
638
- line.ncm_id.tax_estimate_ids.create(
639
- {
640
- "ncm_id": line.ncm_id.id,
641
- "state_id": line.company_id.state_id.id,
642
- "key": "fake estimate tax",
643
- "origin": "fake estimate tax",
644
- "federal_taxes_national": 33.00,
645
- }
646
- )
647
-
648
- line._onchange_fiscal_operation_id()
649
- line._onchange_fiscal_operation_line_id()
650
- line._onchange_fiscal_taxes()
651
-
652
- if "Revenda" in line.fiscal_operation_line_id.name:
653
- self.assertEqual(
654
- line.cfop_id.code,
655
- "5102",
656
- "Error to mappping CFOP 5102"
657
- " for Revenda de Simples Nacional Dentro do Estado.",
658
- )
659
- # IPI
660
- self.assertEqual(
661
- line.ipi_tax_id.name,
662
- "IPI NT",
663
- "Error to mapping IPI Simples Nacional"
664
- " for Venda de Simples Nacional Fora do Estado.",
665
- )
666
- self.assertEqual(
667
- line.ipi_cst_id.code,
668
- "53",
669
- "Error to mapping CST 53 from IPI Simples Nacional"
670
- " for Venda de Simples Nacional Fora do Estado.",
671
- )
672
- else:
673
- self.assertEqual(
674
- line.cfop_id.code,
675
- "5101",
676
- "Error to mapping CFOP 5101"
677
- " for Venda de Simples Nacional Dentro do Estado.",
678
- )
679
- # IPI
680
- self.assertEqual(
681
- line.ipi_tax_id.name,
682
- "IPI Outros",
683
- "Error to mapping IPI Simples Nacional"
684
- " for Venda de Simples Nacional Fora do Estado.",
685
- )
686
- self.assertEqual(
687
- line.ipi_cst_id.code,
688
- "99",
689
- "Error to mapping CST 99 from IPI Simples Nacional"
690
- " for Venda de Simples Nacional Fora do Estado.",
691
- )
692
-
693
- # ICMS
694
- self.assertEqual(
695
- line.icmssn_tax_id.name,
696
- "ICMS SN Com Permissão de Crédito",
697
- "Error to mapping ICMS SN Com Permissão de Crédito"
698
- " for Venda de Simples Nacional Dentro do Estado.",
699
- )
700
- self.assertEqual(
701
- line.icms_cst_id.code,
702
- "101",
703
- "Error to mapping CST 101 do ICMS SN Com Permissão de Crédito"
704
- " for Venda de Simples Nacional Dentro do Estado.",
705
- )
706
-
707
- # ICMS FCP - TODO mapping failed
708
- # self.assertEqual(
709
- # line.icmsfcp_tax_id.name, 'FCP 2%',
710
- # "Erro ao mapear ICMS FCP 2%"
711
- # " para Venda de Simples Nacional Dentro do Estado.")
712
-
713
- # PIS
714
- self.assertEqual(
715
- line.pis_tax_id.name,
716
- "PIS Outros",
717
- "Error to mapping PIS Simples Nacional"
718
- " for Venda de Simples Nacional Dentro do Estado.",
719
- )
720
- self.assertEqual(
721
- line.pis_cst_id.code,
722
- "49",
723
- "Error to mapping CST 49 Outras Operações de Saída"
724
- " from PIS Simples Nacional from Venda de"
725
- " Simples Nacional Dentro do Estado.",
726
- )
727
-
728
- # COFINS
729
- self.assertEqual(
730
- line.cofins_tax_id.name,
731
- "COFINS Outros",
732
- "Error to mapping COFINS Simples Nacional"
733
- " for Venda de Simples Nacional Dentro do Estado.",
734
- )
735
- self.assertEqual(
736
- line.cofins_cst_id.code,
737
- "49",
738
- "Error to mapping CST 49 Outras Operações de Saída"
739
- " from COFINS Simples Nacional for Venda de"
740
- " Simples Nacional Fora do Estado.",
741
- )
742
-
743
- # ESTIMATE TAXES
744
- self.assertEqual(self.nfe_sn_same_state.amount_estimate_tax, 1308.45)
745
-
746
- def test_nfe_sn_other_state(self):
747
- """Test NFe SN other state."""
748
-
749
- self.nfe_sn_other_state._onchange_fiscal_operation_id()
750
-
751
- for line in self.nfe_sn_other_state.fiscal_line_ids:
752
- line._onchange_product_id_fiscal()
753
- line._onchange_commercial_quantity()
754
- line._onchange_fiscal_operation_id()
755
- line._onchange_fiscal_operation_line_id()
756
- line._onchange_fiscal_taxes()
757
-
758
- if "Revenda" in line.fiscal_operation_line_id.name:
759
- self.assertEqual(
760
- line.cfop_id.code,
761
- "6102",
762
- "Error to mappping CFOP 6102"
763
- " for Revenda de Simples Nacional Fora do Estado.",
764
- )
765
- # IPI
766
- self.assertEqual(
767
- line.ipi_tax_id.name,
768
- "IPI NT",
769
- "Error to mapping IPI Simples Nacional"
770
- " for Venda de Simples Nacional Fora do Estado.",
771
- )
772
- self.assertEqual(
773
- line.ipi_cst_id.code,
774
- "53",
775
- "Error to mapping CST 53 from IPI Simples Nacional"
776
- " for Venda de Simples Nacional Fora do Estado.",
777
- )
778
- else:
779
- self.assertEqual(
780
- line.cfop_id.code,
781
- "6101",
782
- "Error to mapping CFOP 6101"
783
- " for Venda de Simples Nacional Fora do Estado.",
784
- )
785
- # IPI
786
- self.assertEqual(
787
- line.ipi_tax_id.name,
788
- "IPI Outros",
789
- "Error to mapping IPI Simples Nacional"
790
- " for Venda de Simples Nacional Fora do Estado.",
791
- )
792
- self.assertEqual(
793
- line.ipi_cst_id.code,
794
- "99",
795
- "Error to mapping CST 99 from IPI Simples Nacional"
796
- " for Venda de Simples Nacional Fora do Estado.",
797
- )
798
-
799
- # ICMS
800
- self.assertEqual(
801
- line.icmssn_tax_id.name,
802
- "ICMS SN Com Permissão de Crédito",
803
- "Error to mapping ICMS SN Com Permissão de Crédito"
804
- " for Venda de Simples Nacional Dentro do Estado.",
805
- )
806
- self.assertEqual(
807
- line.icms_cst_id.code,
808
- "101",
809
- "Erro ao mapear a CST 101 do ICMS SN Com Permissão de Crédito"
810
- " para Venda de Simples Nacional Dentro do Estado.",
811
- )
812
-
813
- # ICMS FCP - TODO mapping failed
814
- # self.assertEqual(
815
- # line.icmsfcp_tax_id.name, 'FCP 2%',
816
- # "Erro ao mapear ICMS FCP 2%"
817
- # " para Venda de Simples Nacional Fora do Estado.")
818
-
819
- # PIS
820
- self.assertEqual(
821
- line.pis_tax_id.name,
822
- "PIS Outros",
823
- "Erro ao mapear PIS Simples Nacional"
824
- " para Venda de Simples Nacional Fora do Estado.",
825
- )
826
- self.assertEqual(
827
- line.pis_cst_id.code,
828
- "49",
829
- "Erro ao mapear a CST 49 Outras Operações de Saída"
830
- " com Alíquota Básica do PIS Simples Nacional de Venda de"
831
- " Simples Nacional Dentro do Estado.",
832
- )
833
-
834
- # COFINS
835
- self.assertEqual(
836
- line.cofins_tax_id.name,
837
- "COFINS Outros",
838
- "Error to mapping COFINS Simples Nacional"
839
- " for Venda de Simples Nacional Dentro do Estado.",
840
- )
841
- self.assertEqual(
842
- line.cofins_cst_id.code,
843
- "49",
844
- "Error to mapping CST 49 Outras Operações de Saída"
845
- " from COFINS Simples Nacional for Venda de"
846
- " Simples Nacional Fora do Estado.",
847
- )
848
-
849
- def test_nfe_sn_not_taxpayer(self):
850
- """Test NFe SN not taxpayer."""
851
-
852
- self.nfe_sn_not_taxpayer._onchange_fiscal_operation_id()
853
-
854
- for line in self.nfe_sn_not_taxpayer.fiscal_line_ids:
855
- line._onchange_product_id_fiscal()
856
- line._onchange_commercial_quantity()
857
- line._onchange_fiscal_operation_id()
858
- line._onchange_fiscal_operation_line_id()
859
- line._onchange_fiscal_taxes()
860
-
861
- if "Revenda" in line.fiscal_operation_line_id.name:
862
- self.assertEqual(
863
- line.cfop_id.code,
864
- "5102",
865
- "Error to mappping CFOP 5102"
866
- " for Revenda de Simples Nacional Fora do Estado.",
867
- )
868
- else:
869
- self.assertEqual(
870
- line.cfop_id.code,
871
- "5101",
872
- "Error to mapping CFOP 5101"
873
- " for Venda de Simples Nacional Fora do Estado.",
874
- )
875
-
876
- # ICMS
877
- self.assertEqual(
878
- line.icms_tax_id.name,
879
- "ICMS 18%",
880
- "Error to mapping ICMS 18%"
881
- " for Venda de Simples Nacional Fora do Estado.",
882
- )
883
- self.assertEqual(
884
- line.icms_cst_id.code,
885
- "00",
886
- "Erro ao mapear a CST 00 do ICMS 18%"
887
- " para Venda de Simples Nacional Fora do Estado.",
888
- )
889
-
890
- # ICMS FCP
891
- # self.assertEqual(
892
- # line.icmsfcp_tax_id.name, 'FCP 2%',
893
- # "Erro ao mapear ICMS FCP 2%"
894
- # " para Venda de Simples Nacional Fora do Estado.")
895
-
896
- # IPI
897
- self.assertEqual(
898
- line.ipi_tax_id.name,
899
- "IPI 5%",
900
- "Erro ao mapear IPI 5%"
901
- " para Venda de Simples Nacional Fora do Estado.",
902
- )
903
- self.assertEqual(
904
- line.ipi_cst_id.code,
905
- "50",
906
- "Erro ao mapear a CST 50 do IPI 5%"
907
- " de Venda de Simples Nacional Fora do Estado.",
908
- )
909
-
910
- # PIS
911
- self.assertEqual(
912
- line.pis_tax_id.name,
913
- "PIS 0,65%",
914
- "Erro ao mapear PIS 0,65%"
915
- " para Venda de Simples Nacional Fora do Estado.",
916
- )
917
- self.assertEqual(
918
- line.pis_cst_id.code,
919
- "01",
920
- "Erro ao mapear a CST 01 - Operação Tributável"
921
- " com Alíquota Básica do PIS 0,65% de Venda de"
922
- " Simples Nacional Fora do Estado.",
923
- )
924
-
925
- # PIS
926
- self.assertEqual(
927
- line.cofins_tax_id.name,
928
- "COFINS 3%",
929
- "Erro ao mapear COFINS 3%"
930
- " para Venda de Simples Nacional Dentro do Estado.",
931
- )
932
- self.assertEqual(
933
- line.cofins_cst_id.code,
934
- "01",
935
- "Erro ao mapear a CST 01 - Operação Tributável"
936
- " com Alíquota Básica do COFINS 3% de Venda de"
937
- " Simples Nacional Fora do Estado.",
938
- )
939
-
940
- def test_nfe_sn_export(self):
941
- """Test NFe SN export."""
942
-
943
- self.nfe_sn_export._onchange_fiscal_operation_id()
944
-
945
- for line in self.nfe_sn_export.fiscal_line_ids:
946
- line._onchange_product_id_fiscal()
947
- line._onchange_commercial_quantity()
948
- line._onchange_fiscal_operation_id()
949
- line._onchange_fiscal_operation_line_id()
950
- line._onchange_fiscal_taxes()
951
-
952
- if "Revenda" in line.fiscal_operation_line_id.name:
953
- self.assertEqual(
954
- line.cfop_id.code,
955
- "7102",
956
- "Error to mapping CFOP 7102"
957
- " for Revenda de Contribuinte p/ o Exterior.",
958
- )
959
- # IPI
960
- self.assertEqual(
961
- line.ipi_tax_id.name,
962
- "IPI NT",
963
- "Error to mapping IPI Simples Nacional"
964
- " for Venda de Simples Nacional Fora do Estado.",
965
- )
966
- self.assertEqual(
967
- line.ipi_cst_id.code,
968
- "53",
969
- "Error to mapping CST 53 from IPI Simples Nacional"
970
- " for Venda de Simples Nacional Fora do Estado.",
971
- )
972
- else:
973
- self.assertEqual(
974
- line.cfop_id.code,
975
- "7101",
976
- "Error to mapping CFOP 7101"
977
- " for Venda de Contribuinte p/ o Exterior.",
978
- )
979
- # IPI
980
- self.assertEqual(
981
- line.ipi_tax_id.name,
982
- "IPI Outros",
983
- "Error to mapping IPI Simples Nacional"
984
- " for Venda de Simples Nacional Fora do Estado.",
985
- )
986
- self.assertEqual(
987
- line.ipi_cst_id.code,
988
- "99",
989
- "Error to mapping CST 99 from IPI Simples Nacional"
990
- " for Venda de Simples Nacional Fora do Estado.",
991
- )
992
-
993
- # ICMS
994
- self.assertEqual(
995
- line.icmssn_tax_id.name,
996
- "ICMS SN Com Permissão de Crédito",
997
- "Error to mapping ICMS SN Com Permissão de Crédito"
998
- " for Venda de Simples Nacional Dentro do Estado.",
999
- )
1000
- self.assertEqual(
1001
- line.icms_cst_id.code,
1002
- "101",
1003
- "Erro ao mapear a CST 101 do ICMS SN Com Permissão de Crédito"
1004
- " para Venda de Simples Nacional Dentro do Estado.",
1005
- )
1006
-
1007
- # ICMS FCP
1008
- # self.assertEqual(
1009
- # line.icmsfcp_tax_id.name, 'FCP 2%',
1010
- # "Erro ao mapear ICMS FCP 2%"
1011
- # " para Venda de Contribuinte p/ o Exterior.")
1012
-
1013
- # PIS
1014
- self.assertEqual(
1015
- line.pis_tax_id.name,
1016
- "PIS Outros",
1017
- "Erro ao mapear PIS Simples Nacional"
1018
- " para Venda de Simples Nacional Fora do Estado.",
1019
- )
1020
- self.assertEqual(
1021
- line.pis_cst_id.code,
1022
- "49",
1023
- "Erro ao mapear a CST 49 Outras Operações de Saída"
1024
- " com Alíquota Básica do PIS Simples Nacional de Venda de"
1025
- " Simples Nacional Dentro do Estado.",
1026
- )
1027
-
1028
- # COFINS
1029
- self.assertEqual(
1030
- line.cofins_tax_id.name,
1031
- "COFINS Outros",
1032
- "Error to mapping COFINS Simples Nacional"
1033
- " for Venda de Simples Nacional Dentro do Estado.",
1034
- )
1035
- self.assertEqual(
1036
- line.cofins_cst_id.code,
1037
- "49",
1038
- "Error to mapping CST 49 Outras Operações de Saída"
1039
- " from COFINS Simples Nacional for Venda de"
1040
- " Simples Nacional Fora do Estado.",
1041
- )
1042
-
1043
- def test_nfe_return(self):
1044
- """Test Fiscal Document Return"""
1045
- action = self.nfe_same_state.action_create_return()
1046
- return_id = self.nfe_same_state.browse(
1047
- [i[2][0] for i in action["domain"] if i[0] == "id"]
1048
- )
1049
-
1050
- self.assertEqual(
1051
- return_id.fiscal_operation_id.id,
1052
- self.nfe_same_state.fiscal_operation_id.return_fiscal_operation_id.id,
1053
- "Error on creation return",
1054
- )
1055
-
1056
- def test_nfe_comments(self):
1057
- self.nfe_not_taxpayer._document_comment()
1058
- additional_data = self.nfe_not_taxpayer.fiscal_line_ids[0].additional_data
1059
- self.assertEqual(
1060
- additional_data,
1061
- "manual comment test - Valor Aprox. dos Tributos: R$ 0,00",
1062
- # TODO FIXME changed 0.00 to 0,00 to get tests pass on v13, but not
1063
- # correct
1064
- )
1065
-
1066
- def test_fields_freight_insurance_other_costs(self):
1067
- """Test fields Freight, Insurance and Other Costs when
1068
- defined or By Line or By Total.
1069
- """
1070
-
1071
- # Teste definindo os valores Por Linha
1072
- for line in self.nfe_same_state.fiscal_line_ids:
1073
- line.freight_value = 10.0
1074
- line.insurance_value = 10.0
1075
- line.other_value = 10.0
1076
-
1077
- self.assertEqual(
1078
- self.nfe_same_state.amount_freight_value,
1079
- 20.0,
1080
- "Unexpected value for the field" " Amount Freight in Fiscal Document line",
1081
- )
1082
- self.assertEqual(
1083
- self.nfe_same_state.amount_insurance_value,
1084
- 20.0,
1085
- "Unexpected value for the field"
1086
- " Amount Insurance in Fiscal Document line",
1087
- )
1088
- self.assertEqual(
1089
- self.nfe_same_state.amount_other_value,
1090
- 20.0,
1091
- "Unexpected value for the field"
1092
- " Amount Other Value in Fiscal Document line",
1093
- )
1094
-
1095
- # Teste definindo os valores Por Total
1096
- # Por padrão a definição dos campos está por Linha
1097
- self.nfe_same_state.company_id.delivery_costs = "total"
1098
-
1099
- # Caso que os Campos na Linha tem valor
1100
- self.nfe_same_state.amount_freight_value = 10.0
1101
- self.nfe_same_state.amount_insurance_value = 10.0
1102
- self.nfe_same_state.amount_other_value = 10.0
1103
-
1104
- for line in self.nfe_same_state.fiscal_line_ids:
1105
- self.assertEqual(
1106
- line.freight_value,
1107
- 5.0,
1108
- "Unexpected value for the field" " Freight in Fiscal Document line",
1109
- )
1110
- self.assertEqual(
1111
- line.insurance_value,
1112
- 5.0,
1113
- "Unexpected value for the field" " Insurance in Fiscal Document line",
1114
- )
1115
- self.assertEqual(
1116
- line.other_value,
1117
- 5.0,
1118
- "Unexpected value for the field"
1119
- " Other Values in Fiscal Document line",
1120
- )
1121
-
1122
- # Caso que os Campos na Linha não tem valor
1123
- for line in self.nfe_same_state.fiscal_line_ids:
1124
- line.freight_value = 0.0
1125
- line.insurance_value = 0.0
1126
- line.other_value = 0.0
1127
-
1128
- self.nfe_same_state.amount_freight_value = 20.0
1129
- self.nfe_same_state.amount_insurance_value = 20.0
1130
- self.nfe_same_state.amount_other_value = 20.0
1131
-
1132
- for line in self.nfe_same_state.fiscal_line_ids:
1133
- self.assertEqual(
1134
- line.freight_value,
1135
- 10.0,
1136
- "Unexpected value for the field" " Freight in Fiscal Document line",
1137
- )
1138
- self.assertEqual(
1139
- line.insurance_value,
1140
- 10.0,
1141
- "Unexpected value for the field" " Insurance in Fiscal Document line",
1142
- )
1143
- self.assertEqual(
1144
- line.other_value,
1145
- 10.0,
1146
- "Unexpected value for the field"
1147
- " Other Values in Fiscal Document line",
1148
- )
1149
-
1150
- def test_nfe_purchase_same_state(self):
1151
- # self.nfe_purchase_same_state.action_document_confirm()
1152
-
1153
- self.assertEqual(
1154
- self.nfe_purchase_same_state.state_edoc,
1155
- SITUACAO_EDOC_AUTORIZADA,
1156
- "Document is not in Authorized state",
1157
- )
1158
-
1159
- self.nfe_purchase_same_state.action_document_back2draft()
1160
-
1161
- self.assertEqual(
1162
- self.nfe_purchase_same_state.state_edoc,
1163
- SITUACAO_EDOC_EM_DIGITACAO,
1164
- "Document is not in Draft state",
1165
- )
1166
-
1167
- self.nfe_purchase_same_state.action_document_cancel()
1168
-
1169
- self.assertEqual(
1170
- self.nfe_purchase_same_state.state_edoc,
1171
- SITUACAO_EDOC_CANCELADA,
1172
- "Document is not in Canceled state",
1173
- )
@@ -1,75 +0,0 @@
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 import Command
5
- from odoo.tests import TransactionCase
6
-
7
- from ..constants.fiscal import SITUACAO_EDOC_A_ENVIAR
8
-
9
-
10
- class TestTaxBenefit(TransactionCase):
11
- def setUp(self):
12
- super().setUp()
13
- self.nfe_tax_benefit = self.env.ref("l10n_br_fiscal.demo_nfe_tax_benefit")
14
- self.tax_benefit = self.env["l10n_br_fiscal.tax.definition"].create(
15
- {
16
- "icms_regulation_id": self.env.ref(
17
- "l10n_br_fiscal.tax_icms_regulation"
18
- ).id,
19
- "tax_group_id": self.env.ref("l10n_br_fiscal.tax_group_icms").id,
20
- "code": "SP810001",
21
- "name": "TAX BENEFIT DEMO",
22
- "description": "TAX BENEFIT DEMO",
23
- "benefit_type": "1",
24
- "is_benefit": True,
25
- "is_taxed": True,
26
- "is_debit_credit": True,
27
- "custom_tax": True,
28
- "tax_id": self.env.ref("l10n_br_fiscal.tax_icms_12_red_26_57").id,
29
- "cst_id": self.env.ref("l10n_br_fiscal.cst_icms_20").id,
30
- "state_from_id": self.env.ref("base.state_br_sp").id,
31
- "state_to_ids": [Command.set(self.env.ref("base.state_br_mg").ids)],
32
- "ncms": "73269090",
33
- "ncm_ids": [
34
- Command.set(self.env.ref("l10n_br_fiscal.ncm_73269090").ids)
35
- ],
36
- "state": "approved",
37
- }
38
- )
39
-
40
- def test_nfe_tax_benefit(self):
41
- """Test NFe with tax benefit."""
42
-
43
- self.nfe_tax_benefit._onchange_fiscal_operation_id()
44
-
45
- for line in self.nfe_tax_benefit.fiscal_line_ids:
46
- line._onchange_product_id_fiscal()
47
- line._onchange_commercial_quantity()
48
- line._onchange_fiscal_operation_id()
49
- line._onchange_fiscal_operation_line_id()
50
- line._onchange_fiscal_taxes()
51
-
52
- self.assertEqual(
53
- line.icms_tax_benefit_id,
54
- self.tax_benefit,
55
- "Document line must have tax benefit",
56
- )
57
-
58
- # self.nfe_tax_benefit.action_document_confirm()
59
-
60
- self.assertEqual(
61
- self.nfe_tax_benefit.state_edoc,
62
- SITUACAO_EDOC_A_ENVIAR,
63
- "Document is not in To Send state",
64
- )
65
-
66
- self.nfe_tax_benefit.action_document_send()
67
-
68
- # self.assertEqual(
69
- # self.nfe_tax_benefit.state_edoc,
70
- # SITUACAO_EDOC_AUTORIZADA,
71
- # "Document is not in Authorized state",
72
- # )
73
-
74
- # result = self.nfe_tax_benefit.action_document_cancel()
75
- # self.assertTrue(result)