odoo-addon-l10n-es-atc-mod415 16.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 (29) hide show
  1. odoo/addons/l10n_es_atc_mod415/README.rst +87 -0
  2. odoo/addons/l10n_es_atc_mod415/__init__.py +3 -0
  3. odoo/addons/l10n_es_atc_mod415/__manifest__.py +30 -0
  4. odoo/addons/l10n_es_atc_mod415/data/mail_template_data.xml +94 -0
  5. odoo/addons/l10n_es_atc_mod415/data/tax_code_map_mod415_data.xml +91 -0
  6. odoo/addons/l10n_es_atc_mod415/i18n/es.po +1687 -0
  7. odoo/addons/l10n_es_atc_mod415/i18n/l10n_es_atc_mod415.pot +1075 -0
  8. odoo/addons/l10n_es_atc_mod415/models/__init__.py +5 -0
  9. odoo/addons/l10n_es_atc_mod415/models/account_move.py +17 -0
  10. odoo/addons/l10n_es_atc_mod415/models/mod415.py +241 -0
  11. odoo/addons/l10n_es_atc_mod415/models/res_partner.py +24 -0
  12. odoo/addons/l10n_es_atc_mod415/readme/CONTRIBUTORS.rst +2 -0
  13. odoo/addons/l10n_es_atc_mod415/readme/DESCRIPTION.rst +3 -0
  14. odoo/addons/l10n_es_atc_mod415/readme/INSTALL.rst +0 -0
  15. odoo/addons/l10n_es_atc_mod415/security/ir.model.access.csv +5 -0
  16. odoo/addons/l10n_es_atc_mod415/security/mod_415_security.xml +9 -0
  17. odoo/addons/l10n_es_atc_mod415/static/description/icon.png +0 -0
  18. odoo/addons/l10n_es_atc_mod415/static/description/index.html +424 -0
  19. odoo/addons/l10n_es_atc_mod415/tests/__init__.py +3 -0
  20. odoo/addons/l10n_es_atc_mod415/tests/test_l10n_es_atc_mod415.py +213 -0
  21. odoo/addons/l10n_es_atc_mod415/views/account_move_view.xml +13 -0
  22. odoo/addons/l10n_es_atc_mod415/views/mod415_templates.xml +63 -0
  23. odoo/addons/l10n_es_atc_mod415/views/mod415_view.xml +137 -0
  24. odoo/addons/l10n_es_atc_mod415/views/report_415_partner.xml +22 -0
  25. odoo/addons/l10n_es_atc_mod415/views/res_partner_view.xml +18 -0
  26. odoo_addon_l10n_es_atc_mod415-16.0.1.0.0.2.dist-info/METADATA +108 -0
  27. odoo_addon_l10n_es_atc_mod415-16.0.1.0.0.2.dist-info/RECORD +29 -0
  28. odoo_addon_l10n_es_atc_mod415-16.0.1.0.0.2.dist-info/WHEEL +5 -0
  29. odoo_addon_l10n_es_atc_mod415-16.0.1.0.0.2.dist-info/top_level.txt +1 -0
