diff --git a/l10n_it_vat_registries_xlsx/README.rst b/l10n_it_vat_registries_xlsx/README.rst new file mode 100644 index 00000000000..337b43307b3 --- /dev/null +++ b/l10n_it_vat_registries_xlsx/README.rst @@ -0,0 +1,166 @@ +================== +ITA - Registri IVA +================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:1bb65e521cb096dd4973b1a578e72edc9d6faef2c38d191bed6fae90a73d573e + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png + :target: https://odoo-community.org/page/development-status + :alt: Production/Stable +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github + :target: https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_vat_registries + :alt: OCA/l10n-italy +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/l10n-italy-16-0/l10n-italy-16-0-l10n_it_vat_registries + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-italy&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Law: Decreto del Presidente della Repubblica del 26 ottobre 1972 n. 633 +https://goo.gl/31yTVj + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +**Italiano** + +È possibile configurare quali imposte escludere dai registri (ad esempio +le ritenute) impostando il campo dell'imposta 'Escludere dai registri +IVA' + +Per generare i periodi fiscali, aprire Contabilità > Configurazione > +Contabilità > Intervalli data > Generazione intervalli data: + +- Prefisso nome intervallo: prefisso identificativo dell'anno dei + periodi da generare +- Durata: 1 mese +- Numero di intervalli da generare: 12 +- Tipo: creare un tipo o utilizzarne uno esistente, non è richiesta una + configurazione particolare per il tipo +- Data iniziale: primo giorno dell'anno dei periodi da generare (ad + esempio 01/01/2018) + +Tramite Contabilità -> Configurazione -> Contabilità -> Registri IVA è +possibile configurare i registri IVA, ad esempio 'vendite', 'acquisti' o +'corrispettivi'. Per associare un registro contabile a un registro IVA, +aprire il registro tramite Contabilità -> Configurazione -> Contabilità +-> Registri e impostare il campo "Registro IVA". + +Se non ci sono movimenti contabili da stampare, la stampa viene generata +con totale zero. + +**English** + +You can configure which taxes to exclude from registries (like +withholding tax) setting the 'Exclude from VAT registries' field. + +In order to generate fiscal periods, open Accounting > Configuration > +Accounting > Date ranges > Generate Date Ranges: + +- Range name prefix: Prefix identifying the year of the periods to be + generated +- Duration: 1 month +- Number of ranges to generate: 12 +- Type: Create a type or use an existing one, no specific type's + configuration is required +- Date start: first day of the period's year (for instance 01/01/2018) + +Using the menu Accounting -> Configuration -> Accounting -> VAT +registries you can configure VAT registries, like 'Sales', 'Purchases' +or 'corrispettivi'. In order to link a journal to a VAT registry, open +journal by Accounting -> Configuration -> Accounting -> Journals and set +the 'VAT registry' field. + +If there are no account moves to be printed, the report is printed with +total equal to zero. + +Usage +===== + +**Italiano** + +Dal menu Contabilità -> Rendicontazione -> Imposte -> Registri IVA è +possibile lanciare la procedura di stampa, nella quale è necessario +impostare un intervallo di date. Qui è possibile utilizzare un periodo +fiscale nel campo 'Intervallo Date'. + +Nel campo 'Registro IVA' è possibile selezionare un registro +preconfigurato, oppure è possibile andare direttamente a impostare i +registri e la struttura nei campi sottostanti. + +**English** + +Using the menu Accounting -> Reports -> Taxes -> VAT registries it is +possible to launch the print wizard, where you have to set a date range. +You can use a fiscal period in the field 'date range'. + +In the 'VAT registry' field you can select a preconfigured registry, or +you can directly journals and layout in the fields below. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Agile Business Group +* LinkIt Srl + +Contributors +------------ + +- Lorenzo Battistini +- Sergio Corato +- Elena Carlesso +- Alex Comba + +Other credits +------------- + +The development of this module has been financially supported by: + +- Odoo Italia Network + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/l10n-italy `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/l10n_it_vat_registries_xlsx/__init__.py b/l10n_it_vat_registries_xlsx/__init__.py new file mode 100644 index 00000000000..14cd1b0579c --- /dev/null +++ b/l10n_it_vat_registries_xlsx/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import wizard diff --git a/l10n_it_vat_registries_xlsx/__manifest__.py b/l10n_it_vat_registries_xlsx/__manifest__.py new file mode 100644 index 00000000000..8fd8527901f --- /dev/null +++ b/l10n_it_vat_registries_xlsx/__manifest__.py @@ -0,0 +1,24 @@ +# Copyright 2024 Marco Colombo +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "version": "16.0.0.0.1", + "name": "ITA - Registri IVA - formato XLSX", + "category": "Localization/Italy", + "author": "Phi Srl, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/l10n-italy", + "license": "AGPL-3", + # "development_status": "Production/Beta", + "depends": [ + "base", + "product", + "report_xlsx_helper", + "l10n_it_vat_registries", + ], + "data": [ + "wizard/print_registro_iva.xml", + "report/reports.xml", + "report/report_registro_iva.xml", + ], + "installable": True, +} diff --git a/l10n_it_vat_registries_xlsx/i18n/it.po b/l10n_it_vat_registries_xlsx/i18n/it.po new file mode 100644 index 00000000000..408975f5297 --- /dev/null +++ b/l10n_it_vat_registries_xlsx/i18n/it.po @@ -0,0 +1,181 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_it_vat_registries_xlsx +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-10-31 15:46+0000\n" +"PO-Revision-Date: 2024-10-31 16:52+0100\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: it_IT\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 3.0.1\n" + +#. module: l10n_it_vat_registries_xlsx +#. odoo-python +#: code:addons/l10n_it_vat_registries_xlsx/wizard/print_registro_iva.py:0 +#: model_terms:ir.ui.view,arch_db:l10n_it_vat_registries_xlsx.report_registro_iva +#, python-format +msgid "BUSINESS NAME" +msgstr "RAGIONE SOCIALE" + +#. module: l10n_it_vat_registries_xlsx +#: model_terms:ir.ui.view,arch_db:l10n_it_vat_registries_xlsx.report_registro_iva +msgid "Deductible" +msgstr "Detraibile" + +#. module: l10n_it_vat_registries_xlsx +#: model_terms:ir.ui.view,arch_db:l10n_it_vat_registries_xlsx.report_registro_iva +msgid "Description" +msgstr "Descrizione" + +#. module: l10n_it_vat_registries_xlsx +#: model_terms:ir.ui.view,arch_db:l10n_it_vat_registries_xlsx.report_registro_iva +msgid "General Total EUR" +msgstr "Totale generale EUR" + +#. module: l10n_it_vat_registries_xlsx +#. odoo-python +#: code:addons/l10n_it_vat_registries_xlsx/wizard/print_registro_iva.py:0 +#: model_terms:ir.ui.view,arch_db:l10n_it_vat_registries_xlsx.report_registro_iva +#, python-format +msgid "INV. DATE" +msgstr "DATA FATT." + +#. module: l10n_it_vat_registries_xlsx +#. odoo-python +#: code:addons/l10n_it_vat_registries_xlsx/wizard/print_registro_iva.py:0 +#: model_terms:ir.ui.view,arch_db:l10n_it_vat_registries_xlsx.report_registro_iva +#, python-format +msgid "INV. NUM." +msgstr "NUM. FATT." + +#. module: l10n_it_vat_registries_xlsx +#: model:ir.actions.report,name:l10n_it_vat_registries_xlsx.action_report_registro_iva +msgid "Invoices VAT Registry XLSX" +msgstr "Registro IVA fatture XLSX" + +#. module: l10n_it_vat_registries_xlsx +#. odoo-python +#: code:addons/l10n_it_vat_registries_xlsx/wizard/print_registro_iva.py:0 +#, python-format +msgid "N/A" +msgstr "N.D." + +#. module: l10n_it_vat_registries_xlsx +#. odoo-python +#: code:addons/l10n_it_vat_registries_xlsx/wizard/print_registro_iva.py:0 +#, python-format +msgid "" +"No journals found in the current selection.\n" +"Please load them before to retry!" +msgstr "" +"Nessun registro trovato nella selezione corrente.\n" +"Caricarli prima di riprovare!" + +#. module: l10n_it_vat_registries_xlsx +#: model_terms:ir.ui.view,arch_db:l10n_it_vat_registries_xlsx.report_registro_iva +msgid "Non-Deductible" +msgstr "Indetraibile" + +#. module: l10n_it_vat_registries_xlsx +#: model_terms:ir.ui.view,arch_db:l10n_it_vat_registries_xlsx.wizard_registro_iva +msgid "Print XLSX" +msgstr "Stampa XLSX" + +#. module: l10n_it_vat_registries_xlsx +#. odoo-python +#: code:addons/l10n_it_vat_registries_xlsx/wizard/print_registro_iva.py:0 +#: model_terms:ir.ui.view,arch_db:l10n_it_vat_registries_xlsx.report_registro_iva +#, python-format +msgid "REASON" +msgstr "CAUSALE" + +#. module: l10n_it_vat_registries_xlsx +#. odoo-python +#: code:addons/l10n_it_vat_registries_xlsx/wizard/print_registro_iva.py:0 +#: model_terms:ir.ui.view,arch_db:l10n_it_vat_registries_xlsx.report_registro_iva +#, python-format +msgid "REG. DATE" +msgstr "DATA REG." + +#. module: l10n_it_vat_registries_xlsx +#. odoo-python +#: code:addons/l10n_it_vat_registries_xlsx/wizard/print_registro_iva.py:0 +#: model_terms:ir.ui.view,arch_db:l10n_it_vat_registries_xlsx.report_registro_iva +#, python-format +msgid "REG. NUM." +msgstr "NUM. REG." + +#. module: l10n_it_vat_registries_xlsx +#: model:ir.model,name:l10n_it_vat_registries_xlsx.model_wizard_registro_iva +msgid "Run VAT registry" +msgstr "Stampa Registro IVA" + +#. module: l10n_it_vat_registries_xlsx +#. odoo-python +#: code:addons/l10n_it_vat_registries_xlsx/wizard/print_registro_iva.py:0 +#: model_terms:ir.ui.view,arch_db:l10n_it_vat_registries_xlsx.report_registro_iva +#, python-format +msgid "TIN" +msgstr "P.IVA" + +#. module: l10n_it_vat_registries_xlsx +#. odoo-python +#: code:addons/l10n_it_vat_registries_xlsx/wizard/print_registro_iva.py:0 +#: model_terms:ir.ui.view,arch_db:l10n_it_vat_registries_xlsx.report_registro_iva +#, python-format +msgid "TOTAL" +msgstr "TOTALE" + +#. module: l10n_it_vat_registries_xlsx +#. odoo-python +#: code:addons/l10n_it_vat_registries_xlsx/wizard/print_registro_iva.py:0 +#: model_terms:ir.ui.view,arch_db:l10n_it_vat_registries_xlsx.report_registro_iva +#, python-format +msgid "Tax" +msgstr "Imposta" + +#. module: l10n_it_vat_registries_xlsx +#. odoo-python +#: code:addons/l10n_it_vat_registries_xlsx/wizard/print_registro_iva.py:0 +#: model_terms:ir.ui.view,arch_db:l10n_it_vat_registries_xlsx.report_registro_iva +#, python-format +msgid "Tax description" +msgstr "Descrizione imposta" + +#. module: l10n_it_vat_registries_xlsx +#. odoo-python +#: code:addons/l10n_it_vat_registries_xlsx/wizard/print_registro_iva.py:0 +#: model_terms:ir.ui.view,arch_db:l10n_it_vat_registries_xlsx.report_registro_iva +#, python-format +msgid "Taxable" +msgstr "Imponibile" + +#. module: l10n_it_vat_registries_xlsx +#: model_terms:ir.ui.view,arch_db:l10n_it_vat_registries_xlsx.report_registro_iva +msgid "Totals" +msgstr "Totali" + +#. module: l10n_it_vat_registries_xlsx +#. odoo-python +#: code:addons/l10n_it_vat_registries_xlsx/wizard/print_registro_iva.py:0 +#, python-format +msgid "VAT settlement date" +msgstr "Data competenza IVA" + +#. module: l10n_it_vat_registries_xlsx +#: model:ir.model,name:l10n_it_vat_registries_xlsx.model_report_l10n_it_vat_registries_xlsx_action_report_registro_iva +msgid "XLSX report for VAT registries" +msgstr "Resoconto XLSX registro IVA" + +#. module: l10n_it_vat_registries_xlsx +#: model_terms:ir.ui.view,arch_db:l10n_it_vat_registries_xlsx.wizard_registro_iva +msgid "or" +msgstr "oppure" diff --git a/l10n_it_vat_registries_xlsx/pyproject.toml b/l10n_it_vat_registries_xlsx/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/l10n_it_vat_registries_xlsx/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/l10n_it_vat_registries_xlsx/readme/CONTRIBUTORS.md b/l10n_it_vat_registries_xlsx/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..b49a129ecdc --- /dev/null +++ b/l10n_it_vat_registries_xlsx/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +- Marco Cooombo \<\> diff --git a/l10n_it_vat_registries_xlsx/readme/USAGE.md b/l10n_it_vat_registries_xlsx/readme/USAGE.md new file mode 100644 index 00000000000..28f0e55ff4c --- /dev/null +++ b/l10n_it_vat_registries_xlsx/readme/USAGE.md @@ -0,0 +1,10 @@ +**Italiano** + +Dal menu Contabilità -\> Rendicontazione -\> Imposte -\> Registri IVA è +possibile lanciare la procedura di stampa sia in formato PDF che in formato +XLSX. + +**English** + +Using the menu Accounting -\> Reports -\> Taxes -\> VAT registries it is +possible to launch the print wizard, both in PFD and XLSX format. diff --git a/l10n_it_vat_registries_xlsx/report/report_registro_iva.xml b/l10n_it_vat_registries_xlsx/report/report_registro_iva.xml new file mode 100644 index 00000000000..7d7d65092c2 --- /dev/null +++ b/l10n_it_vat_registries_xlsx/report/report_registro_iva.xml @@ -0,0 +1,322 @@ + + + + + + diff --git a/l10n_it_vat_registries_xlsx/report/reports.xml b/l10n_it_vat_registries_xlsx/report/reports.xml new file mode 100644 index 00000000000..4697b692cc2 --- /dev/null +++ b/l10n_it_vat_registries_xlsx/report/reports.xml @@ -0,0 +1,14 @@ + + + + Invoices VAT Registry XLSX + account.move + xlsx + l10n_it_vat_registries_xlsx.report_registro_iva + l10n_it_vat_registries_xlsx.report_registro_iva + + diff --git a/l10n_it_vat_registries_xlsx/security/ir.model.access.csv b/l10n_it_vat_registries_xlsx/security/ir.model.access.csv new file mode 100644 index 00000000000..6dc9c4acd7b --- /dev/null +++ b/l10n_it_vat_registries_xlsx/security/ir.model.access.csv @@ -0,0 +1,5 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_account_tax_registry_account_manager,account.tax_registry account manager,model_account_tax_registry,account.group_account_manager,1,1,1,1 +access_account_tax_registry_account_user,account.tax_registry account user,model_account_tax_registry,account.group_account_user,1,0,0,0 +access_wizard_registro_iva_account_manager,access_wizard_registro_iva account manager,model_wizard_registro_iva,account.group_account_manager,1,1,1,1 +access_wizard_registro_iva_account_user,access_wizard_registro_iva account user,model_wizard_registro_iva,account.group_account_user,1,0,0,0 diff --git a/l10n_it_vat_registries_xlsx/security/vat_registry_security.xml b/l10n_it_vat_registries_xlsx/security/vat_registry_security.xml new file mode 100644 index 00000000000..842374a6a3d --- /dev/null +++ b/l10n_it_vat_registries_xlsx/security/vat_registry_security.xml @@ -0,0 +1,13 @@ + + + + + tax_registry multi-company + + + ['|',('company_id','=',False),('company_id','in',company_ids)] + + + diff --git a/l10n_it_vat_registries_xlsx/static/description/icon.png b/l10n_it_vat_registries_xlsx/static/description/icon.png new file mode 100644 index 00000000000..fe00c805f8d Binary files /dev/null and b/l10n_it_vat_registries_xlsx/static/description/icon.png differ diff --git a/l10n_it_vat_registries_xlsx/static/description/index.html b/l10n_it_vat_registries_xlsx/static/description/index.html new file mode 100644 index 00000000000..9263d542e76 --- /dev/null +++ b/l10n_it_vat_registries_xlsx/static/description/index.html @@ -0,0 +1,499 @@ + + + + + +ITA - Registri IVA + + + +
+

