odoo-addon-l10n-es-aeat-sii-oca 16.0.2.5.3__py3-none-any.whl → 17.0.1.0.0.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.
Files changed (69) hide show
  1. odoo/addons/l10n_es_aeat_sii_oca/README.rst +73 -86
  2. odoo/addons/l10n_es_aeat_sii_oca/__manifest__.py +7 -6
  3. odoo/addons/l10n_es_aeat_sii_oca/data/aeat_sii_map_data.xml +203 -187
  4. odoo/addons/l10n_es_aeat_sii_oca/data/aeat_sii_tax_agency_data.xml +0 -25
  5. odoo/addons/l10n_es_aeat_sii_oca/data/ir_config_parameter_data.xml +9 -0
  6. odoo/addons/l10n_es_aeat_sii_oca/data/ir_cron.xml +12 -0
  7. odoo/addons/l10n_es_aeat_sii_oca/data/l10n.es.aeat.map.tax.line.tax.csv +138 -0
  8. odoo/addons/l10n_es_aeat_sii_oca/hooks.py +3 -6
  9. odoo/addons/l10n_es_aeat_sii_oca/i18n/bg.po +0 -33
  10. odoo/addons/l10n_es_aeat_sii_oca/i18n/ca.po +0 -33
  11. odoo/addons/l10n_es_aeat_sii_oca/i18n/cs.po +0 -33
  12. odoo/addons/l10n_es_aeat_sii_oca/i18n/de.po +0 -33
  13. odoo/addons/l10n_es_aeat_sii_oca/i18n/es.po +3 -33
  14. odoo/addons/l10n_es_aeat_sii_oca/i18n/es_CO.po +0 -33
  15. odoo/addons/l10n_es_aeat_sii_oca/i18n/es_CR.po +0 -33
  16. odoo/addons/l10n_es_aeat_sii_oca/i18n/eu.po +0 -33
  17. odoo/addons/l10n_es_aeat_sii_oca/i18n/fr.po +0 -33
  18. odoo/addons/l10n_es_aeat_sii_oca/i18n/gl.po +0 -33
  19. odoo/addons/l10n_es_aeat_sii_oca/i18n/hr.po +0 -33
  20. odoo/addons/l10n_es_aeat_sii_oca/i18n/l10n_es_aeat_sii_oca.pot +92 -82
  21. odoo/addons/l10n_es_aeat_sii_oca/i18n/nl.po +0 -33
  22. odoo/addons/l10n_es_aeat_sii_oca/i18n/pl.po +0 -33
  23. odoo/addons/l10n_es_aeat_sii_oca/i18n/pt.po +0 -33
  24. odoo/addons/l10n_es_aeat_sii_oca/i18n/pt_BR.po +0 -33
  25. odoo/addons/l10n_es_aeat_sii_oca/i18n/ru.po +0 -33
  26. odoo/addons/l10n_es_aeat_sii_oca/i18n/sl.po +0 -33
  27. odoo/addons/l10n_es_aeat_sii_oca/i18n/sv.po +0 -33
  28. odoo/addons/l10n_es_aeat_sii_oca/i18n/tr.po +0 -33
  29. odoo/addons/l10n_es_aeat_sii_oca/i18n/vi.po +0 -33
  30. odoo/addons/l10n_es_aeat_sii_oca/models/__init__.py +0 -1
  31. odoo/addons/l10n_es_aeat_sii_oca/models/account_move.py +142 -49
  32. odoo/addons/l10n_es_aeat_sii_oca/models/aeat_sii_map.py +3 -1
  33. odoo/addons/l10n_es_aeat_sii_oca/models/aeat_sii_mapping_registration_keys.py +1 -1
  34. odoo/addons/l10n_es_aeat_sii_oca/models/res_company.py +8 -9
  35. odoo/addons/l10n_es_aeat_sii_oca/models/sii_mixin.py +60 -58
  36. odoo/addons/l10n_es_aeat_sii_oca/readme/CONFIGURE.md +20 -0
  37. odoo/addons/l10n_es_aeat_sii_oca/readme/CONTRIBUTORS.md +24 -0
  38. odoo/addons/l10n_es_aeat_sii_oca/readme/DESCRIPTION.md +2 -0
  39. odoo/addons/l10n_es_aeat_sii_oca/readme/INSTALL.md +6 -0
  40. odoo/addons/l10n_es_aeat_sii_oca/readme/ROADMAP.md +12 -0
  41. odoo/addons/l10n_es_aeat_sii_oca/readme/{USAGE.rst → USAGE.md} +2 -2
  42. odoo/addons/l10n_es_aeat_sii_oca/security/ir.model.access.csv +0 -1
  43. odoo/addons/l10n_es_aeat_sii_oca/static/description/index.html +33 -46
  44. odoo/addons/l10n_es_aeat_sii_oca/tests/json/sii_in_invoice_p_iva21_ibc_group_dict.json +24 -0
  45. odoo/addons/l10n_es_aeat_sii_oca/tests/test_l10n_es_aeat_sii.py +71 -50
  46. odoo/addons/l10n_es_aeat_sii_oca/views/account_fiscal_position_view.xml +6 -16
  47. odoo/addons/l10n_es_aeat_sii_oca/views/account_journal_view.xml +2 -4
  48. odoo/addons/l10n_es_aeat_sii_oca/views/account_move_views.xml +39 -70
  49. odoo/addons/l10n_es_aeat_sii_oca/views/aeat_sii_map_view.xml +1 -1
  50. odoo/addons/l10n_es_aeat_sii_oca/views/res_company_view.xml +6 -10
  51. odoo/addons/l10n_es_aeat_sii_oca/wizards/account_move_reversal.py +9 -8
  52. odoo/addons/l10n_es_aeat_sii_oca/wizards/account_move_reversal_views.xml +4 -2
  53. odoo/addons/l10n_es_aeat_sii_oca/wizards/account_move_send_sii.py +15 -19
  54. odoo/addons/l10n_es_aeat_sii_oca/wizards/account_move_send_sii_views.xml +38 -5
  55. {odoo_addon_l10n_es_aeat_sii_oca-16.0.2.5.3.dist-info → odoo_addon_l10n_es_aeat_sii_oca-17.0.1.0.0.3.dist-info}/METADATA +84 -96
  56. {odoo_addon_l10n_es_aeat_sii_oca-16.0.2.5.3.dist-info → odoo_addon_l10n_es_aeat_sii_oca-17.0.1.0.0.3.dist-info}/RECORD +58 -59
  57. {odoo_addon_l10n_es_aeat_sii_oca-16.0.2.5.3.dist-info → odoo_addon_l10n_es_aeat_sii_oca-17.0.1.0.0.3.dist-info}/WHEEL +1 -1
  58. odoo_addon_l10n_es_aeat_sii_oca-17.0.1.0.0.3.dist-info/top_level.txt +1 -0
  59. odoo/addons/l10n_es_aeat_sii_oca/data/aeat_sii_queue_job.xml +0 -17
  60. odoo/addons/l10n_es_aeat_sii_oca/migrations/16.0.1.4.0/post-migration.py +0 -18
  61. odoo/addons/l10n_es_aeat_sii_oca/models/queue_job.py +0 -18
  62. odoo/addons/l10n_es_aeat_sii_oca/readme/CONFIGURE.rst +0 -39
  63. odoo/addons/l10n_es_aeat_sii_oca/readme/CONTRIBUTORS.rst +0 -25
  64. odoo/addons/l10n_es_aeat_sii_oca/readme/DESCRIPTION.rst +0 -2
  65. odoo/addons/l10n_es_aeat_sii_oca/readme/INSTALL.rst +0 -8
  66. odoo/addons/l10n_es_aeat_sii_oca/readme/ROADMAP.rst +0 -10
  67. odoo/addons/l10n_es_aeat_sii_oca/security/aeat_sii.xml +0 -17
  68. odoo/addons/l10n_es_aeat_sii_oca/views/queue_job_views.xml +0 -38
  69. odoo_addon_l10n_es_aeat_sii_oca-16.0.2.5.3.dist-info/top_level.txt +0 -1
