diff --git a/l10n_it_central_journal_reportlab/README.rst b/l10n_it_central_journal_reportlab/README.rst new file mode 100644 index 000000000000..c9e5922d9144 --- /dev/null +++ b/l10n_it_central_journal_reportlab/README.rst @@ -0,0 +1,82 @@ +================================ +ITA - Libro giornale - Reportlab +================================ + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/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/12.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-12-0/l10n-italy-12-0-l10n_it_central_journal_reportlab + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/122/12.0 + :alt: Try me on Runbot + +|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 smashing 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 + +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_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..b23298761aea --- /dev/null +++ b/l10n_it_central_journal_reportlab/__manifest__.py @@ -0,0 +1,25 @@ +# 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': '12.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': ['As400it', 'Borruso'], + "depends": [ + 'account', + 'date_range' + ], + "data": [ + 'security/ir.model.access.csv', + 'wizard/print_giornale.xml', + 'views/account_journal_view.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..576a3a99b6c7 --- /dev/null +++ b/l10n_it_central_journal_reportlab/i18n/it.po @@ -0,0 +1,326 @@ +# 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 12.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-04-28 08:51+0000\n" +"PO-Revision-Date: 2023-04-28 08:51+0000\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 +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:213 +#, python-format +msgid " VAT: " +msgstr " P.IVA: " + +#. module: l10n_it_central_journal_reportlab +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:276 +#, python-format +msgid "Account" +msgstr "Conto" + +#. module: l10n_it_central_journal_reportlab +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:77 +#, python-format +msgid "Account Central Journal - {date_range}.pdf" +msgstr "Libro giornale - {date_range}.pdf" + +#. module: l10n_it_central_journal_reportlab +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:81 +#, python-format +msgid "Account Central Journal.pdf" +msgstr "Libro giornale.pdf" + +#. module: l10n_it_central_journal_reportlab +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:275 +#, python-format +msgid "Account Move" +msgstr "Movimento contabile" + +#. module: l10n_it_central_journal_reportlab +#: selection:wizard.giornale.reportlab,target_move:0 +msgid "All" +msgstr "Tutti" + +#. module: l10n_it_central_journal_reportlab +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:413 +#, 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 +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:279 +#, python-format +msgid "Credit" +msgstr "Avere" + +#. module: l10n_it_central_journal_reportlab +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:274 +#, 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 "From date" +msgstr "Dalla data" + +#. 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 +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 +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:278 +#, 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 +#: selection:wizard.giornale.reportlab,target_move:0 +msgid "Draft" +msgstr "Bozza" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_account_bank_statement_import_journal_creation__central_journal_exclude_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_account_journal__central_journal_exclude_reportlab +msgid "Exclude from General Journal (Reportlab)" +msgstr "Escludere da libro giornale (Reportlab)" + +#. module: l10n_it_central_journal_reportlab +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:411 +#, 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.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 "" + +#. module: l10n_it_central_journal_reportlab +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:286 +#, 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_reportlab +msgid "Last printed date (Reportlab)" +msgstr "Ultima data di stampa (Reportlab)" + +#. 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 +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:277 +#, python-format +msgid "Name" +msgstr "Nome" + +#. 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 +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:220 +#, python-format +msgid "Page: %s / %s" +msgstr "Pagina: %s / %s" + +#. module: l10n_it_central_journal_reportlab +#: selection:wizard.giornale.reportlab,target_move:0 +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,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_credit_reportlab +msgid "Progressive Credit (Reportlab)" +msgstr "Progressivo avere (Reportlab)" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__progressive_debit +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_debit_reportlab +msgid "Progressive Debit (Reportlab)" +msgstr "Progressivo dare (Reportlab)" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_date_range__progressive_line_number_reportlab +msgid "Progressive line (Reportlab)" +msgstr "Progressivo riga (Reportlab)" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_date_range__progressive_page_number_reportlab +msgid "Progressive of the page (Reportlab)" +msgstr "Progressivo pagina (Reportlab)" + +#. 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 "Stampa libro 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 libro giornale" + +#. module: l10n_it_central_journal_reportlab +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:273 +#, 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__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 "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 per 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" + 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..25d9f692cc21 --- /dev/null +++ b/l10n_it_central_journal_reportlab/i18n/l10n_it_central_journal_reportlab.pot @@ -0,0 +1,326 @@ +# 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 12.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-04-28 08:49+0000\n" +"PO-Revision-Date: 2023-04-28 08:49+0000\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 +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:213 +#, python-format +msgid " VAT: " +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:276 +#, python-format +msgid "Account" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:77 +#, python-format +msgid "Account Central Journal - {date_range}.pdf" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:81 +#, python-format +msgid "Account Central Journal.pdf" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:275 +#, python-format +msgid "Account Move" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: selection:wizard.giornale.reportlab,target_move:0 +msgid "All" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:413 +#, python-format +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 +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:279 +#, python-format +msgid "Credit" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:274 +#, python-format +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 "From date" +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 +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 +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:278 +#, python-format +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 +#: selection:wizard.giornale.reportlab,target_move:0 +msgid "Draft" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_account_bank_statement_import_journal_creation__central_journal_exclude_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_account_journal__central_journal_exclude_reportlab +msgid "Exclude from General Journal (Reportlab)" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:411 +#, python-format +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.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 +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:286 +#, python-format +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____last_update +msgid "Last Modified on" +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_reportlab +msgid "Last printed date (Reportlab)" +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 +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:277 +#, python-format +msgid "Name" +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 +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:220 +#, python-format +msgid "Page: %s / %s" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: selection:wizard.giornale.reportlab,target_move:0 +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,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_credit_reportlab +msgid "Progressive Credit (Reportlab)" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_wizard_giornale_reportlab__progressive_debit +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_debit_reportlab +msgid "Progressive Debit (Reportlab)" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_date_range__progressive_line_number_reportlab +msgid "Progressive line (Reportlab)" +msgstr "" + +#. module: l10n_it_central_journal_reportlab +#: model:ir.model.fields,field_description:l10n_it_central_journal_reportlab.field_date_range__progressive_page_number_reportlab +msgid "Progressive of the page (Reportlab)" +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 +#: code:addons/l10n_it_central_journal_reportlab/wizard/print_giornale.py:273 +#, python-format +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__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..7d15060ae4c5 --- /dev/null +++ b/l10n_it_central_journal_reportlab/models/account.py @@ -0,0 +1,36 @@ +# Copyright 2018 Gianmarco Conte (gconte@dinamicheaziendali.it) + +from odoo import models, fields +import odoo.addons.decimal_precision as dp + + +class AccountJournalInherit(models.Model): + _inherit = "account.journal" + + central_journal_exclude_reportlab = fields.Boolean( + string='Exclude from General Journal (Reportlab)' + ) + + +class DateRangeInherit(models.Model): + _inherit = "date.range" + + date_last_print_reportlab = fields.Date('Last printed date (Reportlab)') + progressive_page_number_reportlab = fields.Integer( + string='Progressive of the page (Reportlab)', + default=0 + ) + progressive_line_number_reportlab = fields.Integer( + string='Progressive line (Reportlab)', + default=0 + ) + progressive_credit_reportlab = fields.Float( + 'Progressive Credit (Reportlab)', + digits=dp.get_precision('Account'), + default=0.0 + ) + progressive_debit_reportlab = fields.Float( + 'Progressive Debit (Reportlab)', + digits=dp.get_precision('Account'), + default=0.0 + ) diff --git a/l10n_it_central_journal_reportlab/readme/CONTRIBUTORS.rst b/l10n_it_central_journal_reportlab/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000000..71dd092145b1 --- /dev/null +++ b/l10n_it_central_journal_reportlab/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* Gianmarco Conte +* Lara Baggio +* Glauco Prina +* Giuseppe Borruso diff --git a/l10n_it_central_journal_reportlab/readme/DESCRIPTION.rst b/l10n_it_central_journal_reportlab/readme/DESCRIPTION.rst new file mode 100644 index 000000000000..19123dd41b2c --- /dev/null +++ b/l10n_it_central_journal_reportlab/readme/DESCRIPTION.rst @@ -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..eb77ed27c44f --- /dev/null +++ b/l10n_it_central_journal_reportlab/security/ir.model.access.csv @@ -0,0 +1,2 @@ +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,date_range.model_date_range,account.group_account_manager,1,1,0,0 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..ce8a98909e2e --- /dev/null +++ b/l10n_it_central_journal_reportlab/static/description/index.html @@ -0,0 +1,425 @@ + + + + + + +ITA - Libro giornale - Reportlab + + + +
+

