diff --git a/l10n_it_central_journal_reportlab/README.rst b/l10n_it_central_journal_reportlab/README.rst new file mode 100644 index 000000000000..5474aa3f52f2 --- /dev/null +++ b/l10n_it_central_journal_reportlab/README.rst @@ -0,0 +1,107 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +================================ +ITA - Libro giornale - Reportlab +================================ + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:bd14a78a89961799ba3394d7ff409df15327e8d809335bbe84fa92b7e63ccd80 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/license-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/19.0/l10n_it_central_journal_reportlab + :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-19-0/l10n-italy-19-0-l10n_it_central_journal_reportlab + :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=19.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +**Italiano** + +Modulo per la stampa del libro giornale con reportlab + +**English** + +Module for print general journal with reportlab + +**Table of contents** + +.. contents:: + :local: + +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 +------- + +* Gianmarco Conte - Dinamiche Aziendali srl + +Contributors +------------ + +- Gianmarco Conte +- Lara Baggio +- Glauco Prina +- Giuseppe Borruso +- `Aion Tech `__: + + - Simone Rubino + +- `Stesi Consulting `__: + + - Michele Di Croce + +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. + +.. |maintainer-MarcoCalcagni| image:: https://github.com/MarcoCalcagni.png?size=40px + :target: https://github.com/MarcoCalcagni + :alt: MarcoCalcagni +.. |maintainer-Borruso| image:: https://github.com/Borruso.png?size=40px + :target: https://github.com/Borruso + :alt: Borruso + +Current `maintainers `__: + +|maintainer-MarcoCalcagni| |maintainer-Borruso| + +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_central_journal_reportlab/__init__.py b/l10n_it_central_journal_reportlab/__init__.py new file mode 100644 index 000000000000..68e14f9a5a28 --- /dev/null +++ b/l10n_it_central_journal_reportlab/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2018 Gianmarco Conte (gconte@dinamicheaziendali.it) + +from . import models +from . import wizard diff --git a/l10n_it_central_journal_reportlab/__manifest__.py b/l10n_it_central_journal_reportlab/__manifest__.py new file mode 100644 index 000000000000..f35bbf0d950c --- /dev/null +++ b/l10n_it_central_journal_reportlab/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright 2018 Gianmarco Conte (gconte@dinamicheaziendali.it) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "ITA - Libro giornale - Reportlab", + "version": "19.0.1.0.0", + "development_status": "Beta", + "category": "Localization/Italy", + "author": "Gianmarco Conte - Dinamiche Aziendali srl, " + "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/l10n-italy", + "license": "AGPL-3", + "maintainers": ["MarcoCalcagni", "Borruso"], + "depends": ["account", "date_range"], + "data": [ + "security/ir.model.access.csv", + "wizard/print_giornale.xml", + "views/date_range_view.xml", + ], + "installable": True, +} diff --git a/l10n_it_central_journal_reportlab/i18n/it.po b/l10n_it_central_journal_reportlab/i18n/it.po new file mode 100644 index 000000000000..1360860a9a4d --- /dev/null +++ b/l10n_it_central_journal_reportlab/i18n/it.po @@ -0,0 +1,376 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_it_central_journal_reportlab +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-10-13 10:39+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +#, python-format +msgid " Account Central Journal" +msgstr " Libro giornale contabile" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +#, python-format +msgid "Account" +msgstr "Conto" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +#, python-format +msgid "Account Central Journal - %s.pdf" +msgstr "Libro giornale - %s.pdf" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +#, python-format +msgid "Account Central Journal.pdf" +msgstr "Libro giornale.pdf" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields.selection,name:l10n_it_central_journal_reportlab.selection__wizard_giornale_reportlab__target_move__all +msgid "All" +msgstr "Tutti" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +#, python-format +msgid "Balance" +msgstr "Saldo" + +#. module: l10n_it_central_journal_reportlab +#: model_terms:ir.ui.view,arch_db:l10n_it_central_journal_reportlab.wizard_giornale_reportlab +msgid "Cancel" +msgstr "Annulla" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__company_id +msgid "Company" +msgstr "Azienda" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__create_uid +msgid "Created by" +msgstr "Creato da" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__create_date +msgid "Created on" +msgstr "Creato il" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +#, python-format +msgid "Credit" +msgstr "Avere" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +#, python-format +msgid "Date" +msgstr "Data" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__date_move_line_from +msgid "Date Move Line From" +msgstr "Data movimento contabile da" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model,name:l10n_it_central_journal_reportlab.model_date_range +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__daterange_id +msgid "Date Range" +msgstr "Intervallo data" + +#. module: l10n_it_central_journal_reportlab +#: model_terms:ir.ui.view,arch_db:l10n_it_central_journal_reportlab.wizard_giornale_reportlab +msgid "Dates movements" +msgstr "Date dei movimenti" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +#, python-format +msgid "Debit" +msgstr "Dare" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__display_name +msgid "Display Name" +msgstr "Nome visualizzato" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields.selection,name:l10n_it_central_journal_reportlab.selection__wizard_giornale_reportlab__target_move__draft +msgid "Draft" +msgstr "Bozza" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_account_journal__central_journal_exclude +msgid "Exclude from General Journal" +msgstr "Escludere da libro giornale" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +#, python-format +msgid "Final Balance" +msgstr "Saldo finale" + +#. module: l10n_it_central_journal_reportlab +#: model_terms:ir.ui.view,arch_db:l10n_it_central_journal_reportlab.wizard_giornale_reportlab +msgid "Final print" +msgstr "Stampa definitiva" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__date_move_line_from_view +msgid "From date" +msgstr "Dalla data" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.ui.menu,name:l10n_it_central_journal_reportlab.menu_giornale +#: model_terms:ir.ui.view,arch_db:l10n_it_central_journal_reportlab.wizard_giornale_reportlab +msgid "General Journal" +msgstr "Libro giornale" + +#. module: l10n_it_central_journal_reportlab +#: model_terms:ir.ui.view,arch_db:l10n_it_central_journal_reportlab.view_date_range_form_inherit_view +msgid "General Journal Info" +msgstr "Informazioni libro giornale" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.actions.act_window,name:l10n_it_central_journal_reportlab.action_giornale_reportlab +msgid "General Journal Reportlab" +msgstr "Libro Giornale Reportlab" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__group_by_account +msgid "Group By Account" +msgstr "Raggruppa per conto" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__id +msgid "ID" +msgstr "ID" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +#, python-format +msgid "Initial Balance" +msgstr "Saldo iniziale" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model,name:l10n_it_central_journal_reportlab.model_account_journal +msgid "Journal" +msgstr "Registro" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__journal_ids +#: model_terms:ir.ui.view,arch_db:l10n_it_central_journal_reportlab.wizard_giornale_reportlab +msgid "Journals" +msgstr "Registri" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab____last_update +msgid "Last Modified on" +msgstr "Ultima modifica il" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__write_uid +msgid "Last Updated by" +msgstr "Ultimo aggiornamento di" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__write_date +msgid "Last Updated on" +msgstr "Ultimo aggiornamento il" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__last_def_date_print +msgid "Last definitive date print" +msgstr "Ultima data di stampa in definitivo" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_date_range__date_last_print +msgid "Last printed date" +msgstr "Ultima data di stampa" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__fiscal_page_base +msgid "Last printed page" +msgstr "Ultima pagina stampata" + +#. module: l10n_it_central_journal_reportlab +#: model_terms:ir.ui.view,arch_db:l10n_it_central_journal_reportlab.wizard_giornale_reportlab +msgid "Layout" +msgstr "Struttura" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +#, python-format +msgid "Name" +msgstr "Nome" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +#, python-format +msgid "No documents found in the current selection" +msgstr "Nessun documento trovato per la selezione corrente" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +#, python-format +msgid "Number" +msgstr "Numero" + +#. module: l10n_it_central_journal_reportlab +#: model_terms:ir.ui.view,arch_db:l10n_it_central_journal_reportlab.wizard_giornale_reportlab +msgid "PDF" +msgstr "PDF" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +#, python-format +msgid "Page: %(year_footer)s / %(page_num)s" +msgstr "Pagina: %(year_footer)s / %(page_num)s" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields.selection,name:l10n_it_central_journal_reportlab.selection__wizard_giornale_reportlab__target_move__posted +msgid "Posted" +msgstr "Registrato" + +#. module: l10n_it_central_journal_reportlab +#: model_terms:ir.ui.view,arch_db:l10n_it_central_journal_reportlab.wizard_giornale_reportlab +msgid "Print" +msgstr "Stampa" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields.selection,name:l10n_it_central_journal_reportlab.selection__wizard_giornale_reportlab__print_state__printed +msgid "Printed" +msgstr "Stampato" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_date_range__progressive_credit +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__progressive_credit +msgid "Progressive Credit" +msgstr "Progressivo avere" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_date_range__progressive_debit +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__progressive_debit2 +msgid "Progressive Debit" +msgstr "Progressivo dare" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_date_range__progressive_line_number +msgid "Progressive line" +msgstr "Progressivo riga" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_date_range__progressive_page_number +msgid "Progressive of the page" +msgstr "Progressivo pagina" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields.selection,name:l10n_it_central_journal_reportlab.selection__wizard_giornale_reportlab__print_state__print +msgid "Ready for printing" +msgstr "Pronto per la stampa" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +#, python-format +msgid "Ref" +msgstr "Rif." + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__report_giornale +msgid "Report Giornale" +msgstr "Report giornale" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__report_giornale_name +msgid "Report Giornale Name" +msgstr "Nome report giornale" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +#, python-format +msgid "Row" +msgstr "Riga" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__start_row +msgid "Start row" +msgstr "Riga iniziale" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__print_state +msgid "State" +msgstr "Stato" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__target_move +msgid "Target Move" +msgstr "Movimento destinazione" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__date_move_line_to +msgid "To date" +msgstr "Alla data" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,help:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__year_footer +msgid "Value printed near number of page in the footer" +msgstr "Valore stampato nel piè di pagina vicino al numero pagina" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model,name:l10n_it_central_journal_reportlab.model_wizard_giornale_reportlab +msgid "Wizard journal report with reportlab" +msgstr "Procedura guidata resoconto registro con ReportLab" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__year_footer +#: model_terms:ir.ui.view,arch_db:l10n_it_central_journal_reportlab.wizard_giornale_reportlab +msgid "Year for Footer" +msgstr "Anno per il piè di pagina" + +#. module: l10n_it_central_journal_reportlab +#: model_terms:ir.ui.view,arch_db:l10n_it_central_journal_reportlab.wizard_giornale_reportlab +msgid "or" +msgstr "oppure" + +#, python-format +#~ msgid "Account Move" +#~ msgstr "Movimento contabile" + +#~ msgid "Group by account" +#~ msgstr "Raggruppa per conto" + +#, python-format +#~ msgid "Page: %s / %s" +#~ msgstr "Pagina: %s / %s" diff --git a/l10n_it_central_journal_reportlab/i18n/l10n_it_central_journal_reportlab.pot b/l10n_it_central_journal_reportlab/i18n/l10n_it_central_journal_reportlab.pot new file mode 100644 index 000000000000..2bfe5dffd05f --- /dev/null +++ b/l10n_it_central_journal_reportlab/i18n/l10n_it_central_journal_reportlab.pot @@ -0,0 +1,341 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_it_central_journal_reportlab +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +msgid " Account Central Journal" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +msgid "Account" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +msgid "Account Central Journal - %s.pdf" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +msgid "Account Central Journal.pdf" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields.selection,name:l10n_it_central_journal_reportlab.selection__wizard_giornale_reportlab__target_move__all +msgid "All" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +msgid "Balance" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model_terms:ir.ui.view,arch_db:l10n_it_central_journal_reportlab.wizard_giornale_reportlab +msgid "Cancel" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__company_id +msgid "Company" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__create_uid +msgid "Created by" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__create_date +msgid "Created on" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +msgid "Credit" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +msgid "Date" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__date_move_line_from +msgid "Date Move Line From" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model,name:l10n_it_central_journal_reportlab.model_date_range +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__daterange_id +msgid "Date Range" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model_terms:ir.ui.view,arch_db:l10n_it_central_journal_reportlab.wizard_giornale_reportlab +msgid "Dates movements" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +msgid "Debit" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__display_name +msgid "Display Name" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields.selection,name:l10n_it_central_journal_reportlab.selection__wizard_giornale_reportlab__target_move__draft +msgid "Draft" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_account_journal__central_journal_exclude +msgid "Exclude from General Journal" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +msgid "Final Balance" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model_terms:ir.ui.view,arch_db:l10n_it_central_journal_reportlab.wizard_giornale_reportlab +msgid "Final print" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__date_move_line_from_view +msgid "From date" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.ui.menu,name:l10n_it_central_journal_reportlab.menu_giornale +#: model_terms:ir.ui.view,arch_db:l10n_it_central_journal_reportlab.wizard_giornale_reportlab +msgid "General Journal" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model_terms:ir.ui.view,arch_db:l10n_it_central_journal_reportlab.view_date_range_form_inherit_view +msgid "General Journal Info" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.actions.act_window,name:l10n_it_central_journal_reportlab.action_giornale_reportlab +msgid "General Journal Reportlab" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__group_by_account +msgid "Group By Account" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__id +msgid "ID" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +msgid "Initial Balance" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model,name:l10n_it_central_journal_reportlab.model_account_journal +msgid "Journal" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__journal_ids +#: model_terms:ir.ui.view,arch_db:l10n_it_central_journal_reportlab.wizard_giornale_reportlab +msgid "Journals" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__write_date +msgid "Last Updated on" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__last_def_date_print +msgid "Last definitive date print" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_date_range__date_last_print +msgid "Last printed date" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__fiscal_page_base +msgid "Last printed page" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model_terms:ir.ui.view,arch_db:l10n_it_central_journal_reportlab.wizard_giornale_reportlab +msgid "Layout" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +msgid "Name" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +msgid "No documents found in the current selection" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +msgid "Number" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model_terms:ir.ui.view,arch_db:l10n_it_central_journal_reportlab.wizard_giornale_reportlab +msgid "PDF" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +msgid "Page: %(year_footer)s / %(page_num)s" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields.selection,name:l10n_it_central_journal_reportlab.selection__wizard_giornale_reportlab__target_move__posted +msgid "Posted" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model_terms:ir.ui.view,arch_db:l10n_it_central_journal_reportlab.wizard_giornale_reportlab +msgid "Print" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields.selection,name:l10n_it_central_journal_reportlab.selection__wizard_giornale_reportlab__print_state__printed +msgid "Printed" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_date_range__progressive_credit +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__progressive_credit +msgid "Progressive Credit" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_date_range__progressive_debit +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__progressive_debit2 +msgid "Progressive Debit" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_date_range__progressive_line_number +msgid "Progressive line" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_date_range__progressive_page_number +msgid "Progressive of the page" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields.selection,name:l10n_it_central_journal_reportlab.selection__wizard_giornale_reportlab__print_state__print +msgid "Ready for printing" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +msgid "Ref" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__report_giornale +msgid "Report Giornale" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__report_giornale_name +msgid "Report Giornale Name" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#. odoo-python +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:0 +msgid "Row" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__start_row +msgid "Start row" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__print_state +msgid "State" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__target_move +msgid "Target Move" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__date_move_line_to +msgid "To date" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,help:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__year_footer +msgid "Value printed near number of page in the footer" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model,name:l10n_it_central_journal_reportlab.model_wizard_giornale_reportlab +msgid "Wizard journal report with reportlab" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__year_footer +#: model_terms:ir.ui.view,arch_db:l10n_it_central_journal_reportlab.wizard_giornale_reportlab +msgid "Year for Footer" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model_terms:ir.ui.view,arch_db:l10n_it_central_journal_reportlab.wizard_giornale_reportlab +msgid "or" +msgstr "" diff --git a/l10n_it_central_journal_reportlab/models/__init__.py b/l10n_it_central_journal_reportlab/models/__init__.py new file mode 100644 index 000000000000..63724e4c75e6 --- /dev/null +++ b/l10n_it_central_journal_reportlab/models/__init__.py @@ -0,0 +1,3 @@ +# Copyright 2018 Gianmarco Conte (gconte@dinamicheaziendali.it) + +from . import account diff --git a/l10n_it_central_journal_reportlab/models/account.py b/l10n_it_central_journal_reportlab/models/account.py new file mode 100644 index 000000000000..aed850fe182b --- /dev/null +++ b/l10n_it_central_journal_reportlab/models/account.py @@ -0,0 +1,19 @@ +# Copyright 2018 Gianmarco Conte (gconte@dinamicheaziendali.it) + +from odoo import fields, models + + +class AccountJournalInherit(models.Model): + _inherit = "account.journal" + + central_journal_exclude = fields.Boolean("Exclude from General Journal") + + +class DateRangeInherit(models.Model): + _inherit = "date.range" + + date_last_print = fields.Date("Last printed date") + progressive_page_number = fields.Integer("Progressive of the page") + progressive_line_number = fields.Integer("Progressive line") + progressive_credit = fields.Float(digits="Account") + progressive_debit = fields.Float(digits="Account") diff --git a/l10n_it_central_journal_reportlab/pyproject.toml b/l10n_it_central_journal_reportlab/pyproject.toml new file mode 100644 index 000000000000..4231d0cccb3d --- /dev/null +++ b/l10n_it_central_journal_reportlab/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/l10n_it_central_journal_reportlab/readme/CONTRIBUTORS.md b/l10n_it_central_journal_reportlab/readme/CONTRIBUTORS.md new file mode 100644 index 000000000000..b3dd883d5953 --- /dev/null +++ b/l10n_it_central_journal_reportlab/readme/CONTRIBUTORS.md @@ -0,0 +1,8 @@ +- Gianmarco Conte \<\> +- Lara Baggio \<\> +- Glauco Prina \<\> +- Giuseppe Borruso \<\> +- [Aion Tech](https://aiontech.company/): + - Simone Rubino \<\> +- [Stesi Consulting](https://www.stesi.consulting/): + - Michele Di Croce \<\> \ No newline at end of file diff --git a/l10n_it_central_journal_reportlab/readme/DESCRIPTION.md b/l10n_it_central_journal_reportlab/readme/DESCRIPTION.md new file mode 100644 index 000000000000..19123dd41b2c --- /dev/null +++ b/l10n_it_central_journal_reportlab/readme/DESCRIPTION.md @@ -0,0 +1,7 @@ +**Italiano** + +Modulo per la stampa del libro giornale con reportlab + +**English** + +Module for print general journal with reportlab diff --git a/l10n_it_central_journal_reportlab/security/ir.model.access.csv b/l10n_it_central_journal_reportlab/security/ir.model.access.csv new file mode 100644 index 000000000000..29704dc0c7a9 --- /dev/null +++ b/l10n_it_central_journal_reportlab/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_date_range_group_account_manager,group_account_manager model_date_range,model_date_range,account.group_account_manager,1,1,0,0 +access_wizard_giornale_reportlab_manager,access_wizard_giornale_reportlab manager,l10n_it_central_journal_reportlab.model_wizard_giornale_reportlab,account.group_account_manager,1,1,1,1 diff --git a/l10n_it_central_journal_reportlab/static/description/icon.png b/l10n_it_central_journal_reportlab/static/description/icon.png new file mode 100755 index 000000000000..3a0328b516c4 Binary files /dev/null and b/l10n_it_central_journal_reportlab/static/description/icon.png differ diff --git a/l10n_it_central_journal_reportlab/static/description/index.html b/l10n_it_central_journal_reportlab/static/description/index.html new file mode 100644 index 000000000000..41c420453e28 --- /dev/null +++ b/l10n_it_central_journal_reportlab/static/description/index.html @@ -0,0 +1,445 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