ITA - Registri IVA

+ + +

Production/Stable License: AGPL-3 OCA/l10n-italy Translate me on Weblate Try me on Runboat

+

Law: Decreto del Presidente della Repubblica del 26 ottobre 1972 n. 633 +https://goo.gl/31yTVj

+

Table of contents

+ +
+

Configuration

+

Italiano

+

È possibile configurare quali imposte escludere dai registri (ad esempio +le ritenute) impostando il campo dell’imposta ‘Escludere dai registri +IVA’

+

Per generare i periodi fiscali, aprire Contabilità > Configurazione > +Contabilità > Intervalli data > Generazione intervalli data:

+
    +
  • Prefisso nome intervallo: prefisso identificativo dell’anno dei +periodi da generare
  • +
  • Durata: 1 mese
  • +
  • Numero di intervalli da generare: 12
  • +
  • Tipo: creare un tipo o utilizzarne uno esistente, non è richiesta una +configurazione particolare per il tipo
  • +
  • Data iniziale: primo giorno dell’anno dei periodi da generare (ad +esempio 01/01/2018)
  • +
+

Tramite Contabilità -> Configurazione -> Contabilità -> Registri IVA è +possibile configurare i registri IVA, ad esempio ‘vendite’, ‘acquisti’ o +‘corrispettivi’. Per associare un registro contabile a un registro IVA, +aprire il registro tramite Contabilità -> Configurazione -> Contabilità +-> Registri e impostare il campo “Registro IVA”.