@@ -367,9 +367,9 @@ ul.auto-toc {
367
367
  !! This file is generated by oca-gen-addon-readme !!
368
368
  !! changes will be overwritten. !!
369
369
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370
- !! source digest: sha256:291b9c7201dc3ca939704f547e640202df3bb69b45d2c8a6b029c68f1f590d88
370
+ !! source digest: sha256:c665082ccf28cc1d751ccde824b8c0f71db2333da2414c5e415e79fe0ee96383
371
371
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372
- <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.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_aeat_sii_oca"><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_aeat_sii_oca"><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><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.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/17.0/l10n_es_aeat_sii_oca"><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-17-0/l10n-spain-17-0-l10n_es_aeat_sii_oca"><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=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373
373
  <p>Módulo para la presentación inmediata del IVA
374
374
  <a class="reference external" href="https://www.agenciatributaria.es/static_files/AEAT/Contenidos_Comunes/La_Agencia_Tributaria/Modelos_y_formularios/Suministro_inmediato_informacion/FicherosSuministros/V_1_1/SII_Descripcion_ServicioWeb_v1.1.pdf">https://www.agenciatributaria.es/static_files/AEAT/Contenidos_Comunes/La_Agencia_Tributaria/Modelos_y_formularios/Suministro_inmediato_informacion/FicherosSuministros/V_1_1/SII_Descripcion_ServicioWeb_v1.1.pdf</a></p>
375
375
  <p><strong>Table of contents</strong></p>
@@ -392,11 +392,11 @@ ul.auto-toc {
392
392
  <h1><a class="toc-backref" href="#toc-entry-1">Installation</a></h1>
393
393
  <p>Para instalar esté módulo necesita:</p>
394
394
  <ol class="arabic simple">
395
- <li>Libreria Python Zeep, se puede instalar con el comando ‘pip install zeep’</li>
396
- <li>Libreria Python Requests, se puede instalar con el comando ‘pip install requests’</li>
395
+ <li>Libreria Python Zeep, se puede instalar con el comando ‘pip install
396
+ zeep’</li>
397
+ <li>Libreria Python Requests, se puede instalar con el comando ‘pip
398
+ install requests’</li>
397
399
  </ol>
398
- <p>y el módulo <cite>queue_job</cite> que se encuentra en:</p>
399
- <p><a class="reference external" href="https://github.com/OCA/queue">https://github.com/OCA/queue</a></p>
400
400
  </div>
401
401
  <div class="section" id="configuration">
402
402
  <h1><a class="toc-backref" href="#toc-entry-2">Configuration</a></h1>
@@ -404,60 +404,44 @@ ul.auto-toc {
404
404
  <ol class="arabic simple">
405
405
  <li>En la compañia se almacenan las URLs del servicio SOAP de hacienda.
406
406
  Estas URLs pueden cambiar según comunidades</li>
407
- <li>Los certificados deben alojarse en una carpeta accesible por la instalación
408
- de Odoo.</li>
409
- <li>Preparar el certificado. El certificado enviado por la FMNT es en formato
410
- p12, este certificado no se puede usar directamente con Zeep. Se tiene que
411
- extraer la clave pública y la clave privada.</li>
407
+ <li>Los certificados deben alojarse en una carpeta accesible por la
408
+ instalación de Odoo.</li>
409
+ <li>Preparar el certificado. El certificado enviado por la FMNT es en
410
+ formato p12, este certificado no se puede usar directamente con Zeep.
411
+ Se tiene que extraer la clave pública y la clave privada.</li>
412
412
  </ol>
413
+ <p>El parámetro del sistema l10n_es_aeat_sii_oca.sii_batch almacena el
414
+ número de facturas máximo que se enviarán al SII cada vez que se realice
415
+ un envío. El valor por defecto es 50.</p>
413
416
  <p>En Linux se pueden usar los siguientes comandos:</p>
414
417
  <ul class="simple">
415
- <li>Clave pública: “openssl pkcs12 -in Certificado.p12 -nokeys -out publicCert.crt -nodes”</li>
416
- <li>Clave privada: “openssl pkcs12 -in Certifcado.p12 -nocerts -out privateKey.pem -nodes”</li>
418
+ <li>Clave pública: “openssl pkcs12 -in Certificado.p12 -nokeys -out
419
+ publicCert.crt -nodes”</li>
420
+ <li>Clave privada: “openssl pkcs12 -in Certifcado.p12 -nocerts -out
421
+ privateKey.pem -nodes”</li>
417
422
  </ul>
418
- <p>Además, el módulo <cite>queue_job</cite> necesita estar configurado de una de estas formas:</p>
419
- <ol class="arabic">
420
- <li><p class="first">Ajustando variables de entorno:</p>
421
- <blockquote>
422
- <p>ODOO_QUEUE_JOB_CHANNELS=root:4</p>
423
- </blockquote>
424
- <p>u otro canal de configuración. Por defecto es root:1</p>
425
- <p>Si xmlrpc_port no está definido: ODOO_QUEUE_JOB_PORT=8069</p>
426
- </li>
427
- <li><p class="first">Otra alternativa es usuando un fichero de configuración:</p>
428
- <blockquote>
429
- <p>[options]
430
- (…)
431
- workers = 4
432
- server_wide_modules = web,base_sparse_field,queue_job</p>
433
- <p>(…)
434
- [queue_job]
435
- channels = root:4</p>
436
- </blockquote>
437
- </li>
438
- <li><p class="first">Por último, arrancando Odoo con –load=web,base_sparse_field,queue_job y –workers más grande que 1.</p>
439
- </li>
440
- </ol>
441
- <p>Más información <a class="reference external" href="http://odoo-connector.com">http://odoo-connector.com</a></p>
442
423
  </div>
443
424
  <div class="section" id="usage">
444
425
  <h1><a class="toc-backref" href="#toc-entry-3">Usage</a></h1>
445
- <p>Cuando se valida una factura automáticamente envia la comunicación al servidor
446
- de AEAT.</p>
426
+ <p>Cuando se valida una factura automáticamente envia la comunicación al
427
+ servidor de AEAT.</p>
447
428
  </div>
448
429
  <div class="section" id="known-issues-roadmap">
449
430
  <h1><a class="toc-backref" href="#toc-entry-4">Known issues / Roadmap</a></h1>
450
431
  <ul class="simple">
451
432
  <li>Comunicación de cobros y pagos.</li>
452
433
  <li>Determinadas facturas intracomunitarias (Articulo 66 RIVA).</li>
453
- <li>Facturas de tipo F6 (justificantes contables).</li>
454
434
  <li>Asistente para consultar los documentos comunicados.</li>
455
435
  <li>Libro de bienes de inversión (Libro anual se crea un módulo aparte).</li>
456
- <li>Regímenes especiales de seguros, de agencias de viaje o de bienes usados.</li>
436
+ <li>Regímenes especiales de seguros, de agencias de viaje o de bienes
437
+ usados.</li>
457
438
  <li>Devolución de IVA de viajeros.</li>
458
439
  <li>Facturas rectificativas por sustitución.</li>
459
- <li>Soportar facturas de canje de facturas simplificadas por facturas completas.
460
- Ver <a class="reference external" href="https://github.com/OCA/l10n-spain/issues/1171">https://github.com/OCA/l10n-spain/issues/1171</a> para más información.</li>
440
+ <li>Sistema de control de número de reintentos en caso de error en el
441
+ envío.</li>
442
+ <li>Soportar facturas de canje de facturas simplificadas por facturas
443
+ completas. Ver <a class="reference external" href="https://github.com/OCA/l10n-spain/issues/1171">https://github.com/OCA/l10n-spain/issues/1171</a> para más
444
+ información.</li>
461
445
  </ul>
462
446
  </div>
463
447
  <div class="section" id="bug-tracker">
@@ -465,7 +449,7 @@ Ver <a class="reference external" href="https://github.com/OCA/l10n-spain/issues
465
449
  <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/l10n-spain/issues">GitHub Issues</a>.
466
450
  In case of trouble, please check there if your issue has already been reported.
467
451
  If you spotted it first, help us to smash it by providing a detailed and welcomed
468
- <a class="reference external" href="https://github.com/OCA/l10n-spain/issues/new?body=module:%20l10n_es_aeat_sii_oca%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
452
+ <a class="reference external" href="https://github.com/OCA/l10n-spain/issues/new?body=module:%20l10n_es_aeat_sii_oca%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
469
453
  <p>Do not contact contributors directly about support or help with technical issues.</p>
470
454
  </div>
471
455
  <div class="section" id="credits">
@@ -482,6 +466,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
482
466
  <li>Otherway</li>
483
467
  <li>Tecnativa</li>
484
468
  <li>Javi Melendez</li>
469
+ <li>Sygel</li>
485
470
  </ul>
486
471
  </div>
487
472
  <div class="section" id="contributors">
@@ -494,13 +479,15 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
494
479
  <li>Jordi Tolsà &lt;<a class="reference external" href="mailto:jordi&#64;studio73.es">jordi&#64;studio73.es</a>&gt;</li>
495
480
  <li>Ismael Calvo &lt;<a class="reference external" href="mailto:ismael.calvo&#64;factorlibre.es">ismael.calvo&#64;factorlibre.es</a>&gt;</li>
496
481
  <li>Omar Castiñeira - Comunitea S.L. &lt;<a class="reference external" href="mailto:omar&#64;comunitea.com">omar&#64;comunitea.com</a>&gt;</li>
497
- <li>Juanjo Algaz &lt;<a class="reference external" href="mailto:jalgaz&#64;gmail.com">jalgaz&#64;gmail.com</a>&gt;, Planeta Huerto &lt;<a class="reference external" href="mailto:juanjoalgaz&#64;planetahuerto.es">juanjoalgaz&#64;planetahuerto.es</a>&gt;</li>
482
+ <li>Juanjo Algaz &lt;<a class="reference external" href="mailto:jalgaz&#64;gmail.com">jalgaz&#64;gmail.com</a>&gt;, Planeta Huerto
483
+ &lt;<a class="reference external" href="mailto:juanjoalgaz&#64;planetahuerto.es">juanjoalgaz&#64;planetahuerto.es</a>&gt;</li>
498
484
  <li>Javi Melendez &lt;<a class="reference external" href="mailto:javimelex&#64;gmail.com">javimelex&#64;gmail.com</a>&gt;</li>
499
485
  <li>Santi Argüeso - Comunitea S.L. &lt;<a class="reference external" href="mailto:santi&#64;comunitea.com">santi&#64;comunitea.com</a>&gt;</li>
500
486
  <li>Angel Moya - PESOL &lt;<a class="reference external" href="mailto:angel.moya&#64;pesol.es">angel.moya&#64;pesol.es</a>&gt;</li>
501
487
  <li>Eric Antonés - NuoBiT Solutions, S.L. &lt;<a class="reference external" href="mailto:eantones&#64;nuobit.com">eantones&#64;nuobit.com</a>&gt;</li>
502
488
  <li><a class="reference external" href="https://www.sygel.es">Sygel</a>:<ul>
503
489
  <li>Valentin Vinagre</li>
490
+ <li>Manuel Regidor</li>
504
491
  </ul>
505
492
  </li>
506
493
  <li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
@@ -528,7 +515,7 @@ mission is to support the collaborative development of Odoo features and
528
515
  promote its widespread use.</p>
529
516
  <p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
530
517
  <p><a class="reference external image-reference" href="https://github.com/pedrobaeza"><img alt="pedrobaeza" src="https://github.com/pedrobaeza.png?size=40px" /></a></p>
531
- <p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-spain/tree/16.0/l10n_es_aeat_sii_oca">OCA/l10n-spain</a> project on GitHub.</p>
518
+ <p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-spain/tree/17.0/l10n_es_aeat_sii_oca">OCA/l10n-spain</a> project on GitHub.</p>
532
519
  <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>
533
520
  </div>
534
521
  </div>
@@ -0,0 +1,24 @@
1
+ {
2
+ "IDFactura": {
3
+ "FechaExpedicionFacturaEmisor": "01-01-2020",
4
+ "NumSerieFacturaEmisor": "sup0001",
5
+ "IDEmisorFactura": {"NIF": "U2687761C"}
6
+ },
7
+ "FacturaRecibida": {
8
+ "TipoFactura": "F5",
9
+ "Contraparte": {"NombreRazon": "Spanish test company", "NIF": "U2687761C"},
10
+ "IDEmisorFactura": {"NIF": "U2687761C"},
11
+ "DescripcionOperacion": "/",
12
+ "ClaveRegimenEspecialOTrascendencia": "01",
13
+ "FechaRegContable": "01-10-2020",
14
+ "DesgloseFactura": {
15
+ "DesgloseIVA": {
16
+ "DetalleIVA": [
17
+ {"BaseImponible": 83.33, "CuotaSoportada": 17.5, "TipoImpositivo": "21.0"}
18
+ ]
19
+ }
20
+ },
21
+ "CuotaDeducible": 17.5
22
+ },
23
+ "PeriodoLiquidacion": {"Periodo": "01", "Ejercicio": 2020}
24
+ }
@@ -9,7 +9,7 @@
9
9
  import json
10
10
 
11
11
  from odoo import exceptions
12
- from odoo.modules.module import get_resource_path
12
+ from odoo.tools.misc import file_path
13
13
 
14
14
  from odoo.addons.l10n_es_aeat.tests.test_l10n_es_aeat_certificate import (
15
15
  TestL10nEsAeatCertificateBase,
@@ -52,13 +52,9 @@ class TestL10nEsAeatSiiBase(TestL10nEsAeatModBase, TestL10nEsAeatCertificateBase
52
52
  for line in lines:
53
53
  taxes = self.env["account.tax"]
54
54
  for tax in line[1]:
55
- if "." in tax:
56
- xml_id = tax
57
- else:
58
- xml_id = "l10n_es.{}_account_tax_template_{}".format(
59
- self.company.id, tax
60
- )
61
- taxes += self.env.ref(xml_id)
55
+ xml_id = f"account_tax_template_{tax}"
56
+ tax_id = self.company._get_tax_id_from_xmlid(xml_id)
57
+ taxes += self.env["account.tax"].browse(tax_id)
62
58
  tax_names.append(tax)
63
59
  vals.append({"price_unit": line[0], "taxes": taxes})
64
60
  return self._compare_sii_dict(
@@ -109,16 +105,16 @@ class TestL10nEsAeatSiiBase(TestL10nEsAeatModBase, TestL10nEsAeatCertificateBase
109
105
  vals.update(extra_vals)
110
106
  invoice = self.env["account.move"].create(vals)
111
107
  result_dict = invoice._get_aeat_invoice_dict()
112
- path = get_resource_path(module, "tests/json", json_file)
108
+ path = file_path(f"{module}/tests/json/{json_file}")
113
109
  if not path:
114
110
  raise Exception("Incorrect JSON file: %s" % json_file)
115
- with open(path, "r") as f:
111
+ with open(path) as f:
116
112
  expected_dict = json.loads(f.read())
117
113
  self.assertEqual(expected_dict, result_dict)
118
114
  return invoice
119
115
 
120
116
  @classmethod
121
- def _create_invoice_for_sii(cls, move_type):
117
+ def _create_invoice(cls, move_type):
122
118
  return cls.env["account.move"].create(
123
119
  {
124
120
  "company_id": cls.company.id,
@@ -152,14 +148,13 @@ class TestL10nEsAeatSiiBase(TestL10nEsAeatModBase, TestL10nEsAeatCertificateBase
152
148
  {"name": "Test product", "sii_exempt_cause": "E5"}
153
149
  )
154
150
  cls.account_expense = cls.env.ref(
155
- "l10n_es.%s_account_common_600" % cls.company.id
151
+ "account.%s_account_common_600" % cls.company.id
156
152
  )
157
- cls.invoice = cls._create_invoice_for_sii("out_invoice")
153
+ cls.invoice = cls._create_invoice("out_invoice")
158
154
  cls.company.write(
159
155
  {
160
156
  "sii_enabled": True,
161
157
  "sii_test": True,
162
- "use_connector": True,
163
158
  "vat": "ESU2687761C",
164
159
  "sii_description_method": "manual",
165
160
  "tax_agency_id": cls.env.ref("l10n_es_aeat.aeat_tax_agency_spain"),
@@ -224,7 +219,7 @@ class TestL10nEsAeatSii(TestL10nEsAeatSiiBase):
224
219
  "vat": "FR23334175221",
225
220
  }
226
221
  )
227
- fp_extra = self.browse_ref(f"l10n_es.{self.company.id}_fp_extra")
222
+ fp_extra = self.browse_ref(f"account.{self.company.id}_fp_extra")
228
223
  fp_extra.sii_partner_identification_type = "3"
229
224
  invoice = self.invoice.copy(
230
225
  {"partner_id": eu_customer.id, "fiscal_position_id": fp_extra.id}
@@ -239,9 +234,6 @@ class TestL10nEsAeatSii(TestL10nEsAeatSiiBase):
239
234
  },
240
235
  )
241
236
 
242
- def test_job_creation(self):
243
- self.assertTrue(self.invoice.invoice_jobs_ids)
244
-
245
237
  def test_partner_sii_enabled(self):
246
238
  company_02 = self.env["res.company"].create({"name": "Company 02"})
247
239
  self.env.user.company_ids += company_02
@@ -251,22 +243,24 @@ class TestL10nEsAeatSii(TestL10nEsAeatSiiBase):
251
243
 
252
244
  def test_get_invoice_data(self):
253
245
  mapping = [
254
- ("out_invoice", [(100, ["s_iva10b"]), (200, ["s_iva21s"])], {}),
255
- ("out_invoice", [(100, ["s_iva10b"]), (200, ["s_iva0_ns"])], {}),
246
+ ("out_invoice", [(100, ["s_iva10b"]), (200, ["s_iva21s"])], {}, False),
247
+ ("out_invoice", [(100, ["s_iva10b"]), (200, ["s_iva0_ns"])], {}, False),
256
248
  (
257
249
  "out_invoice",
258
250
  [(100, ["s_iva10b", "s_req014"]), (200, ["s_iva21s", "s_req52"])],
259
251
  {},
252
+ False,
260
253
  ),
261
254
  (
262
255
  "out_refund",
263
256
  [(100, ["s_iva10b"]), (100, ["s_iva10b"]), (200, ["s_iva21s"])],
264
257
  {},
258
+ False,
265
259
  ),
266
- ("out_invoice", [(100, ["s_iva0_sp_i"]), (200, ["s_iva0_ic"])], {}),
267
- ("out_refund", [(100, ["s_iva0_sp_i"]), (200, ["s_iva0_ic"])], {}),
268
- ("out_invoice", [(100, ["s_iva_e"]), (200, ["s_iva0_e"])], {}),
269
- ("out_refund", [(100, ["s_iva_e"]), (200, ["s_iva0_e"])], {}),
260
+ ("out_invoice", [(100, ["s_iva0_sp_i"]), (200, ["s_iva0_ic"])], {}, False),
261
+ ("out_refund", [(100, ["s_iva0_sp_i"]), (200, ["s_iva0_ic"])], {}, False),
262
+ ("out_invoice", [(100, ["s_iva_e"]), (200, ["s_iva0_e"])], {}, False),
263
+ ("out_refund", [(100, ["s_iva_e"]), (200, ["s_iva0_e"])], {}, False),
270
264
  (
271
265
  "in_invoice",
272
266
  [(100, ["p_iva10_bc", "p_irpf19"]), (200, ["p_iva21_sc", "p_irpf19"])],
@@ -275,34 +269,40 @@ class TestL10nEsAeatSii(TestL10nEsAeatSiiBase):
275
269
  "date": "2020-02-01",
276
270
  "sii_account_registration_date": "2020-10-01",
277
271
  },
272
+ False,
278
273
  ),
279
274
  (
280
275
  "in_refund",
281
276
  [(100, ["p_iva10_bc"])],
282
277
  {"ref": "sup0002", "sii_account_registration_date": "2020-10-01"},
278
+ False,
283
279
  ),
284
280
  (
285
281
  "in_invoice",
286
282
  [(100, ["p_iva10_bc", "p_req014"]), (200, ["p_iva21_sc", "p_req52"])],
287
283
  {"ref": "sup0003", "sii_account_registration_date": "2020-10-01"},
284
+ False,
288
285
  ),
289
286
  (
290
287
  "in_invoice",
291
288
  [(100, ["p_iva21_sp_ex"])],
292
289
  {"ref": "sup0004", "sii_account_registration_date": "2020-10-01"},
290
+ False,
293
291
  ),
294
292
  (
295
293
  "in_invoice",
296
294
  [(100, ["p_iva0_ns"]), (200, ["p_iva10_bc"])],
297
295
  {"ref": "sup0005", "sii_account_registration_date": "2020-10-01"},
296
+ False,
298
297
  ),
299
298
  # Out invoice with currency
300
- ("out_invoice", [(100, ["s_iva10b"])], {"currency_id": self.usd.id}),
299
+ ("out_invoice", [(100, ["s_iva10b"])], {"currency_id": self.usd.id}, False),
301
300
  # Out invoice with currency and with not included in total amount
302
301
  (
303
302
  "out_invoice",
304
303
  [(100, ["s_iva10b", "s_irpf1"])],
305
304
  {"currency_id": self.usd.id},
305
+ False,
306
306
  ),
307
307
  # In invoice with currency
308
308
  (
@@ -313,6 +313,7 @@ class TestL10nEsAeatSii(TestL10nEsAeatSiiBase):
313
313
  "sii_account_registration_date": "2020-10-01",
314
314
  "currency_id": self.usd.id,
315
315
  },
316
+ False,
316
317
  ),
317
318
  # In invoice with currency and with not included in total amount
318
319
  (
@@ -323,23 +324,36 @@ class TestL10nEsAeatSii(TestL10nEsAeatSiiBase):
323
324
  "sii_account_registration_date": "2020-10-01",
324
325
  "currency_id": self.usd.id,
325
326
  },
327
+ False,
326
328
  ),
327
329
  # Intra-community supplier refund with ImporteTotal with "one side"
328
330
  (
329
331
  "in_refund",
330
332
  [(100, ["p_iva21_sp_in"])],
331
333
  {"ref": "sup0008", "sii_account_registration_date": "2020-10-01"},
334
+ False,
335
+ ),
336
+ (
337
+ "in_invoice",
338
+ [(100, ["p_iva21_ibc_group"])],
339
+ {
340
+ "ref": "sup0001",
341
+ "sii_account_registration_date": "2020-10-01",
342
+ "currency_id": self.usd.id,
343
+ },
344
+ True,
332
345
  ),
333
346
  ]
334
- for inv_type, lines, extra_vals in mapping:
335
- self._create_and_test_invoice_sii_dict(inv_type, lines, extra_vals)
347
+ for inv_type, lines, extra_vals, is_dua in mapping:
348
+ invoice = self._create_and_test_invoice_sii_dict(
349
+ inv_type, lines, extra_vals
350
+ )
351
+ if is_dua:
352
+ self.assertTrue(invoice.sii_dua_invoice)
353
+ else:
354
+ self.assertFalse(invoice.sii_dua_invoice)
336
355
  return
337
356
 
338
- def test_action_cancel(self):
339
- self.invoice.invoice_jobs_ids.state = "started"
340
- with self.assertRaises(exceptions.UserError):
341
- self.invoice.button_cancel()
342
-
343
357
  def test_sii_description(self):
344
358
  company = self.invoice.company_id
345
359
  company.write(
@@ -355,7 +369,7 @@ class TestL10nEsAeatSii(TestL10nEsAeatSiiBase):
355
369
  self.invoice.sii_description,
356
370
  "Test customer header | Test description",
357
371
  )
358
- invoice_temp = self._create_invoice_for_sii("in_invoice")
372
+ invoice_temp = self._create_invoice("in_invoice")
359
373
  self.assertEqual(
360
374
  invoice_temp.sii_description,
361
375
  "Test supplier header | Test description",
@@ -402,22 +416,6 @@ class TestL10nEsAeatSii(TestL10nEsAeatSiiBase):
402
416
  invoice.company_id.tax_agency_id = False
403
417
  self._check_binding_address(invoice)
404
418
 
405
- def _test_tax_agencies_sandbox(self): # Inhibited for now
406
- self.sii_cert.company_id = self.invoice.company_id.id
407
- self._activate_certificate()
408
- self.invoice.company_id.sii_test = True
409
- self._check_tax_agencies(self.invoice)
410
- in_invoice = self._create_invoice_for_sii("in_invoice")
411
- self._check_tax_agencies(in_invoice)
412
-
413
- def _test_tax_agencies_production(self): # Inhibited for now
414
- self.sii_cert.company_id = self.invoice.company_id.id
415
- self._activate_certificate()
416
- self.invoice.company_id.sii_test = False
417
- self._check_tax_agencies(self.invoice)
418
- in_invoice = self._create_invoice_for_sii("in_invoice")
419
- self._check_tax_agencies(in_invoice)
420
-
421
419
  def test_refund_sii_refund_type(self):
422
420
  invoice = self.env["account.move"].create(
423
421
  {
@@ -505,7 +503,7 @@ class TestL10nEsAeatSii(TestL10nEsAeatSiiBase):
505
503
  with self.assertRaises(exceptions.UserError):
506
504
  self.invoice.write({"thirdparty_number": "CUSTOM"})
507
505
  # in_invoice
508
- in_invoice = self._create_invoice_for_sii("in_invoice")
506
+ in_invoice = self._create_invoice("in_invoice")
509
507
  in_invoice.ref = "REF"
510
508
  in_invoice.aeat_state = "sent"
511
509
  partner = self.partner.copy()
@@ -531,3 +529,26 @@ class TestL10nEsAeatSii(TestL10nEsAeatSiiBase):
531
529
  self.assertEqual(reversal.sii_refund_type, "I")
532
530
  self.assertTrue(reversal.sii_refund_type_required)
533
531
  self.assertFalse(reversal.supplier_invoice_number_refund_required)
532
+
533
+ def test_dua_exempt_invoice(self):
534
+ self.partner.write({"country_id": self.env.ref("base.us").id})
535
+ invoice = self.env["account.move"].create(
536
+ {
537
+ "partner_id": self.partner.id,
538
+ "invoice_date": "2018-02-01",
539
+ "move_type": "in_invoice",
540
+ "invoice_line_ids": [
541
+ (
542
+ 0,
543
+ 0,
544
+ {
545
+ "product_id": self.product.id,
546
+ "name": "Test line",
547
+ "quantity": 1.0,
548
+ "price_unit": 100.00,
549
+ },
550
+ )
551
+ ],
552
+ }
553
+ )
554
+ self.assertFalse(invoice.sii_enabled)
@@ -11,31 +11,21 @@
11
11
  <field name="arch" type="xml">
12
12
  <xpath expr="//field[@name='country_group_id']/.." position="after">
13
13
  <field name="sii_enabled" invisible="1" />
14
- <group
15
- string="SII"
16
- name="group_sii"
17
- attrs="{'invisible': [('sii_enabled', '=', False)]}"
18
- >
14
+ <group string="SII" name="group_sii" invisible="not sii_enabled">
19
15
  <field name="aeat_active" />
20
16
  <field
21
17
  name="sii_registration_key_sale"
22
- attrs="{'invisible': [('aeat_active', '!=', True)]}"
18
+ invisible="not aeat_active"
23
19
  />
24
20
  <field
25
21
  name="sii_registration_key_purchase"
26
- attrs="{'invisible': [('aeat_active', '!=', True)]}"
27
- />
28
- <field
29
- name="sii_no_taxable_cause"
30
- attrs="{'invisible': [('aeat_active', '!=', True)]}"
31
- />
32
- <field
33
- name="sii_exempt_cause"
34
- attrs="{'invisible': [('aeat_active', '!=', True)]}"
22
+ invisible="not aeat_active"
35
23
  />
24
+ <field name="sii_no_taxable_cause" invisible="not aeat_active" />
25
+ <field name="sii_exempt_cause" invisible="not aeat_active" />
36
26
  <field
37
27
  name="sii_partner_identification_type"
38
- attrs="{'invisible': [('aeat_active', '!=', True)]}"
28
+ invisible="not aeat_active"
39
29
  />
40
30
  </group>
41
31
  </xpath>
@@ -8,15 +8,13 @@
8
8
  <field name="inherit_id" ref="l10n_es_aeat.view_account_journal_form" />
9
9
  <field name="arch" type="xml">
10
10
  <xpath expr="//field[@name='thirdparty_invoice']" position="attributes">
11
- <attribute
12
- name="attrs"
13
- >{'invisible': [('type', 'not in', ('sale', 'purchase'))]}</attribute>
11
+ <attribute name="invisible">type not in ['sale', 'purchase']</attribute>
14
12
  </xpath>
15
13
  <xpath expr="//field[@name='thirdparty_invoice']" position="after">
16
14
  <field name="company_sii_enabled" invisible="1" />
17
15
  <field
18
16
  name="sii_enabled"
19
- attrs="{'invisible': ['|', ('company_sii_enabled', '=', False), ('type', 'not in', ('sale', 'purchase'))]}"
17
+ invisible="not company_sii_enabled or type not in ['sale', 'purchase']"
20
18
  />
21
19
  </xpath>
22
20
  </field>