ITA - Libro giornale - Reportlab

+ +

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

+

Italiano

+

Modulo per la stampa del libro giornale con reportlab

+

English

+

Module for print general journal with reportlab

+

Table of contents

+ +
+

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

+
    +
  • Gianmarco Conte - Dinamiche Aziendali srl
  • +
+
+
+

Contributors

+ +
+
+

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.

+

Current maintainers:

+

MarcoCalcagni Borruso

+

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_central_journal_reportlab/tests/__init__.py b/l10n_it_central_journal_reportlab/tests/__init__.py new file mode 100644 index 000000000000..2d4275cae870 --- /dev/null +++ b/l10n_it_central_journal_reportlab/tests/__init__.py @@ -0,0 +1 @@ +from . import test_central_journal_reportlab diff --git a/l10n_it_central_journal_reportlab/tests/test_central_journal_reportlab.py b/l10n_it_central_journal_reportlab/tests/test_central_journal_reportlab.py new file mode 100644 index 000000000000..f5633d657c30 --- /dev/null +++ b/l10n_it_central_journal_reportlab/tests/test_central_journal_reportlab.py @@ -0,0 +1,146 @@ +# Copyright 2022 Giuseppe Borruso +# Copyright 2024 Simone Rubino - Aion Tech +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +import base64 +import io +from datetime import datetime + +from dateutil.rrule import MONTHLY + +from odoo.tests import Form, tagged +from odoo.tools import pdf + +from odoo.addons.account.tests.common import AccountTestInvoicingCommon + + +@tagged("post_install", "-at_install") +class TestCentralJournalReportlab(AccountTestInvoicingCommon): + def setUp(self): + super().setUp() + + self.today = datetime.now() + self.data_it_company = self.setup_other_company( + name="IT Company2", + vat="IT01234560157", + phone="0266766700", + email="test@test.it", + street="1234 Test Street", + zip="12345", + city="Prova", + ) + self.it_company = self.data_it_company["company"] + self.env.user.company_ids |= self.it_company + self.env.user.company_id = self.it_company + # Now that current user can access the company, + # log the user *only* in this company so that + # searching, reading and other operations behave as expected + self.env.user.company_ids = self.it_company + + self.range_type = self.env["date.range.type"].create({"name": "Fiscal Year"}) + self.env["date.range.generator"].create( + { + "date_start": f"{self.today.year}-01-01", + "name_prefix": f"{self.today.year}-", + "type_id": self.range_type.id, + "duration_count": 1, + "unit_of_time": str(MONTHLY), + "count": 12, + } + ).action_apply() + self.current_period = self.env["date.range"].search( + [ + ("date_start", "<=", self.today.date()), + ("date_end", ">=", self.today.date()), + ], + limit=1, + ) + self.wizard_model = self.env["wizard.giornale.reportlab"] + self.report_model = self.env["ir.actions.report"] + self.report_name = "central_journal_reportlab.report_giornale_reportlab" + self.journals = self.env["account.journal"].search([]) + self.partner = self.env["res.partner"].create( + { + "name": "Wood Corner", + "is_company": True, + "street": "1839 Arbor Way", + "city": "Turlock", + "state_id": self.env.ref("base.state_us_5").id, + "zip": "95380", + "email": "wood.corner26@example.com", + "phone": "(623)-853-7197", + "vat": "US12345672", + } + ) + + def test_wizard_reportlab(self): + out_invoice = Form( + self.env["account.move"].with_context(default_move_type="out_invoice") + ) + out_invoice.partner_id = self.partner + out_invoice.invoice_date = self.today + with out_invoice.invoice_line_ids.new() as line: + line.name = "Test line" + line.price_unit = 100 + out_invoice = out_invoice.save() + out_invoice.action_post() + + wizard_form = Form(self.wizard_model) + wizard_form.daterange_id = self.current_period + wizard = wizard_form.save() + self.assertEqual( + len(wizard.journal_ids), + len(self.journals.filtered(lambda j: not j.central_journal_exclude)), + ) + self.assertEqual(wizard.date_move_line_from, self.current_period.date_start) + self.assertEqual(wizard.date_move_line_to, self.current_period.date_end) + self.assertEqual(wizard.year_footer, str(self.today.year)) + next_year = self.today.year + 1 + + wizard.year_footer = next_year + wizard.fiscal_page_base = 99 + + wizard.print_giornale_reportlab() + decode_giornale = base64.b64decode(wizard.report_giornale) + self.minimal_reader_buffer = io.BytesIO(decode_giornale) + self.minimal_pdf_reader = pdf.OdooPdfFileReader(self.minimal_reader_buffer) + self.assertTrue(self.minimal_reader_buffer) + + def test_grouped_move_line_no_account(self): + """Move lines without account are excluded from grouped report.""" + # Arrange + out_invoice = Form( + self.env["account.move"].with_context(default_move_type="out_invoice") + ) + out_invoice.partner_id = self.partner + out_invoice.invoice_date = self.today + with out_invoice.invoice_line_ids.new() as note_line: + note_line.display_type = "line_note" + note_line.name = "Test note" + with out_invoice.invoice_line_ids.new() as line: + line.name = "Test line" + line.price_unit = 100 + out_invoice = out_invoice.save() + out_invoice.action_post() + # pre-condition + account_lines = out_invoice.invoice_line_ids.filtered("account_id") + self.assertTrue(account_lines) + no_account_lines = out_invoice.invoice_line_ids - account_lines + self.assertTrue(no_account_lines) + + # Act + wizard_form = Form(self.wizard_model) + wizard_form.daterange_id = self.current_period + wizard_form.group_by_account = True + wizard = wizard_form.save() + + # Assert + wizard.print_giornale_reportlab() + giornale_pdf_content = base64.b64decode(wizard.report_giornale) + giornale_content = pdf.PdfFileReader(io.BytesIO(giornale_pdf_content)) + has_move = False + for page in giornale_content.pages: + page_content = page.extractText() + if not has_move and out_invoice.name in page_content: + has_move = True + self.assertTrue(has_move) diff --git a/l10n_it_central_journal_reportlab/views/date_range_view.xml b/l10n_it_central_journal_reportlab/views/date_range_view.xml new file mode 100644 index 000000000000..a1ea41e7a18f --- /dev/null +++ b/l10n_it_central_journal_reportlab/views/date_range_view.xml @@ -0,0 +1,42 @@ + + + + view.central.journal.account.journal.form + account.journal + + + + + + + + + + date.range.form + date.range + + + + + + + + + + + + + + + + + date.range.tree.inherit + date.range + + + + + + + + diff --git a/l10n_it_central_journal_reportlab/wizard/__init__.py b/l10n_it_central_journal_reportlab/wizard/__init__.py new file mode 100644 index 000000000000..5a77f776d3c1 --- /dev/null +++ b/l10n_it_central_journal_reportlab/wizard/__init__.py @@ -0,0 +1,3 @@ +# Copyright 2018 Gianmarco Conte (gconte@dinamicheaziendali.it) + +from . import print_giornale diff --git a/l10n_it_central_journal_reportlab/wizard/print_giornale.py b/l10n_it_central_journal_reportlab/wizard/print_giornale.py new file mode 100644 index 000000000000..c1cc804ebb1c --- /dev/null +++ b/l10n_it_central_journal_reportlab/wizard/print_giornale.py @@ -0,0 +1,718 @@ +# Copyright 2018 Gianmarco Conte (gconte@dinamicheaziendali.it) +# Copyright 2022 Giuseppe Borruso (gborruso@dinamicheaziendali.it) +# Copyright 2024 Simone Rubino - Aion Tech +# Copyright 2025 Michele Di Croce - Stesi Consulting + +import base64 +import io +from datetime import timedelta + +from reportlab.lib import colors +from reportlab.lib.enums import TA_RIGHT +from reportlab.lib.pagesizes import A4 +from reportlab.lib.styles import ParagraphStyle +from reportlab.lib.units import cm +from reportlab.pdfgen import canvas +from reportlab.platypus import Table +from reportlab.platypus.paragraph import Paragraph + +from odoo import api, fields, models +from odoo.exceptions import UserError +from odoo.tools.misc import format_date, formatLang + +gap = 1 * cm # gap between header/footer and page content +gap_text = 0.5 * cm # gap between text +margin_left = 0.5 * cm # layout margin left +margin_bottom = 0.5 * cm # layout margin bottom +footer_height = 2 * gap_text + 12 # layout footer height + + +class WizardGiornaleReportlab(models.TransientModel): + @api.model + def _get_journal(self): + journal_obj = self.env["account.journal"] + journal_ids = journal_obj.search( + [ + ("central_journal_exclude", "=", False), + ] + ) + return journal_ids + + _name = "wizard.giornale.reportlab" + _description = "Wizard journal report with reportlab" + + date_move_line_from = fields.Date(required=True) + date_move_line_from_view = fields.Date("From date") + last_def_date_print = fields.Date("Last definitive date print") + date_move_line_to = fields.Date("To date", required=True) + daterange_id = fields.Many2one("date.range", "Date Range", required=True) + company_id = fields.Many2one( + comodel_name="res.company", + default=lambda self: self.env.company.id, + readonly=True, + store=True, + ) + progressive_credit = fields.Float() + progressive_debit2 = fields.Float("Progressive Debit") + print_state = fields.Selection( + [("print", "Ready for printing"), ("printed", "Printed")], + "State", + default="print", + readonly=True, + ) + journal_ids = fields.Many2many( + "account.journal", + "giornale_reportlab_journals_rel", + "journal_id", + "giornale_reportlab_id", + default=lambda self: self._get_journal(), + string="Journals", + required=True, + ) + target_move = fields.Selection( + [("all", "All"), ("posted", "Posted"), ("draft", "Draft")], + default="posted", + ) + fiscal_page_base = fields.Integer("Last printed page", required=True) + start_row = fields.Integer("Start row", required=True) + year_footer = fields.Char( + string="Year for Footer", + help="Value printed near number of page in the footer", + ) + report_giornale = fields.Binary() + report_giornale_name = fields.Char(compute="_compute_report_giornale_name") + group_by_account = fields.Boolean(default=False) + + @api.depends("report_giornale", "daterange_id") + def _compute_report_giornale_name(self): + for wizard in self: + if wizard.report_giornale and wizard.daterange_id: + wizard.report_giornale_name = self.env._( + "Account Central Journal - %s.pdf", wizard.daterange_id.name + ) + elif wizard.report_giornale: + wizard.report_giornale_name = self.env._("Account Central Journal.pdf") + else: + wizard.report_giornale_name = False + + @api.onchange("date_move_line_from_view") + def get_year_footer_reportlab(self): + if self.date_move_line_from_view: + self.year_footer = fields.Date.to_date(self.date_move_line_from_view).year + + @api.onchange("daterange_id") + def on_change_daterange_reportlab(self): + if self.daterange_id: + date_start = fields.Date.to_date(self.daterange_id.date_start) + date_end = fields.Date.to_date(self.daterange_id.date_end) + if self.daterange_id.date_last_print: + date_last_print = fields.Date.to_date(self.daterange_id.date_last_print) + self.last_def_date_print = date_last_print + date_start = (date_last_print + timedelta(days=1)).__str__() + else: + self.last_def_date_print = None + self.date_move_line_from = date_start + self.date_move_line_from_view = date_start + self.date_move_line_to = date_end + if self.daterange_id.progressive_line_number != 0: + self.start_row = self.daterange_id.progressive_line_number + 1 + else: + self.start_row = self.daterange_id.progressive_line_number + self.progressive_debit2 = self.daterange_id.progressive_debit + self.progressive_credit = self.daterange_id.progressive_credit + + if self.last_def_date_print == self.daterange_id.date_end: + self.date_move_line_from_view = self.last_def_date_print + + def get_progressive_debit_and_credit(self): + progressive_debit = 0 + progressive_credit = 0 + domain = [("date_end", "<=", self.daterange_id.date_start)] + date_range_model = self.env["date.range"] + last_daterange_id = date_range_model.search(domain).sorted( + "date_end", reverse=True + ) + last_daterange_id = last_daterange_id.filtered( + lambda dr: dr.date_end.year == self.daterange_id.date_start.year + ) + if last_daterange_id: + progressive_debit = last_daterange_id[0].progressive_debit + progressive_credit = last_daterange_id[0].progressive_credit + return progressive_debit, progressive_credit + + def get_grupped_line_reportlab_ids(self): + wizard = self + if wizard.target_move == "all": + target_type = ["posted", "draft"] + else: + target_type = [wizard.target_move] + sql = """ + SELECT + aml.account_id AS account_id, + am.date, + am.name AS move_name, + COALESCE(aml.ref, '') AS ref, + aa.name AS account_name, + COALESCE(rp.name, '') AS name, + SUM(aml.debit) AS debit, + SUM(aml.credit) AS credit + FROM + account_move_line aml + LEFT JOIN account_move am ON (am.id = aml.move_id) + LEFT JOIN account_account aa ON (aa.id = aml.account_id) + LEFT JOiN res_partner rp ON am.partner_id = rp.id + WHERE + aml.date >= %(date_from)s + AND aml.date <= %(date_to)s + AND am.state IN %(target_type)s + AND aml.journal_id IN %(journal_ids)s + AND aml.company_id = %(company_id)s + AND (aml.debit + aml.credit) != 0.0 + AND aml.account_id IS NOT NULL + GROUP BY + aml.account_id, + am.date, + am.name, + aml.ref, + aa.name, + am.ref, + rp.name + ORDER BY + am.date, + am.name + """ + params = { + "date_from": wizard.date_move_line_from, + "date_to": wizard.date_move_line_to, + "target_type": tuple(target_type), + "journal_ids": tuple(self.journal_ids.ids), + "company_id": wizard.company_id.id, + } + self.env.cr.execute(sql, params) + list_grupped_line = self.env.cr.dictfetchall() + return list_grupped_line + + def get_line_reportlab_ids(self): + wizard = self + if wizard.target_move == "all": + target_type = ["posted", "draft"] + else: + target_type = [wizard.target_move] + sql = """ + SELECT + aml.account_id AS account_id, + am.date, + am.name AS move_name, + COALESCE(aml.ref, '') AS ref, + aa.name AS account_name, + COALESCE(aml.name, '') AS name, + rp.name AS partner_name, + aa.account_type AS account_type, + aml.debit AS debit, + aml.credit AS credit + FROM + account_move_line aml + LEFT JOIN account_move am ON (am.id = aml.move_id) + LEFT JOIN account_account aa ON (aa.id = aml.account_id) + LEFT JOIN res_partner rp ON am.partner_id = rp.id + WHERE + aml.date >= %(date_from)s + AND aml.date <= %(date_to)s + AND am.state IN %(target_type)s + AND aml.journal_id IN %(journal_ids)s + AND aml.company_id = %(company_id)s + AND aml.account_id IS NOT NULL + AND aml.display_type NOT IN ('line_note','line_section') + ORDER BY + am.date, + am.name + """ + params = { + "date_from": wizard.date_move_line_from, + "date_to": wizard.date_move_line_to, + "target_type": tuple(target_type), + "journal_ids": tuple(self.journal_ids.ids), + "company_id": wizard.company_id.id, + } + self.env.cr.execute(sql, params) + list_line_not_grouped = self.env.cr.dictfetchall() + return list_line_not_grouped + + def _get_account_name_reportlab(self, line): + return " - ".join(filter(None, [line.account_id.code, line.account_id.name])) + + def get_template_header_report_giornale(self, report, height_available): + report.setFont("Helvetica-Bold", 12) + height_available -= gap + report.drawString( + margin_left, + height_available, + self.company_id.name + self.env._(" Account Central Journal"), + ) + report.setFont("Helvetica", 10) + text = "" + if self.company_id.street: + text += self.company_id.street + if self.company_id.zip: + text += " " + self.company_id.zip + if self.company_id.city: + text += " - " + self.company_id.city + if self.company_id.state_id.code: + text += " - " + self.company_id.state_id.code + if self.company_id.vat: + text += " IVA: " + self.company_id.vat + height_available -= gap_text + report.drawString(margin_left, height_available, text) + return height_available + + def get_template_footer_report_giornale(self, report): + page_num = report.getPageNumber() + self.fiscal_page_base + page_text = self.env._( + "Page: %(year_footer)s / %(page_num)s", + year_footer=self.year_footer, + page_num=page_num, + ) + report.drawString(margin_left, margin_bottom + 12, page_text) + + def get_styles_report_giornale_line(self): + style_header = ParagraphStyle("style_header") + style_header.fontSize = 10 + style_header.fontName = "Helvetica-Bold" + + style_header_number = ParagraphStyle("style_header_number") + style_header_number.alignment = TA_RIGHT + style_header_number.fontSize = 10 + style_header_number.fontName = "Helvetica-Bold" + + style_name = ParagraphStyle("style_name") + style_name.fontSize = 6.5 + style_name.fontName = "Helvetica" + + style_number = ParagraphStyle("style_number") + style_number.fontSize = 6.5 + style_number.alignment = TA_RIGHT + style_number.fontName = "Helvetica" + + style_table = [ + ("VALIGN", (0, 0), (-1, -1), "TOP"), + ("LEFTPADDING", (0, 0), (-1, -1), 1), + ("RIGHTPADDING", (0, 0), (-1, -1), 1), + ("TOPPADDING", (0, 0), (-1, -1), 1), + ("BOTTOMPADDING", (0, 0), (-1, -1), 1), + ] + style_table_line_above = [ + ("VALIGN", (0, 0), (-1, -1), "TOP"), + ("LEFTPADDING", (0, 0), (-1, -1), 1), + ("RIGHTPADDING", (0, 0), (-1, -1), 1), + ("TOPPADDING", (0, 0), (-1, -1), 1), + ("BOTTOMPADDING", (0, 0), (-1, -1), 1), + ("LINEABOVE", (0, 0), (-1, -1), 1, colors.black), + ] + return { + "style_header": style_header, + "style_header_number": style_header_number, + "style_name": style_name, + "style_number": style_number, + "style_table": style_table, + "style_table_line_above": style_table_line_above, + } + + def get_colwidths_report_giornale(self, width_available): + # colwidths = [32, 40, 50, 120, 130, 100, 50, 50] + colwidths = [28, 40, 80, 70, 100, 150, 52, 52] + total = sum(colwidths) + return [c / total * width_available for c in colwidths] + + def get_data_header_report_giornale(self): + style_header = self.get_styles_report_giornale_line()["style_header"] + style_header_number = self.get_styles_report_giornale_line()[ + "style_header_number" + ] + + data_header = [ + [ + Paragraph(self.env._("Row"), style_header), + Paragraph(self.env._("Date"), style_header), + Paragraph(self.env._("Ref"), style_header), + Paragraph(self.env._("Number"), style_header), + Paragraph(self.env._("Account"), style_header), + Paragraph(self.env._("Name"), style_header), + Paragraph(self.env._("Debit"), style_header_number), + Paragraph(self.env._("Credit"), style_header_number), + ] + ] + return data_header + + def get_initial_balance_data_report_giornale(self): + style_name = self.get_styles_report_giornale_line()["style_name"] + style_number = self.get_styles_report_giornale_line()["style_number"] + progressive_debit, progressive_credit = self.get_progressive_debit_and_credit() + initial_balance_data = [ + [ + "", + "", + "", + "", + "", + Paragraph(self.env._("Initial Balance"), style_name), + Paragraph(formatLang(self.env, progressive_debit), style_number), + Paragraph(formatLang(self.env, progressive_credit), style_number), + ] + ] + return initial_balance_data + + def get_account_dict(self, all_account): + account_dict = {} + for account in all_account: + account_dict[account.id] = account.code + return account_dict + + def get_grupped_final_tables_report_giornale( + self, list_grupped_line, tables, start_row, width_available + ): + style_name = self.get_styles_report_giornale_line()["style_name"] + style_number = self.get_styles_report_giornale_line()["style_number"] + style_table = self.get_styles_report_giornale_line()["style_table"] + style_table_line_above = self.get_styles_report_giornale_line()[ + "style_table_line_above" + ] + colwidths = self.get_colwidths_report_giornale(width_available) + previous_move_name = "" + list_balance = [ + (0, 0), + (self.progressive_debit2, self.progressive_credit), + ] + + company = self.env.company + user_lang = company.partner_id.lang + model_account = self.env["account.account"] + + # pylint: disable=no-search-all + all_account = model_account.search([]).filtered( + lambda acc: company.id in acc.company_ids.ids + ) + account_dict = self.get_account_dict(all_account) + + for line in list_grupped_line: + start_row += 1 + account_name = ( + account_dict[line["account_id"]] + " - " + line["account_name"] + and line["account_name"][user_lang] + or "" + if account_dict + and "line_id" in account_dict.keys() + and "account_id" in account_dict[line].keys() + else line["account_name"] and line["account_name"][user_lang] or "" + ) + if not account_name: + continue + # evitiamo che i caratteri < o > vengano interpretato come tag html + # dalla libreria reportlab + account_name = account_name.replace("<", "<").replace(">", ">") + row = Paragraph(str(start_row), style_name) + date = Paragraph(format_date(self.env, line["date"]), style_name) + ref = Paragraph(str(line["ref"]), style_name) + move = Paragraph(line["move_name"] or "", style_name) + account = Paragraph(account_name, style_name) + name = Paragraph(line["name"], style_name) + # dato che nel SQL ho la somma dei crediti e debiti potrei avere + # che un conto ha sia debito che credito + lines_data = [] + if line["debit"] > 0: + debit = Paragraph(formatLang(self.env, line["debit"]), style_number) + credit = Paragraph(formatLang(self.env, 0), style_number) + list_balance.append((line["debit"], 0)) + lines_data.append( + [[row, date, ref, move, account, name, debit, credit]] + ) + if line["credit"] > 0: + debit = Paragraph(formatLang(self.env, 0), style_number) + credit = Paragraph(formatLang(self.env, line["credit"]), style_number) + list_balance.append((0, line["credit"])) + lines_data.append( + [[row, date, ref, move, account, name, debit, credit]] + ) + for line_data in lines_data: + if previous_move_name != line["move_name"]: + previous_move_name = line["move_name"] + tables.append( + Table( + line_data, colWidths=colwidths, style=style_table_line_above + ) + ) + else: + tables.append( + Table(line_data, colWidths=colwidths, style=style_table) + ) + return tables, list_balance + + def get_final_tables_report_giornale( + self, list_line_not_grouped, tables, start_row, width_available + ): + style_name = self.get_styles_report_giornale_line()["style_name"] + style_number = self.get_styles_report_giornale_line()["style_number"] + style_table = self.get_styles_report_giornale_line()["style_table"] + style_table_line_above = self.get_styles_report_giornale_line()[ + "style_table_line_above" + ] + colwidths = self.get_colwidths_report_giornale(width_available) + + previous_move_name = "" + list_balance = [ + (0, 0), + (self.progressive_debit2, self.progressive_credit), + ] + + company = self.env.company + user_lang = company.partner_id.lang + model_account = self.env["account.account"] + + # pylint: disable=no-search-all + all_account = model_account.search([]).filtered( + lambda acc: company.id in acc.company_ids.ids + ) + account_dict = self.get_account_dict(all_account) + + for line in list_line_not_grouped: + start_row += 1 + account_name = ( + account_dict[line["account_id"]] + " - " + line["account_name"] + and line["account_name"][user_lang] + or "" + if account_dict + and "line_id" in account_dict.keys() + and "account_id" in account_dict[line].keys() + else line["account_name"] and line["account_name"][user_lang] or "" + ) + if not account_name: + continue + account_name = account_name.replace("<", "<").replace(">", ">") + row = Paragraph(str(start_row), style_name) + date = Paragraph(format_date(self.env, line["date"]), style_name) + ref = Paragraph(str(line["ref"]), style_name) + move = Paragraph(line["move_name"] or "", style_name) + move_name = line["move_name"] or "" + account = Paragraph(account_name, style_name) + + # Management of data visualization based on account type + # For credit/debit accounts, displays the partner name, + # otherwise displays the entry name + if line["account_type"] in ["asset_receivable", "liability_payable"]: + name = ( + line["partner_name"] + and Paragraph(line["partner_name"], style_name) + or "" + ) + else: + name = Paragraph(line["name"], style_name) + + # evitiamo che i caratteri < o > vengano interpretato come tag html + # dalla libreria reportlab + debit = Paragraph(formatLang(self.env, line["debit"]), style_number) + credit = Paragraph(formatLang(self.env, line["credit"]), style_number) + list_balance.append((line["debit"], line["credit"])) + line_data = [[row, date, ref, move, account, name, debit, credit]] + if previous_move_name != move_name: + previous_move_name = move_name + tables.append( + Table(line_data, colWidths=colwidths, style=style_table_line_above) + ) + else: + tables.append(Table(line_data, colWidths=colwidths, style=style_table)) + return tables, list_balance + + def get_balance_data_report_giornale(self, tot_debit, tot_credit, final=False): + style_name = self.get_styles_report_giornale_line()["style_name"] + style_number = self.get_styles_report_giornale_line()["style_number"] + + if final: + name = Paragraph(self.env._("Final Balance"), style_name) + else: + name = Paragraph(self.env._("Balance"), style_name) + + balance_data = [ + [ + "", + "", + "", + "", + "", + name, + Paragraph(formatLang(self.env, tot_debit), style_number), + Paragraph(formatLang(self.env, tot_credit), style_number), + ] + ] + return balance_data + + def create_report_giornale_reportlab(self): + pdf_bytes = io.BytesIO() + + WIDTH, HEIGHT = A4 + width_available = WIDTH - (2 * margin_left) + height_available = HEIGHT + report = canvas.Canvas(pdf_bytes, pagesize=A4) + height_available = self.get_template_header_report_giornale( + report, height_available + ) + + style_table = self.get_styles_report_giornale_line()["style_table"] + style_table_line_above = self.get_styles_report_giornale_line()[ + "style_table_line_above" + ] + + colwidths = self.get_colwidths_report_giornale(width_available) + data_header = self.get_data_header_report_giornale() + tables = [Table(data_header, colWidths=colwidths, style=style_table)] + initial_balance_data = self.get_initial_balance_data_report_giornale() + tables.append( + Table(initial_balance_data, colWidths=colwidths, style=style_table) + ) + start_row = self.start_row + if self.group_by_account: + list_grupped_line = self.get_grupped_line_reportlab_ids() + if not list_grupped_line: + raise UserError( + self.env._("No documents found in the current selection") + ) + final_tables, list_balance = self.get_grupped_final_tables_report_giornale( + list_grupped_line, tables, start_row, width_available + ) + else: + list_line_not_grouped = self.get_line_reportlab_ids() + if not list_line_not_grouped: + raise UserError( + self.env._("No documents found in the current selection") + ) + final_tables, list_balance = self.get_final_tables_report_giornale( + list_line_not_grouped, tables, start_row, width_available + ) + + height_available -= gap + i = 0 + tot_debit = 0 + tot_credit = 0 + for table in final_tables: + table_width, table_height = table.wrapOn(report, width_available, HEIGHT) + if height_available - footer_height < table_height: + balance_data = self.get_balance_data_report_giornale( + tot_debit, tot_credit, final=False + ) + table_balance = Table( + balance_data, colWidths=colwidths, style=style_table_line_above + ) + table_balance_width, table_balance_height = table_balance.wrapOn( + report, WIDTH, HEIGHT + ) + height_available -= table_balance_height + table_balance.drawOn(report, margin_left, height_available) + self.get_template_footer_report_giornale(report) + + report.showPage() + height_available = self.get_template_header_report_giornale( + report, HEIGHT + ) + height_available -= gap + header_table = Table( + data_header, colWidths=colwidths, style=style_table + ) + header_table_width, header_table_height = header_table.wrapOn( + report, WIDTH, HEIGHT + ) + height_available -= header_table_height + header_table.drawOn(report, margin_left, height_available) + table_balance = Table( + balance_data, colWidths=colwidths, style=style_table + ) + table_balance.wrapOn(report, WIDTH, HEIGHT) + height_available -= header_table_height + table_balance_height + table_balance.drawOn(report, margin_left, height_available) + + tot_debit += list_balance[i][0] + tot_credit += list_balance[i][1] + height_available -= table_height + table.drawOn(report, margin_left, height_available) + i += 1 + + final_balance_data = self.get_balance_data_report_giornale( + tot_debit, tot_credit, final=True + ) + final_balance_table = Table( + final_balance_data, colWidths=colwidths, style=style_table_line_above + ) + ( + final_balance_table_width, + final_balance_table_height, + ) = final_balance_table.wrapOn(report, WIDTH, HEIGHT) + if height_available - footer_height >= final_balance_table_height: + height_available -= final_balance_table_height + final_balance_table.drawOn(report, margin_left, height_available) + else: + self.get_template_footer_report_giornale(report) + + report.showPage() + height_available = self.get_template_header_report_giornale(report, HEIGHT) + height_available -= gap + header_table = Table(data_header, colWidths=colwidths, style=style_table) + header_table_width, header_table_height = header_table.wrapOn( + report, WIDTH, HEIGHT + ) + height_available -= header_table_height + header_table.drawOn(report, margin_left, height_available) + height_available -= header_table_height + final_balance_table_height + final_balance_table.drawOn(report, margin_left, height_available) + self.get_template_footer_report_giornale(report) + report.showPage() + report.save() + + file_base64 = base64.b64encode(pdf_bytes.getvalue()) + self.write({"report_giornale": file_base64}) + + return start_row, tot_debit, tot_credit + + def print_giornale_reportlab(self): + self.create_report_giornale_reportlab() + + view_id = self.env.ref( + "l10n_it_central_journal_reportlab.wizard_giornale_reportlab", + raise_if_not_found=False, + ) + + return { + "view_id": view_id.id, + "view_mode": "form", + "res_model": "wizard.giornale.reportlab", + "res_id": self.id, + "type": "ir.actions.act_window", + "target": "new", + } + + def print_giornale_reportlab_final(self): + end_row, end_debit, end_credit = self.create_report_giornale_reportlab() + + if ( + not self.company_id.tax_lock_date + or self.company_id.tax_lock_date < self.date_move_line_to + ): + self.company_id.sudo().tax_lock_date = self.date_move_line_to + + daterange_vals = { + "date_last_print": self.date_move_line_to, + "progressive_line_number": end_row, + "progressive_debit": end_debit, + "progressive_credit": end_credit, + } + self.daterange_id.write(daterange_vals) + + view_id = self.env.ref( + "l10n_it_central_journal_reportlab.wizard_giornale_reportlab", + raise_if_not_found=False, + ) + + return { + "view_id": view_id.id, + "view_mode": "form", + "res_model": "wizard.giornale.reportlab", + "res_id": self.id, + "type": "ir.actions.act_window", + "target": "new", + } diff --git a/l10n_it_central_journal_reportlab/wizard/print_giornale.xml b/l10n_it_central_journal_reportlab/wizard/print_giornale.xml new file mode 100644 index 000000000000..9755ee32661f --- /dev/null +++ b/l10n_it_central_journal_reportlab/wizard/print_giornale.xml @@ -0,0 +1,82 @@ + + + + General Journal Reportlab + wizard.giornale.reportlab + form + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+ + + General Journal Reportlab + general-journal-reportlab + wizard.giornale.reportlab + form + + new + + + +