+

Se non ci sono movimenti contabili da stampare, la stampa viene generata +con totale zero.

+

English

+

You can configure which taxes to exclude from registries (like +withholding tax) setting the ‘Exclude from VAT registries’ field.

+

In order to generate fiscal periods, open Accounting > Configuration > +Accounting > Date ranges > Generate Date Ranges:

+
    +
  • Range name prefix: Prefix identifying the year of the periods to be +generated
  • +
  • Duration: 1 month
  • +
  • Number of ranges to generate: 12
  • +
  • Type: Create a type or use an existing one, no specific type’s +configuration is required
  • +
  • Date start: first day of the period’s year (for instance 01/01/2018)
  • +
+

Using the menu Accounting -> Configuration -> Accounting -> VAT +registries you can configure VAT registries, like ‘Sales’, ‘Purchases’ +or ‘corrispettivi’. In order to link a journal to a VAT registry, open +journal by Accounting -> Configuration -> Accounting -> Journals and set +the ‘VAT registry’ field.

+

If there are no account moves to be printed, the report is printed with +total equal to zero.

+
+
+

Usage

+

Italiano

+

Dal menu Contabilità -> Rendicontazione -> Imposte -> Registri IVA è +possibile lanciare la procedura di stampa, nella quale è necessario +impostare un intervallo di date. Qui è possibile utilizzare un periodo +fiscale nel campo ‘Intervallo Date’.