@@ -0,0 +1,424 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
6
+ <title>ATC Modelo 415</title>
7
+ <style type="text/css">
8
+
9
+ /*
10
+ :Author: David Goodger (goodger@python.org)
11
+ :Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
12
+ :Copyright: This stylesheet has been placed in the public domain.
13
+
14
+ Default cascading style sheet for the HTML output of Docutils.
15
+
16
+ See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
17
+ customize this style sheet.
18
+ */
19
+
20
+ /* used to remove borders from tables and images */
21
+ .borderless, table.borderless td, table.borderless th {
22
+ border: 0 }
23
+
24
+ table.borderless td, table.borderless th {
25
+ /* Override padding for "table.docutils td" with "! important".
26
+ The right padding separates the table cells. */
27
+ padding: 0 0.5em 0 0 ! important }
28
+
29
+ .first {
30
+ /* Override more specific margin styles with "! important". */
31
+ margin-top: 0 ! important }
32
+
33
+ .last, .with-subtitle {
34
+ margin-bottom: 0 ! important }
35
+
36
+ .hidden {
37
+ display: none }
38
+
39
+ .subscript {
40
+ vertical-align: sub;
41
+ font-size: smaller }
42
+
43
+ .superscript {
44
+ vertical-align: super;
45
+ font-size: smaller }
46
+
47
+ a.toc-backref {
48
+ text-decoration: none ;
49
+ color: black }
50
+
51
+ blockquote.epigraph {
52
+ margin: 2em 5em ; }
53
+
54
+ dl.docutils dd {
55
+ margin-bottom: 0.5em }
56
+
57
+ object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
58
+ overflow: hidden;
59
+ }
60
+
61
+ /* Uncomment (and remove this text!) to get bold-faced definition list terms
62
+ dl.docutils dt {
63
+ font-weight: bold }
64
+ */
65
+
66
+ div.abstract {
67
+ margin: 2em 5em }
68
+
69
+ div.abstract p.topic-title {
70
+ font-weight: bold ;
71
+ text-align: center }
72
+
73
+ div.admonition, div.attention, div.caution, div.danger, div.error,
74
+ div.hint, div.important, div.note, div.tip, div.warning {
75
+ margin: 2em ;
76
+ border: medium outset ;
77
+ padding: 1em }
78
+
79
+ div.admonition p.admonition-title, div.hint p.admonition-title,
80
+ div.important p.admonition-title, div.note p.admonition-title,
81
+ div.tip p.admonition-title {
82
+ font-weight: bold ;
83
+ font-family: sans-serif }
84
+
85
+ div.attention p.admonition-title, div.caution p.admonition-title,
86
+ div.danger p.admonition-title, div.error p.admonition-title,
87
+ div.warning p.admonition-title, .code .error {
88
+ color: red ;
89
+ font-weight: bold ;
90
+ font-family: sans-serif }
91
+
92
+ /* Uncomment (and remove this text!) to get reduced vertical space in
93
+ compound paragraphs.
94
+ div.compound .compound-first, div.compound .compound-middle {
95
+ margin-bottom: 0.5em }
96
+
97
+ div.compound .compound-last, div.compound .compound-middle {
98
+ margin-top: 0.5em }
99
+ */
100
+
101
+ div.dedication {
102
+ margin: 2em 5em ;
103
+ text-align: center ;
104
+ font-style: italic }
105
+
106
+ div.dedication p.topic-title {
107
+ font-weight: bold ;
108
+ font-style: normal }
109
+
110
+ div.figure {
111
+ margin-left: 2em ;
112
+ margin-right: 2em }
113
+
114
+ div.footer, div.header {
115
+ clear: both;
116
+ font-size: smaller }
117
+
118
+ div.line-block {
119
+ display: block ;
120
+ margin-top: 1em ;
121
+ margin-bottom: 1em }
122
+
123
+ div.line-block div.line-block {
124
+ margin-top: 0 ;
125
+ margin-bottom: 0 ;
126
+ margin-left: 1.5em }
127
+
128
+ div.sidebar {
129
+ margin: 0 0 0.5em 1em ;
130
+ border: medium outset ;
131
+ padding: 1em ;
132
+ background-color: #ffffee ;
133
+ width: 40% ;
134
+ float: right ;
135
+ clear: right }
136
+
137
+ div.sidebar p.rubric {
138
+ font-family: sans-serif ;
139
+ font-size: medium }
140
+
141
+ div.system-messages {
142
+ margin: 5em }
143
+
144
+ div.system-messages h1 {
145
+ color: red }
146
+
147
+ div.system-message {
148
+ border: medium outset ;
149
+ padding: 1em }
150
+
151
+ div.system-message p.system-message-title {
152
+ color: red ;
153
+ font-weight: bold }
154
+
155
+ div.topic {
156
+ margin: 2em }
157
+
158
+ h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
159
+ h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
160
+ margin-top: 0.4em }
161
+
162
+ h1.title {
163
+ text-align: center }
164
+
165
+ h2.subtitle {
166
+ text-align: center }
167
+
168
+ hr.docutils {
169
+ width: 75% }
170
+
171
+ img.align-left, .figure.align-left, object.align-left, table.align-left {
172
+ clear: left ;
173
+ float: left ;
174
+ margin-right: 1em }
175
+
176
+ img.align-right, .figure.align-right, object.align-right, table.align-right {
177
+ clear: right ;
178
+ float: right ;
179
+ margin-left: 1em }
180
+
181
+ img.align-center, .figure.align-center, object.align-center {
182
+ display: block;
183
+ margin-left: auto;
184
+ margin-right: auto;
185
+ }
186
+
187
+ table.align-center {
188
+ margin-left: auto;
189
+ margin-right: auto;
190
+ }
191
+
192
+ .align-left {
193
+ text-align: left }
194
+
195
+ .align-center {
196
+ clear: both ;
197
+ text-align: center }
198
+
199
+ .align-right {
200
+ text-align: right }
201
+
202
+ /* reset inner alignment in figures */
203
+ div.align-right {
204
+ text-align: inherit }
205
+
206
+ /* div.align-center * { */
207
+ /* text-align: left } */
208
+
209
+ .align-top {
210
+ vertical-align: top }
211
+
212
+ .align-middle {
213
+ vertical-align: middle }
214
+
215
+ .align-bottom {
216
+ vertical-align: bottom }
217
+
218
+ ol.simple, ul.simple {
219
+ margin-bottom: 1em }
220
+
221
+ ol.arabic {
222
+ list-style: decimal }
223
+
224
+ ol.loweralpha {
225
+ list-style: lower-alpha }
226
+
227
+ ol.upperalpha {
228
+ list-style: upper-alpha }
229
+
230
+ ol.lowerroman {
231
+ list-style: lower-roman }
232
+
233
+ ol.upperroman {
234
+ list-style: upper-roman }
235
+
236
+ p.attribution {
237
+ text-align: right ;
238
+ margin-left: 50% }
239
+
240
+ p.caption {
241
+ font-style: italic }
242
+
243
+ p.credits {
244
+ font-style: italic ;
245
+ font-size: smaller }
246
+
247
+ p.label {
248
+ white-space: nowrap }
249
+
250
+ p.rubric {
251
+ font-weight: bold ;
252
+ font-size: larger ;
253
+ color: maroon ;
254
+ text-align: center }
255
+
256
+ p.sidebar-title {
257
+ font-family: sans-serif ;
258
+ font-weight: bold ;
259
+ font-size: larger }
260
+
261
+ p.sidebar-subtitle {
262
+ font-family: sans-serif ;
263
+ font-weight: bold }
264
+
265
+ p.topic-title {
266
+ font-weight: bold }
267
+
268
+ pre.address {
269
+ margin-bottom: 0 ;
270
+ margin-top: 0 ;
271
+ font: inherit }
272
+
273
+ pre.literal-block, pre.doctest-block, pre.math, pre.code {
274
+ margin-left: 2em ;
275
+ margin-right: 2em }
276
+
277
+ pre.code .ln { color: grey; } /* line numbers */
278
+ pre.code, code { background-color: #eeeeee }
279
+ pre.code .comment, code .comment { color: #5C6576 }
280
+ pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
281
+ pre.code .literal.string, code .literal.string { color: #0C5404 }
282
+ pre.code .name.builtin, code .name.builtin { color: #352B84 }
283
+ pre.code .deleted, code .deleted { background-color: #DEB0A1}
284
+ pre.code .inserted, code .inserted { background-color: #A3D289}
285
+
286
+ span.classifier {
287
+ font-family: sans-serif ;
288
+ font-style: oblique }
289
+
290
+ span.classifier-delimiter {
291
+ font-family: sans-serif ;
292
+ font-weight: bold }
293
+
294
+ span.interpreted {
295
+ font-family: sans-serif }
296
+
297
+ span.option {
298
+ white-space: nowrap }
299
+
300
+ span.pre {
301
+ white-space: pre }
302
+
303
+ span.problematic {
304
+ color: red }
305
+
306
+ span.section-subtitle {
307
+ /* font-size relative to parent (h1..h6 element) */
308
+ font-size: 80% }
309
+
310
+ table.citation {
311
+ border-left: solid 1px gray;
312
+ margin-left: 1px }
313
+
314
+ table.docinfo {
315
+ margin: 2em 4em }
316
+
317
+ table.docutils {
318
+ margin-top: 0.5em ;
319
+ margin-bottom: 0.5em }
320
+
321
+ table.footnote {
322
+ border-left: solid 1px black;
323
+ margin-left: 1px }
324
+
325
+ table.docutils td, table.docutils th,
326
+ table.docinfo td, table.docinfo th {
327
+ padding-left: 0.5em ;
328
+ padding-right: 0.5em ;
329
+ vertical-align: top }
330
+
331
+ table.docutils th.field-name, table.docinfo th.docinfo-name {
332
+ font-weight: bold ;
333
+ text-align: left ;
334
+ white-space: nowrap ;
335
+ padding-left: 0 }
336
+
337
+ /* "booktabs" style (no vertical lines) */
338
+ table.docutils.booktabs {
339
+ border: 0px;
340
+ border-top: 2px solid;
341
+ border-bottom: 2px solid;
342
+ border-collapse: collapse;
343
+ }
344
+ table.docutils.booktabs * {
345
+ border: 0px;
346
+ }
347
+ table.docutils.booktabs th {
348
+ border-bottom: thin solid;
349
+ text-align: left;
350
+ }
351
+
352
+ h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
353
+ h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
354
+ font-size: 100% }
355
+
356
+ ul.auto-toc {
357
+ list-style-type: none }
358
+
359
+ </style>
360
+ </head>
361
+ <body>
362
+ <div class="document" id="atc-modelo-415">
363
+ <h1 class="title">ATC Modelo 415</h1>
364
+
365
+ <!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
366
+ !! This file is generated by oca-gen-addon-readme !!
367
+ !! changes will be overwritten. !!
368
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
369
+ !! source digest: sha256:e9a2359368716909526d77d3a8e3d31f629e90b07ff12a326fb764bae8c45ef9
370
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
371
+ <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/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-spain/tree/16.0/l10n_es_atc_mod415"><img alt="OCA/l10n-spain" src="https://img.shields.io/badge/github-OCA%2Fl10n--spain-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/l10n-spain-16-0/l10n-spain-16-0-l10n_es_atc_mod415"><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-spain&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
372
+ <p>Módulo para la presentación del modelo 415 de la Agencia Tributaria Canaria.</p>
373
+ <p>Instrucciones del modelo: <a class="reference external" href="https://www3.gobiernodecanarias.org/tributos/atc/estatico/asistencia_contribuyente/modelos/ref_y_propios/igic/mod415/pdf/instrucciones/415.pdf">https://www3.gobiernodecanarias.org/tributos/atc/estatico/asistencia_contribuyente/modelos/ref_y_propios/igic/mod415/pdf/instrucciones/415.pdf</a></p>
374
+ <p><strong>Table of contents</strong></p>
375
+ <div class="contents local topic" id="contents">
376
+ <ul class="simple">
377
+ <li><a class="reference internal" href="#bug-tracker" id="toc-entry-1">Bug Tracker</a></li>
378
+ <li><a class="reference internal" href="#credits" id="toc-entry-2">Credits</a><ul>
379
+ <li><a class="reference internal" href="#authors" id="toc-entry-3">Authors</a></li>
380
+ <li><a class="reference internal" href="#contributors" id="toc-entry-4">Contributors</a></li>
381
+ <li><a class="reference internal" href="#maintainers" id="toc-entry-5">Maintainers</a></li>
382
+ </ul>
383
+ </li>
384
+ </ul>
385
+ </div>
386
+ <div class="section" id="bug-tracker">
387
+ <h1><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h1>
388
+ <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/l10n-spain/issues">GitHub Issues</a>.
389
+ In case of trouble, please check there if your issue has already been reported.
390
+ If you spotted it first, help us to smash it by providing a detailed and welcomed
391
+ <a class="reference external" href="https://github.com/OCA/l10n-spain/issues/new?body=module:%20l10n_es_atc_mod415%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
392
+ <p>Do not contact contributors directly about support or help with technical issues.</p>
393
+ </div>
394
+ <div class="section" id="credits">
395
+ <h1><a class="toc-backref" href="#toc-entry-2">Credits</a></h1>
396
+ <div class="section" id="authors">
397
+ <h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
398
+ <ul class="simple">
399
+ <li>Binhex System Solutions</li>
400
+ </ul>
401
+ </div>
402
+ <div class="section" id="contributors">
403
+ <h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
404
+ <ul class="simple">
405
+ <li>Nicolás Ramos &lt;<a class="reference external" href="mailto:n.ramos&#64;binhex.es">n.ramos&#64;binhex.es</a>&gt;</li>
406
+ <li>Christian Ramos &lt;<a class="reference external" href="mailto:c.ramos&#64;binhex.es">c.ramos&#64;binhex.es</a>&gt;</li>
407
+ </ul>
408
+ </div>
409
+ <div class="section" id="maintainers">
410
+ <h2><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h2>
411
+ <p>This module is maintained by the OCA.</p>
412
+ <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
413
+ <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
414
+ mission is to support the collaborative development of Odoo features and
415
+ promote its widespread use.</p>
416
+ <p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
417
+ <p><a class="reference external image-reference" href="https://github.com/Christian-RB"><img alt="Christian-RB" src="https://github.com/Christian-RB.png?size=40px" /></a></p>
418
+ <p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-spain/tree/16.0/l10n_es_atc_mod415">OCA/l10n-spain</a> project on GitHub.</p>
419
+ <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
420
+ </div>
421
+ </div>
422
+ </div>
423
+ </body>
424
+ </html>
@@ -0,0 +1,3 @@
1
+ # License AGPL-3 - See https://www.gnu.org/licenses/agpl-3.0.html
2
+
3
+ from . import test_l10n_es_atc_mod415
@@ -0,0 +1,213 @@
1
+ ##############################################################################
2
+ #
3
+ # Copyright 2019 Tecnativa - Pedro M. Baeza
4
+ # Copyright (c) 2023 Binhex System Solutions
5
+ # Copyright (c) 2023 Nicolás Ramos (http://binhex.es)
6
+ #
7
+ # The licence is in the file __manifest__.py
8
+ ##############################################################################
9
+
10
+ import logging
11
+
12
+ from odoo.tests.common import Form
13
+
14
+ from odoo.addons.l10n_es_aeat.tests.test_l10n_es_aeat_mod_base import (
15
+ TestL10nEsAeatModBase,
16
+ )
17
+
18
+ _logger = logging.getLogger("atc")
19
+
20
+
21
+ class TestL10nEsAtcMod415(TestL10nEsAeatModBase):
22
+ @classmethod
23
+ def _chart_of_accounts_create(cls):
24
+ _logger.debug("Creating chart of account")
25
+ cls.company = cls.env["res.company"].create(
26
+ {"name": "Canary test company", "currency_id": cls.env.ref("base.EUR").id}
27
+ )
28
+ cls.chart = cls.env.ref("l10n_es_igic.account_chart_template_pymes_canary")
29
+ cls.env.ref("base.group_multi_company").write({"users": [(4, cls.env.uid)]})
30
+ cls.env.user.write(
31
+ {"company_ids": [(4, cls.company.id)], "company_id": cls.company.id}
32
+ )
33
+ chart = cls.env.ref("l10n_es_igic.account_chart_template_pymes_canary")
34
+ chart.try_loading()
35
+ cls.with_context(company_id=cls.company.id)
36
+ return True
37
+
38
+ @classmethod
39
+ def setUpClass(cls):
40
+ super().setUpClass()
41
+ # Create model
42
+ cls.model415 = cls.env["l10n.es.atc.mod415.report"].create(
43
+ {
44
+ "name": "9990000000415",
45
+ "company_id": cls.company.id,
46
+ "company_vat": "1234567890",
47
+ "contact_name": "Test owner",
48
+ "statement_type": "N",
49
+ "support_type": "T",
50
+ "contact_phone": "911234455",
51
+ "year": 2019,
52
+ "date_start": "2019-01-01",
53
+ "date_end": "2019-12-31",
54
+ }
55
+ )
56
+ cls.customer_2 = cls.customer.copy(
57
+ {"name": "Test customer 2", "vat": "ES12345678Z"}
58
+ )
59
+ cls.customer_3 = cls.customer.copy({"name": "Test customer 3"})
60
+ cls.customer_4 = cls.customer.copy(
61
+ {"name": "Test customer 4", "vat": "ESB29805314"}
62
+ )
63
+ # TODO: Zip set is not necessary https://github.com/odoo/odoo/pull/94333
64
+ cls.customer_5 = cls.customer.copy(
65
+ {
66
+ "name": "Test customer 5",
67
+ # For testing spanish states mapping
68
+ "country_id": cls.env.ref("base.es").id,
69
+ "vat": "12345678Z",
70
+ "zip": 28001,
71
+ }
72
+ )
73
+ cls.customer_6 = cls.customer.copy(
74
+ {
75
+ "name": "Test customer 6",
76
+ "country_id": cls.env.ref("base.es").id,
77
+ "vat": "B29805314",
78
+ "zip": 28001,
79
+ }
80
+ )
81
+ cls.supplier_2 = cls.supplier.copy({"name": "Test supplier 2"})
82
+ # Invoice lower than the limit
83
+ cls.taxes_sale = {
84
+ "l10n_es_igic.account_tax_template_igic_r_7": (2000, 140),
85
+ }
86
+ cls.invoice_1 = cls._invoice_sale_create("2019-01-01")
87
+ # Cancelled invoice - Shouldn't count for partner `customer`
88
+ cls.invoice_cancel = cls._invoice_sale_create("2019-01-01")
89
+ cls.invoice_cancel.button_cancel()
90
+ # Invoice higher than limit
91
+ cls.taxes_sale = {
92
+ "l10n_es_igic.account_tax_template_igic_r_7": (4000, 280),
93
+ }
94
+ cls.invoice_2 = cls._invoice_sale_create(
95
+ "2019-04-01", {"partner_id": cls.customer_2.id}
96
+ )
97
+ # # Invoice higher than limit manually excluded
98
+ cls.invoice_3 = cls._invoice_sale_create(
99
+ "2019-01-01", {"partner_id": cls.customer_3.id, "not_in_mod415": True}
100
+ )
101
+ # # Invoice higher than cash limit
102
+ cls.taxes_sale = {
103
+ "l10n_es_igic.account_tax_template_igic_r_7": (6000, 420),
104
+ }
105
+ cls.invoice_4 = cls._invoice_sale_create(
106
+ "2019-07-01", {"partner_id": cls.customer_4.id}
107
+ )
108
+ # Create payment from invoice
109
+ cls.payment_model = cls.env["account.payment.register"]
110
+ payment_form = Form(
111
+ cls.payment_model.with_context(
112
+ active_model="account.move", active_ids=cls.invoice_4.ids
113
+ )
114
+ )
115
+ payment_form.journal_id = cls.journal_cash
116
+ payment_form.payment_date = "2019-07-01"
117
+ payment_form.save().action_create_payments()
118
+ # Invoice outside period higher than cash limit
119
+ cls.invoice_5 = cls._invoice_sale_create(
120
+ "2018-01-01", {"partner_id": cls.customer_5.id}
121
+ )
122
+ payment_form = Form(
123
+ cls.payment_model.with_context(
124
+ active_model="account.move", active_ids=cls.invoice_5.ids
125
+ )
126
+ )
127
+ payment_form.journal_id = cls.journal_cash
128
+ payment_form.payment_date = "2019-01-01"
129
+ payment_form.save().action_create_payments()
130
+ # Customer refund higher than limit
131
+ cls.taxes_sale = {
132
+ "l10n_es_igic.account_tax_template_igic_r_7": (5000, 350),
133
+ }
134
+ cls.invoice_5 = cls._invoice_sale_create(
135
+ "2019-01-01", {"partner_id": cls.customer_6.id, "move_type": "out_refund"}
136
+ )
137
+ # Purchase invoice higher than the limit
138
+ cls.taxes_purchase = {
139
+ "l10n_es_igic.account_tax_template_igic_sop_7": (3000, 210),
140
+ }
141
+ cls.invoice_suppler_1 = cls._invoice_purchase_create("2019-01-01")
142
+ # Supplier refund higher than limit
143
+ cls.taxes_purchase = {
144
+ "l10n_es_igic.account_tax_template_igic_sop_7": (4000, 280),
145
+ }
146
+ cls.invoice_suppler_2 = cls._invoice_purchase_create(
147
+ "2019-01-01", {"partner_id": cls.supplier_2.id, "move_type": "in_refund"}
148
+ )
149
+
150
+ def test_model_415(self):
151
+ # Check flag propagation
152
+ self.assertFalse(self.invoice_1.not_in_mod415)
153
+ self.assertTrue(self.invoice_3.not_in_mod415)
154
+ # Check model
155
+ self.model415.button_calculate()
156
+ partner_record_vals = [
157
+ # key, partner, amount, cash_amount, 1T, 2T, 3T, 4T
158
+ ("A", self.supplier, 3210, 0, 3210, 0, 0, 0),
159
+ ("A", self.supplier_2, -4280, 0, -4280, 0, 0, 0),
160
+ ("B", self.customer_2, 4280, 0, 0, 4280, 0, 0),
161
+ ("B", self.customer_4, 6420, 6420, 0, 0, 6420, 0),
162
+ ("B", self.customer_6, -5350, 0, -5350, 0, 0, 0),
163
+ ("B", self.customer_5, 0, 6420, 0, 0, 0, 0),
164
+ ]
165
+ self.assertEqual(self.model415.total_partner_records, len(partner_record_vals))
166
+ self.assertAlmostEqual(
167
+ self.model415.total_amount, sum(x[2] for x in partner_record_vals)
168
+ )
169
+ self.assertAlmostEqual(
170
+ self.model415.total_cash_amount, sum(x[3] for x in partner_record_vals)
171
+ )
172
+ for vals in partner_record_vals:
173
+ partner_record = self.model415.partner_record_ids.filtered(
174
+ lambda x: x.partner_id == vals[1]
175
+ )
176
+ self.assertEqual(partner_record.operation_key, vals[0])
177
+ self.assertAlmostEqual(partner_record.amount, vals[2])
178
+ self.assertAlmostEqual(partner_record.cash_amount, vals[3])
179
+ self.assertAlmostEqual(partner_record.first_quarter, vals[4])
180
+ self.assertAlmostEqual(partner_record.second_quarter, vals[5])
181
+ self.assertAlmostEqual(partner_record.third_quarter, vals[6])
182
+ self.assertAlmostEqual(partner_record.fourth_quarter, vals[7])
183
+ # Check VAT handle
184
+ partner_record = self.model415.partner_record_ids.filtered(
185
+ lambda x: x.partner_id == self.customer_2
186
+ )
187
+ self.assertEqual(partner_record.partner_vat, "12345678Z")
188
+ self.assertEqual(partner_record.partner_country_code, "ES")
189
+ partner_record = self.model415.partner_record_ids.filtered(
190
+ lambda x: x.partner_id == self.customer_4
191
+ )
192
+ self.assertEqual(partner_record.partner_vat, "B29805314")
193
+ self.assertEqual(partner_record.partner_country_code, "ES")
194
+ partner_record = self.model415.partner_record_ids.filtered(
195
+ lambda x: x.partner_id == self.customer_5
196
+ )
197
+ self.assertEqual(partner_record.partner_vat, "12345678Z")
198
+ self.assertEqual(partner_record.partner_country_code, "ES")
199
+ partner_record = self.model415.partner_record_ids.filtered(
200
+ lambda x: x.partner_id == self.customer_6
201
+ )
202
+ self.assertEqual(partner_record.partner_vat, "B29805314")
203
+ self.assertEqual(partner_record.partner_country_code, "ES")
204
+ # # Export to BOE
205
+ # export_to_boe = self.env["l10n.es.aeat.report.export_to_boe"].create(
206
+ # {"name": "test_export_to_boe.txt"}
207
+ # )
208
+ # export_config_xml_ids = [
209
+ # "l10n_es_atc_mod415.aeat_mod415_main_export_config",
210
+ # ]
211
+ # for xml_id in export_config_xml_ids:
212
+ # export_config = self.env.ref(xml_id)
213
+ # self.assertTrue(export_to_boe._export_config(self.model415, export_config))
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <odoo>
3
+ <record id="view_move_form_mod415" model="ir.ui.view">
4
+ <field name="name">account.move.supplier.form.mod415</field>
5
+ <field name="model">account.move</field>
6
+ <field name="inherit_id" ref="account.view_move_form" />
7
+ <field name="arch" type="xml">
8
+ <xpath expr="//div[@name='journal_div']" position="after">
9
+ <field name="not_in_mod415" />
10
+ </xpath>
11
+ </field>
12
+ </record>
13
+ </odoo>