ITA - Libro giornale - Reportlab

+ + +

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

+

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 smashing 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.

+

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..eb13e8ed3fd3 --- /dev/null +++ b/l10n_it_central_journal_reportlab/tests/test_central_journal_reportlab.py @@ -0,0 +1,62 @@ +# Copyright 2022 Giuseppe Borruso +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +import base64 +import io +from datetime import datetime +from PyPDF2 import PdfFileReader +from dateutil.rrule import MONTHLY + +from odoo.tests.common import Form, TransactionCase + + +class TestCentralJournalReportlab(TransactionCase): + def setUp(self): + super(TestCentralJournalReportlab, self).setUp() + + self.today = datetime.now() + self.range_type = self.env["date.range.type"].create({"name": "Fiscal year"}) + self.env["date.range.generator"].create( + { + "date_start": "%s-01-01" % self.today.year, + "name_prefix": "%s-" % 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()), + ] + ) + self.wizard_model = self.env["wizard.giornale.reportlab"] + self.journals = self.env["account.journal"].search([]) + + def test_wizard_reportlab(self): + wizard_form = Form(self.wizard_model) + wizard_form.daterange = self.current_period + wizard = wizard_form.save() + self.assertEqual( + len(wizard.journal_ids), + len( + self.journals.filtered( + lambda j: not j.central_journal_exclude_reportlab + ) + ), + ) + 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 = PdfFileReader(self.minimal_reader_buffer) + self.assertTrue(self.minimal_reader_buffer) diff --git a/l10n_it_central_journal_reportlab/views/account_journal_view.xml b/l10n_it_central_journal_reportlab/views/account_journal_view.xml new file mode 100644 index 000000000000..d28d9f7635f3 --- /dev/null +++ b/l10n_it_central_journal_reportlab/views/account_journal_view.xml @@ -0,0 +1,15 @@ + + + + + view.central.journal.account.journal.form + account.journal + + + + + + + + + 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 100755 index 000000000000..d88f906ca0ca --- /dev/null +++ b/l10n_it_central_journal_reportlab/views/date_range_view.xml @@ -0,0 +1,33 @@ + + + + + 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..251045881c56 --- /dev/null +++ b/l10n_it_central_journal_reportlab/wizard/print_giornale.py @@ -0,0 +1,560 @@ +# Copyright 2018 Gianmarco Conte (gconte@dinamicheaziendali.it) + +import base64 +import io + +from odoo import _, api, fields, models +from datetime import timedelta +from odoo.tools.float_utils import float_compare +from odoo.tools.misc import flatten, formatLang, format_date +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 + +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_reportlab', '=', False), + ]) + return journal_ids + + _name = "wizard.giornale.reportlab" + _description = "Wizard journal report with reportlab" + + date_move_line_from = fields.Date('From date', required=True) + last_def_date_print = fields.Date('Last definitive date print') + date_move_line_to = fields.Date('To date', required=True) + daterange = fields.Many2one('date.range', + 'Date Range', + required=True) + company_id = fields.Many2one(related='daterange.company_id', + readonly=True, store=True) + progressive_credit = fields.Float('Progressive Credit') + progressive_debit = fields.Float('Progressive Debit') + journal_ids = fields.Many2many( + 'account.journal', + 'giornale_reportlab_journals_rel', + 'journal_id', + 'giornale_reportlab_id', + default=_get_journal, + string='Journals', + required=True) + target_move = fields.Selection([('all', 'All'), + ('posted', 'Posted'), + ('draft', 'Draft')], + 'Target Move', default='all') + 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(string="Report Giornale") + report_giornale_name = fields.Char( + string="Report Giornale Name", + compute="_compute_report_giornale_name", + ) + group_by_account = fields.Boolean(string="Group by account", default=False) + + @api.depends("report_giornale", "daterange") + def _compute_report_giornale_name(self): + for wizard in self: + if wizard.report_giornale and wizard.daterange: + wizard.report_giornale_name = _( + "Account Central Journal - {date_range}.pdf" + ).format(date_range=wizard.daterange.name) + elif wizard.report_giornale: + wizard.report_giornale_name = _("Account Central Journal.pdf") + else: + wizard.report_giornale_name = False + + @api.onchange('date_move_line_from') + def get_year_footer_reportlab(self): + if self.date_move_line_from: + self.year_footer = fields.Date.to_date( + self.date_move_line_from).year + + @api.onchange('daterange') + def on_change_daterange_reportlab(self): + if self.daterange: + date_start = fields.Date.to_date(self.daterange.date_start) + date_end = fields.Date.to_date(self.daterange.date_end) + + if self.daterange.date_last_print_reportlab: + date_last_print = fields.Date.to_date( + self.daterange.date_last_print_reportlab) + self.last_def_date_print = date_last_print + date_start = str(date_last_print + timedelta(days=1)) + else: + self.last_def_date_print = None + self.date_move_line_from = date_start + self.date_move_line_to = date_end + if self.daterange.progressive_line_number_reportlab != 0: + self.start_row = self.daterange.progressive_line_number_reportlab + 1 + else: + self.start_row = self.daterange.progressive_line_number_reportlab + self.progressive_debit = self.daterange.progressive_debit_reportlab + self.progressive_credit = self.daterange.progressive_credit_reportlab + + if self.last_def_date_print == self.daterange.date_end: + self.date_move_line_from = self.last_def_date_print + + def get_sql_line_reportlab(self): + if self.env.context.get("grupped", False): + select = """ + am.date, + am.name AS move_name, + am.ref AS move_ref, + aa.code AS account_code, + aa.name AS account_name, + COALESCE(am.ref, '') AS name, + SUM(aml.debit) AS debit, + SUM(aml.credit) AS credit + """ + group_by = "GROUP BY am.date, am.name, aa.id, am.ref" + else: + select = """ + aml.id + """ + group_by = "" + + sql = """ + SELECT + {select} + 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) + 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 + {group_by} + ORDER BY + am.date, + am.name, + am.ref, + aa.code + """.format(select=select, group_by=group_by) + return sql + + def get_grupped_line_reportlab_ids(self): + wizard = self + if wizard.target_move and wizard.target_move != 'all': + target_type = [wizard.target_move] + else: + target_type = ['posted', 'draft'] + sql = wizard.with_context(grupped=True).get_sql_line_reportlab() + 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) + } + 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 and wizard.target_move != 'all': + target_type = [wizard.target_move] + else: + target_type = ['posted', 'draft'] + sql = wizard.get_sql_line_reportlab() + 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) + } + self.env.cr.execute(sql, params) + res = self.env.cr.fetchall() + move_line_ids = flatten(res) + return move_line_ids + + def _get_move_name_reportlab(self, move_ref, move_name): + return " - ".join(filter(None, [move_ref, move_name])) + + def _get_account_name_reportlab(self, account_code, account_name): + return " - ".join(filter(None, [account_code, account_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.env.user.company_id.name) + report.setFont("Helvetica", 10) + text = "" + if self.env.user.company_id.street: + text += self.env.user.company_id.street + if self.env.user.company_id.zip: + text += " " + self.env.user.company_id.zip + if self.env.user.company_id.city: + text += " - " + self.env.user.company_id.city + if self.env.user.company_id.state_id.code: + text += " - " + self.env.user.company_id.state_id.code + if self.env.user.company_id.vat: + text += _(" VAT: ") + self.env.user.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 = _("Page: %s / %s") % (self.year_footer, 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, 35, 130, 130, 130, 50, 50] + total = sum(colwidths) + return [c/total * width_available for c in colwidths] + + def get_data_header_report_giornale(self, style_header, style_header_number): + data_header = [[ + Paragraph(_("Row"), style_header), + Paragraph(_("Date"), style_header), + Paragraph(_("Account Move"), style_header), + Paragraph(_("Account"), style_header), + Paragraph(_("Name"), style_header), + Paragraph(_("Debit"), style_header_number), + Paragraph(_("Credit"), style_header_number), + ]] + return data_header + + def get_initial_balance_data_report_giornale(self, style_name, style_number): + initial_balance_data = [[ + "", "", "", "", + Paragraph(_("Initial Balance"), style_name), + Paragraph( + formatLang(self.env, self.progressive_debit), style_number + ), + Paragraph( + formatLang(self.env, self.progressive_credit), style_number + ), + ]] + return initial_balance_data + + def get_grupped_final_tables_report_giornale( + self, list_grupped_line, tables, start_row, style_name, style_number, + style_table, style_table_line_above, colwidths + ): + previous_move_name = "" + list_balance = [ + (0, 0), + (self.progressive_debit, self.progressive_credit), + ] + + for line in list_grupped_line: + start_row += 1 + row = Paragraph(str(start_row), style_name) + date = Paragraph(format_date(self.env, line["date"]), style_name) + move_name = self._get_move_name_reportlab( + line.get("move_ref", ""), line.get("move_name", "") + ) + move = Paragraph(move_name, style_name) + account_name = self._get_account_name_reportlab( + line.get("account_code", ""), line.get("account_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 = [] + precision = self.env.user.company_id.currency_id.decimal_places + if float_compare(line["debit"], 0.0, precision_rounding=precision) > 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, move, account, name, debit, credit]] + ) + if float_compare(line["credit"], 0.0, precision_rounding=precision) > 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, 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, move_line_ids, tables, start_row, style_name, style_number, + style_table, style_table_line_above, colwidths + ): + previous_move_name = "" + list_balance = [ + (0, 0), + (self.progressive_debit, self.progressive_credit), + ] + + for line in self.env["account.move.line"].browse(move_line_ids): + start_row += 1 + row = Paragraph(str(start_row), style_name) + date = Paragraph(format_date(self.env, line.date), style_name) + move_name = self._get_move_name_reportlab( + line.move_id.ref, line.move_id.name + ) + move = Paragraph(move_name, style_name) + account_name = self._get_account_name_reportlab( + line.account_id.code, line.account_id.name + ) + account = Paragraph(account_name, style_name) + if line.account_id.user_type_id.type in ["receivable", "payable"]: + name = Paragraph(str(line.partner_id.name or ""), style_name) + else: + name = Paragraph(str(line.name or ""), style_name) + 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, 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, style_name, style_number, tot_debit, tot_credit, final=False): + if final: + name = Paragraph(_("Final Balance"), style_name) + else: + name = Paragraph(_("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_header = self.get_styles_report_giornale_line()["style_header"] + style_header_number = \ + self.get_styles_report_giornale_line()["style_header_number"] + style_table = self.get_styles_report_giornale_line()["style_table"] + style_name = self.get_styles_report_giornale_line()["style_name"] + style_number = self.get_styles_report_giornale_line()["style_number"] + 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(style_header, style_header_number) + tables = [Table(data_header, colWidths=colwidths, style=style_table)] + initial_balance_data = \ + self.get_initial_balance_data_report_giornale(style_name, style_number) + 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() + final_tables, list_balance = \ + self.get_grupped_final_tables_report_giornale( + list_grupped_line, tables, start_row, style_name, style_number, + style_table, style_table_line_above, colwidths + ) + else: + move_line_ids = self.get_line_reportlab_ids() + final_tables, list_balance = self.get_final_tables_report_giornale( + move_line_ids, tables, start_row, style_name, style_number, + style_table, style_table_line_above, colwidths + ) + + height_available -= gap + tot_debit = 0 + tot_credit = 0 + for i, table in enumerate(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( + style_name, style_number, 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( + style_name, style_number, 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): + end_row, end_debit, end_credit = self.create_report_giornale_reportlab() + + if self.env.context.get("final", False): + if not self.company_id.period_lock_date \ + or self.company_id.period_lock_date < self.date_move_line_to: + self.company_id.sudo().period_lock_date = self.date_move_line_to + + daterange_vals = { + "date_last_print_reportlab": self.date_move_line_to, + "progressive_line_number_reportlab": end_row, + "progressive_debit_reportlab": end_debit, + "progressive_credit_reportlab": end_credit, + } + self.daterange.write(daterange_vals) + + model_data_obj = self.env["ir.model.data"] + view_rec = model_data_obj.get_object_reference( + "l10n_it_central_journal_reportlab", "wizard_giornale_reportlab" + ) + view_id = view_rec and view_rec[1] or False + + return { + "view_type": "form", + "view_id": [view_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 100755 index 000000000000..6c81328b14e3 --- /dev/null +++ b/l10n_it_central_journal_reportlab/wizard/print_giornale.xml @@ -0,0 +1,74 @@ + + + + + + General Journal Reportlab + wizard.giornale.reportlab + form + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+ + + General Journal Reportlab + ir.actions.act_window + wizard.giornale.reportlab + form + form + new + + + + +
+
diff --git a/setup/l10n_it_central_journal_reportlab/odoo/addons/l10n_it_central_journal_reportlab b/setup/l10n_it_central_journal_reportlab/odoo/addons/l10n_it_central_journal_reportlab new file mode 120000 index 000000000000..fb1aa15b7ef2 --- /dev/null +++ b/setup/l10n_it_central_journal_reportlab/odoo/addons/l10n_it_central_journal_reportlab @@ -0,0 +1 @@ +../../../../l10n_it_central_journal_reportlab \ No newline at end of file diff --git a/setup/l10n_it_central_journal_reportlab/setup.py b/setup/l10n_it_central_journal_reportlab/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/l10n_it_central_journal_reportlab/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)