+

Nel campo ‘Registro IVA’ è possibile selezionare un registro +preconfigurato, oppure è possibile andare direttamente a impostare i +registri e la struttura nei campi sottostanti.

+

English

+

Using the menu Accounting -> Reports -> Taxes -> VAT registries it is +possible to launch the print wizard, where you have to set a date range. +You can use a fiscal period in the field ‘date range’.

+

In the ‘VAT registry’ field you can select a preconfigured registry, or +you can directly journals and layout in the fields below.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Agile Business Group
  • +
  • LinkIt Srl
  • +
+
+
+

Contributors

+ +
+
+

Other credits

+

The development of this module has been financially supported by:

+
    +
  • Odoo Italia Network
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/l10n-italy project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/l10n_it_vat_registries_xlsx/tests/__init__.py b/l10n_it_vat_registries_xlsx/tests/__init__.py new file mode 100644 index 00000000000..7c08fc04115 --- /dev/null +++ b/l10n_it_vat_registries_xlsx/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import test_registry diff --git a/l10n_it_vat_registries_xlsx/tests/test_registry.py b/l10n_it_vat_registries_xlsx/tests/test_registry.py new file mode 100644 index 00000000000..03ce969415d --- /dev/null +++ b/l10n_it_vat_registries_xlsx/tests/test_registry.py @@ -0,0 +1,96 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +import io +from zipfile import ZipFile + +from odoo import fields +from odoo.tests.common import TransactionCase + + +class TestRegistry(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.test_date = fields.Date.today() + cls.journal = cls.env["account.journal"].search( + [("type", "=", "sale")], limit=1 + ) + cls.ova = cls.env["account.account"].search( + [("account_type", "=", "asset_current")], + limit=1, + ) + cls.tax = cls.env["account.tax"].create( + { + "name": "Tax 10.0", + "amount": 10.0, + "amount_type": "fixed", + } + ) + cls.tax_registry = cls.env["account.tax.registry"].create( + { + "name": "Sales", + "layout_type": "customer", + "journal_ids": [(6, 0, [cls.journal.id])], + } + ) + + cls.invoice_line_account = ( + cls.env["account.account"] + .search( + [("account_type", "=", "expense")], + limit=1, + ) + .id + ) + + cls.invoice = cls.env["account.move"].create( + { + "partner_id": cls.env.ref("base.res_partner_2").id, + "invoice_date": cls.test_date, + "move_type": "out_invoice", + "journal_id": cls.journal.id, + "invoice_line_ids": [ + ( + 0, + None, + { + "product_id": cls.env.ref("product.product_product_4").id, + "quantity": 1.0, + "price_unit": 100.0, + "name": "product that cost 100", + "account_id": cls.invoice_line_account, + "tax_ids": [(6, 0, [cls.tax.id])], + }, + ) + ], + } + ) + cls.invoice.action_post() + + def test_invoice_and_report(self): + wizard = self.env["wizard.registro.iva"].create( + { + "from_date": self.test_date, + "to_date": self.test_date, + "tax_registry_id": self.tax_registry.id, + "layout_type": "supplier", + "fiscal_page_base": 0, + } + ) + wizard.on_change_tax_registry_id() + res = wizard.print_registro_xlsx() + + report_name = "l10n_it_vat_registries_xlsx.report_registro_iva" + domain = [ + ("report_type", "=", "xlsx"), + ("report_name", "=", report_name), + ] + report = self.env["ir.actions.report"].search(domain) + data = res["context"]["report_action"]["data"] + xlsx, _type = report._render_xlsx(report_name, data["ids"], data) + + # basic reading of a file + # we don't want to depend on other non-standard libraries such as openpyxl + f = io.BytesIO(xlsx) + with ZipFile(f, "r").open("xl/sharedStrings.xml", "r") as wf: + self.assertTrue(self.invoice.partner_id.name.encode("utf8") in wf.read()) diff --git a/l10n_it_vat_registries_xlsx/views/account_journal_view.xml b/l10n_it_vat_registries_xlsx/views/account_journal_view.xml new file mode 100644 index 00000000000..cfa32928355 --- /dev/null +++ b/l10n_it_vat_registries_xlsx/views/account_journal_view.xml @@ -0,0 +1,15 @@ + + + + + account.journal.form + account.journal + + + + + + + + + diff --git a/l10n_it_vat_registries_xlsx/views/account_tax_registry_view.xml b/l10n_it_vat_registries_xlsx/views/account_tax_registry_view.xml new file mode 100644 index 00000000000..86d4606bec5 --- /dev/null +++ b/l10n_it_vat_registries_xlsx/views/account_tax_registry_view.xml @@ -0,0 +1,39 @@ + + + + + account.tax.registry.form + account.tax.registry + +
+ + + + + + + + + + +
+ + + VAT registries + account.tax.registry + tree,form + +

+ Click to add a VAT registry. +

+ A VAT registry is used to group several journals in one registry. +

+
+
+ + +
diff --git a/l10n_it_vat_registries_xlsx/views/account_view.xml b/l10n_it_vat_registries_xlsx/views/account_view.xml new file mode 100644 index 00000000000..f80eb3be6e0 --- /dev/null +++ b/l10n_it_vat_registries_xlsx/views/account_view.xml @@ -0,0 +1,19 @@ + + + + + account.tax.code.form + account.tax + + + + + + + + + + diff --git a/l10n_it_vat_registries_xlsx/wizard/__init__.py b/l10n_it_vat_registries_xlsx/wizard/__init__.py new file mode 100644 index 00000000000..8fefb155964 --- /dev/null +++ b/l10n_it_vat_registries_xlsx/wizard/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import print_registro_iva diff --git a/l10n_it_vat_registries_xlsx/wizard/print_registro_iva.py b/l10n_it_vat_registries_xlsx/wizard/print_registro_iva.py new file mode 100644 index 00000000000..5a01110f17e --- /dev/null +++ b/l10n_it_vat_registries_xlsx/wizard/print_registro_iva.py @@ -0,0 +1,219 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +import logging + +from odoo import _, models +from odoo.exceptions import UserError +from odoo.tools.misc import formatLang + +from odoo.addons.l10n_it_vat_registries.models.vat_registry import ReportRegistroIva +from odoo.addons.report_xlsx_helper.report.report_xlsx_format import ( + FORMATS, + XLS_HEADERS, +) + +_logger = logging.getLogger(__name__) + + +class WizardRegistroIva(models.TransientModel): + _inherit = "wizard.registro.iva" + + # most of this code is borrowed from print_registro() + # a bit of refactoring is in order to de-duplicate the code + def print_registro_xlsx(self): + # begin of shared code 8< + self.ensure_one() + wizard = self + if not wizard.journal_ids: + raise UserError( + _( + "No journals found in the current selection.\n" + "Please load them before to retry!" + ) + ) + move_ids = self._get_move_ids(wizard) + + datas_form = {} + datas_form["from_date"] = wizard.from_date + datas_form["to_date"] = wizard.to_date + datas_form["journal_ids"] = [j.id for j in wizard.journal_ids] + datas_form["fiscal_page_base"] = wizard.fiscal_page_base + datas_form["registry_type"] = wizard.layout_type + datas_form["year_footer"] = wizard.year_footer + + lang_code = self.env.company.partner_id.lang + lang = self.env["res.lang"] + lang_id = lang._lang_get(lang_code) + date_format = lang_id.date_format + datas_form["date_format"] = date_format + + if wizard.tax_registry_id: + datas_form["tax_registry_name"] = wizard.tax_registry_id.name + else: + datas_form["tax_registry_name"] = "" + datas_form["only_totals"] = wizard.only_totals + datas_form["entry_order"] = wizard.entry_order + datas_form["show_full_contact_addess"] = wizard.show_full_contact_addess + # >8 end of shared code + + report_name = "l10n_it_vat_registries_xlsx.action_report_registro_iva" + datas = {"ids": move_ids, "model": "account.move", "form": datas_form} + moves = self.env["account.move"].browse(move_ids) + return self.env.ref(report_name).report_action(moves, data=datas) + + +class ReportRegistroIvaXlsx(ReportRegistroIva): + _name = "report.l10n_it_vat_registries_xlsx.report_registro_iva" + _inherit = "report.report_xlsx.abstract" + _description = "XLSX report for VAT registries" + + def _get_ws_params(self, workbook, data, objects): + registry_type = data["form"]["registry_type"] + titles = { + "customer": "Registro IVA vendite", + "supplier": "Registro IVA acquisti", + "corrispettivi": "Registro corrispettivi", + } + title = data["form"]["tax_registry_name"] or titles.get(registry_type, _("N/A")) + + col_specs = { + "date": { + "header": {"value": _("REG. DATE")}, + "lines": {"value": self._render("format_date(move.date,date_format)")}, + "width": 20, + }, + "no": { + "header": {"value": _("REG. NUM.")}, + "lines": {"value": self._render("move.name")}, + "width": 20, + }, + "reason": { + "header": {"value": _("REASON")}, + "lines": {"value": self._render("line['invoice_type']")}, + "width": 20, + }, + "inv_date": { + "header": {"value": _("INV. DATE")}, + "lines": { + "value": self._render( + "format_date(line['invoice_date'],date_format)" + ) + }, + "width": 20, + }, + "inv_name": { + "header": {"value": _("INV. NUM.")}, + "lines": { + "value": self._render( + "move.ref if move.journal_id.type == 'purchase' " + "else move.name" + ) + }, + "width": 20, + }, + "partner": { + "header": {"value": _("BUSINESS NAME")}, + "lines": {"value": self._render("move.partner_id.name")}, + "width": 20, + }, + "tin": { + "header": {"value": _("TIN")}, + "lines": {"value": self._render("move.partner_id.vat")}, + "width": 20, + }, + "total": { + "header": {"value": _("TOTAL")}, + "lines": { + "value": self._render("formatLang(env, invoice_total(move))") + }, + "width": 20, + }, + "tax_name": { + "header": {"value": _("Tax description")}, + "lines": {"value": self._render("line['tax_code_name']")}, + "width": 20, + }, + "taxable": { + "header": {"value": _("Taxable")}, + "lines": {"value": self._render("formatLang(env, line['base'])")}, + "width": 20, + }, + "tax": { + "header": {"value": _("Tax")}, + "lines": {"value": self._render("formatLang(env, line['tax'])")}, + "width": 20, + }, + } + + # dynamic based on presence of field + if "l10n_it_vat_settlement_date" in self.env["account.move"]._fields: + col_specs.update( + { + "vat_settlement_date": { + "header": {"value": _("VAT settlement date")}, + "lines": { + "value": self._render( + "format_date(move.l10n_it_vat_settlement_date," + "date_format)" + ) + }, + "width": 20, + } + } + ) + + wanted = col_specs.keys() + if registry_type == "corrispettivi": + wanted -= ["reason", "inv_date", "inv_name", "partner", "tin"] + + return [ + { + "ws_name": "vat_registry", + "title": title, + "wanted_list": wanted, + "col_specs": col_specs, + "generate_ws_method": "generate_ws", + } + ] + + def generate_ws(self, workbook, ws, ws_params, data, objects): + ws.set_landscape() + ws.fit_to_pages(1, 0) + ws.set_header(XLS_HEADERS["xls_headers"]["standard"]) + ws.set_footer(XLS_HEADERS["xls_footers"]["standard"]) + + self._set_column_width(ws, ws_params) + + row_pos = 0 + row_pos = self._write_ws_title(ws, row_pos, ws_params) + + row_pos = self._write_line( + ws, + row_pos, + ws_params, + col_specs_section="header", + default_format=FORMATS["format_theader_yellow_left"], + ) + + ws.freeze_panes(row_pos, 0) + + for move in objects: + inv_taxes, used_taxes = self._get_tax_lines(move, data["form"]) + + for line in inv_taxes: + row_pos = self._write_line( + ws, + row_pos, + ws_params, + col_specs_section="lines", + render_space={ + "env": self.env, + "move": move, + "line": line, + "format_date": self._format_date, + "date_format": data["form"]["date_format"], + "formatLang": formatLang, + "invoice_total": self._get_move_total, + }, + default_format=FORMATS["format_tcell_left"], + ) diff --git a/l10n_it_vat_registries_xlsx/wizard/print_registro_iva.xml b/l10n_it_vat_registries_xlsx/wizard/print_registro_iva.xml new file mode 100644 index 00000000000..3257c595ee8 --- /dev/null +++ b/l10n_it_vat_registries_xlsx/wizard/print_registro_iva.xml @@ -0,0 +1,20 @@ + + + + VAT Registry XLSX + wizard.registro.iva + form + + + + or +