diff --git a/account_invoice_transmit/README.rst b/account_invoice_transmit/README.rst new file mode 100644 index 000000000000..c11edc781836 --- /dev/null +++ b/account_invoice_transmit/README.rst @@ -0,0 +1,96 @@ +================ +Invoice Transmit +================ + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:e7ef387c66082f8ac1bc4f285492c27837091b3bff5cdf39494340ada3a69f3e + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Faccount--invoicing-lightgray.png?logo=github + :target: https://github.com/OCA/account-invoicing/tree/16.0/account_invoice_transmit + :alt: OCA/account-invoicing +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/account-invoicing-16-0/account-invoicing-16-0-account_invoice_transmit + :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/account-invoicing&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Mass sending of invoices according to the transmit method. + +Also have a look at the module account_move_sent_usability + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +Select a list of invoices to send. Launch the 'Mass Sending' action. + +Vizualize how much invoices will be sent for each available transmit method. +Choose the transmit method to launch. + +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 +~~~~~~~ + +* BCIM + +Contributors +~~~~~~~~~~~~ + +* Jacques-Etienne Baudoux (BCIM) +* Camptocamp +* Acsone SA + +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-jbaudoux| image:: https://github.com/jbaudoux.png?size=40px + :target: https://github.com/jbaudoux + :alt: jbaudoux + +Current `maintainer `__: + +|maintainer-jbaudoux| + +This module is part of the `OCA/account-invoicing `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_invoice_transmit/__init__.py b/account_invoice_transmit/__init__.py new file mode 100644 index 000000000000..64face17ae84 --- /dev/null +++ b/account_invoice_transmit/__init__.py @@ -0,0 +1 @@ +from . import models, wizards diff --git a/account_invoice_transmit/__manifest__.py b/account_invoice_transmit/__manifest__.py new file mode 100644 index 000000000000..257a8f2eeda6 --- /dev/null +++ b/account_invoice_transmit/__manifest__.py @@ -0,0 +1,27 @@ +# Copyright 2015 Jacques-Etienne Baudoux (BCIM) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + "name": "Invoice Transmit", + "version": "16.0.1.0.0", + "category": "Accounting/Accounting", + "summary": "Invoice mass sending", + "author": "BCIM, Odoo Community Association (OCA)", + "maintainers": ["jbaudoux"], + "website": "https://github.com/OCA/account-invoicing", + "license": "AGPL-3", + "depends": [ + "account_invoice_transmit_method", + "web_notify", + "queue_job", + ], + "data": [ + "security/ir_model_access.xml", + "views/account_move.xml", + "views/account_invoice_print.xml", + "wizards/account_invoice_transmit.xml", + "data/queue_job_channel.xml", + "data/queue_job_functions.xml", + ], + "installable": True, +} diff --git a/account_invoice_transmit/data/queue_job_channel.xml b/account_invoice_transmit/data/queue_job_channel.xml new file mode 100644 index 000000000000..52df322b17c7 --- /dev/null +++ b/account_invoice_transmit/data/queue_job_channel.xml @@ -0,0 +1,15 @@ + + + + invoice_transmit + + + + invoice_transmit_post + + + + invoice_transmit_email + + + diff --git a/account_invoice_transmit/data/queue_job_functions.xml b/account_invoice_transmit/data/queue_job_functions.xml new file mode 100644 index 000000000000..33f3af9f233f --- /dev/null +++ b/account_invoice_transmit/data/queue_job_functions.xml @@ -0,0 +1,20 @@ + + + + + + + _transmit_invoice_by_email + + + + + + + _transmit_invoice_by_post + + + + + diff --git a/account_invoice_transmit/i18n/account_invoice_transmit.pot b/account_invoice_transmit/i18n/account_invoice_transmit.pot new file mode 100644 index 000000000000..75ffbe0d224c --- /dev/null +++ b/account_invoice_transmit/i18n/account_invoice_transmit.pot @@ -0,0 +1,361 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_invoice_transmit +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-04-28 09:15+0000\n" +"PO-Revision-Date: 2024-04-28 09:15+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: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.account_invoice_transmit_view +msgid " email(s) missing" +msgstr "" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.view_account_invoice_print_form +msgid "Invoices" +msgstr "" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.account_invoice_transmit_view +msgid "Please select the operation" +msgstr "" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.account_invoice_transmit_view +msgid "Please set a transmit method on those invoices" +msgstr "" + +#. module: account_invoice_transmit +#. odoo-python +#: code:addons/account_invoice_transmit/models/account_invoice_print.py:0 +#, python-format +msgid "A report for printing the invoices is available." +msgstr "" + +#. module: account_invoice_transmit +#. odoo-python +#: code:addons/account_invoice_transmit/wizards/account_invoice_transmit.py:0 +#, python-format +msgid "A report will be generated in the background." +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.actions.act_window,name:account_invoice_transmit.action_account_invoice_print_form +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.view_account_invoice_print_form +msgid "Account Invoice Print" +msgstr "" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.account_invoice_transmit_view +msgid "Cancel" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_print__create_uid +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__create_uid +msgid "Created by" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_print__create_date +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__create_date +msgid "Created on" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_print__display_name +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__display_name +msgid "Display Name" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_print__document +msgid "Document" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields.selection,name:account_invoice_transmit.selection__account_invoice_print__state__done +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.view_account_invoice_print_view +msgid "Done" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__count_transmit_email_missing +msgid "Email address missing" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_print__fname +msgid "Fname" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields,help:account_invoice_transmit.field_account_invoice_transmit__resend +msgid "Force resending already sent invoices" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_print__id +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__id +msgid "ID" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields.selection,name:account_invoice_transmit.selection__account_invoice_print__state__progress +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.view_account_invoice_print_view +msgid "In Progress" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_print__invoice_ids +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__invoice_ids +msgid "Invoice" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.ui.menu,name:account_invoice_transmit.account_invoice_print +msgid "Invoice Prints" +msgstr "" + +#. module: account_invoice_transmit +#. odoo-python +#: code:addons/account_invoice_transmit/models/account_invoice_print.py:0 +#, python-format +msgid "Invoice generation has succeeded" +msgstr "" + +#. module: account_invoice_transmit +#. odoo-python +#: code:addons/account_invoice_transmit/wizards/account_invoice_transmit.py:0 +#, python-format +msgid "Invoice marked as sent" +msgstr "" + +#. module: account_invoice_transmit +#. odoo-python +#: code:addons/account_invoice_transmit/models/account_move.py:0 +#, python-format +msgid "Invoice sent by %s" +msgstr "" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.view_account_invoice_print_view +msgid "Invoices" +msgstr "" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.account_invoice_transmit_view +msgid "Invoices Mass Sending" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model,name:account_invoice_transmit.model_account_invoice_print +msgid "Invoices sending report" +msgstr "" + +#. module: account_invoice_transmit +#. odoo-python +#: code:addons/account_invoice_transmit/wizards/account_invoice_transmit.py:0 +#, python-format +msgid "Invoices will be sent by email in the background." +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_bank_statement_line__is_invoice_to_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_move__is_invoice_to_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_payment__is_invoice_to_transmit +msgid "Is Invoice To Transmit" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model,name:account_invoice_transmit.model_account_move +msgid "Journal Entry" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_print____last_update +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit____last_update +msgid "Last Modified on" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_print__write_uid +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_print__write_date +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__write_date +msgid "Last Updated on" +msgstr "" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.account_invoice_transmit_view +msgid "Mark as sent" +msgstr "" + +#. module: account_invoice_transmit +#. odoo-python +#: code:addons/account_invoice_transmit/models/account_move.py:0 +#, python-format +msgid "Mass Sending" +msgstr "" + +#. module: account_invoice_transmit +#. odoo-python +#: code:addons/account_invoice_transmit/wizards/account_invoice_transmit.py:0 +#, python-format +msgid "Mass generating invoice emails for sending" +msgstr "" + +#. module: account_invoice_transmit +#. odoo-python +#: code:addons/account_invoice_transmit/wizards/account_invoice_transmit.py:0 +#, python-format +msgid "Mass generating invoice reports for sending" +msgstr "" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.view_account_invoice_print_view +msgid "My reports" +msgstr "" + +#. module: account_invoice_transmit +#. odoo-python +#: code:addons/account_invoice_transmit/wizards/account_invoice_transmit.py:0 +#, python-format +msgid "No invoice with valid email to send" +msgstr "" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.account_invoice_transmit_view +msgid "Only mark as sent without sending anything" +msgstr "" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.account_invoice_transmit_view +msgid "Print" +msgstr "" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.account_invoice_transmit_view +msgid "" +"Print invoices having an invoice transmit method 'post'. Also mark as sent" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model,name:account_invoice_transmit.model_queue_job +msgid "Queue Job" +msgstr "" + +#. module: account_invoice_transmit +#. odoo-python +#: code:addons/account_invoice_transmit/models/queue_job.py:0 +#, python-format +msgid "Related Record" +msgstr "" + +#. module: account_invoice_transmit +#. odoo-python +#: code:addons/account_invoice_transmit/models/queue_job.py:0 +#, python-format +msgid "Related Records" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__resend +msgid "Resend" +msgstr "" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.view_account_invoice_print_view +msgid "Search Account Invoice Print" +msgstr "" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.view_invoice_tree +msgid "Send" +msgstr "" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.account_invoice_transmit_view +msgid "Send by email" +msgstr "" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.account_invoice_transmit_view +msgid "" +"Send by email invoices having an invoice transmit method 'mail'. Also mark " +"as sent" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_print__state +msgid "State" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__count_transmit_email +msgid "Total by email" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__count_transmit_post +msgid "Total by post" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__count_transmit_undefined +msgid "Total undefined" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__transmit_email_invoice_ids +msgid "Transmit Email Invoice" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__transmit_email_valid_invoice_ids +msgid "Transmit Email Valid Invoice" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__transmit_invoice_ids +msgid "Transmit Invoice" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__transmit_post_invoice_ids +msgid "Transmit Post Invoice" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__transmit_undefined_invoice_ids +msgid "Transmit Undefined Invoice" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model,name:account_invoice_transmit.model_account_invoice_transmit +msgid "Wizard to send invoices" +msgstr "" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.account_invoice_transmit_view +msgid "view invoices" +msgstr "" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.account_invoice_transmit_view +msgid "view partners" +msgstr "" diff --git a/account_invoice_transmit/i18n/fr.po b/account_invoice_transmit/i18n/fr.po new file mode 100644 index 000000000000..dbb1a4ab836b --- /dev/null +++ b/account_invoice_transmit/i18n/fr.po @@ -0,0 +1,365 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_invoice_transmit +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-04-28 09:14+0000\n" +"PO-Revision-Date: 2024-04-28 09:14+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: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.account_invoice_transmit_view +msgid " email(s) missing" +msgstr " email(s) manquants" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.view_account_invoice_print_form +msgid "Invoices" +msgstr "Factures" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.account_invoice_transmit_view +msgid "Please select the operation" +msgstr "Veuillez choisir l'opération" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.account_invoice_transmit_view +msgid "Please set a transmit method on those invoices" +msgstr "Veuillez définir la méthode d'envoi sur ces factures" + +#. module: account_invoice_transmit +#. odoo-python +#: code:addons/account_invoice_transmit/models/account_invoice_print.py:0 +#, python-format +msgid "A report for printing the invoices is available." +msgstr "Un rapport d'impression de factures est disponible." + +#. module: account_invoice_transmit +#. odoo-python +#: code:addons/account_invoice_transmit/wizards/account_invoice_transmit.py:0 +#, python-format +msgid "A report will be generated in the background." +msgstr "Un rapport va être généré en tâche de fond." + +#. module: account_invoice_transmit +#: model:ir.actions.act_window,name:account_invoice_transmit.action_account_invoice_print_form +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.view_account_invoice_print_form +msgid "Account Invoice Print" +msgstr "" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.account_invoice_transmit_view +msgid "Cancel" +msgstr "Annuler" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_print__create_uid +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__create_uid +msgid "Created by" +msgstr "Créé par" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_print__create_date +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__create_date +msgid "Created on" +msgstr "Créé le" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_print__display_name +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__display_name +msgid "Display Name" +msgstr "Nom affiché" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_print__document +msgid "Document" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields.selection,name:account_invoice_transmit.selection__account_invoice_print__state__done +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.view_account_invoice_print_view +msgid "Done" +msgstr "Fait" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__count_transmit_email_missing +msgid "Email address missing" +msgstr "Adresse email manquante" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_print__fname +msgid "Fname" +msgstr "Nom de fichier" + +#. module: account_invoice_transmit +#: model:ir.model.fields,help:account_invoice_transmit.field_account_invoice_transmit__resend +msgid "Force resending already sent invoices" +msgstr "Forcer le réenvoi des factures déjà envoyées" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_print__id +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__id +msgid "ID" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields.selection,name:account_invoice_transmit.selection__account_invoice_print__state__progress +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.view_account_invoice_print_view +msgid "In Progress" +msgstr "En cours" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_print__invoice_ids +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__invoice_ids +msgid "Invoice" +msgstr "Facture" + +#. module: account_invoice_transmit +#: model:ir.ui.menu,name:account_invoice_transmit.account_invoice_print +msgid "Invoice Prints" +msgstr "" + +#. module: account_invoice_transmit +#. odoo-python +#: code:addons/account_invoice_transmit/models/account_invoice_print.py:0 +#, python-format +msgid "Invoice generation has succeeded" +msgstr "" + +#. module: account_invoice_transmit +#. odoo-python +#: code:addons/account_invoice_transmit/wizards/account_invoice_transmit.py:0 +#, python-format +msgid "Invoice marked as sent" +msgstr "Facture marquée comme envoyée" + +#. module: account_invoice_transmit +#. odoo-python +#: code:addons/account_invoice_transmit/models/account_move.py:0 +#, python-format +msgid "Invoice sent by %s" +msgstr "Facture envoyée par %s" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.view_account_invoice_print_view +msgid "Invoices" +msgstr "Factures" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.account_invoice_transmit_view +msgid "Invoices Mass Sending" +msgstr "Envoi en masse de factures" + +#. module: account_invoice_transmit +#: model:ir.model,name:account_invoice_transmit.model_account_invoice_print +msgid "Invoices sending report" +msgstr "Méthode d'envoi de facture" + +#. module: account_invoice_transmit +#. odoo-python +#: code:addons/account_invoice_transmit/wizards/account_invoice_transmit.py:0 +#, python-format +msgid "Invoices will be sent by email in the background." +msgstr "Des factures vont être envoyer par courriel en tâche de fond." + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_bank_statement_line__is_invoice_to_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_move__is_invoice_to_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_payment__is_invoice_to_transmit +msgid "Is Invoice To Transmit" +msgstr "Est un facture à envoyer" + +#. module: account_invoice_transmit +#: model:ir.model,name:account_invoice_transmit.model_account_move +msgid "Journal Entry" +msgstr "Pièce comptable" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_print____last_update +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit____last_update +msgid "Last Modified on" +msgstr "Dernière Modification le" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_print__write_uid +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__write_uid +msgid "Last Updated by" +msgstr "Dernière mise à jour par" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_print__write_date +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__write_date +msgid "Last Updated on" +msgstr "Dernière mise à jour le" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.account_invoice_transmit_view +msgid "Mark as sent" +msgstr "Marquer comme envoyé" + +#. module: account_invoice_transmit +#. odoo-python +#: code:addons/account_invoice_transmit/models/account_move.py:0 +#, python-format +msgid "Mass Sending" +msgstr "Envoi en masse" + +#. module: account_invoice_transmit +#. odoo-python +#: code:addons/account_invoice_transmit/wizards/account_invoice_transmit.py:0 +#, python-format +msgid "Mass generating invoice emails for sending" +msgstr "Génération en masse d'emails pour l'envoi de factures" + +#. module: account_invoice_transmit +#. odoo-python +#: code:addons/account_invoice_transmit/wizards/account_invoice_transmit.py:0 +#, python-format +msgid "Mass generating invoice reports for sending" +msgstr "Génération en masse du rapport pour l'envoi de factures" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.view_account_invoice_print_view +msgid "My reports" +msgstr "" + +#. module: account_invoice_transmit +#. odoo-python +#: code:addons/account_invoice_transmit/wizards/account_invoice_transmit.py:0 +#, python-format +msgid "No invoice with valid email to send" +msgstr "Pas de facture avec un email valide à envoyer" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.account_invoice_transmit_view +msgid "Only mark as sent without sending anything" +msgstr "Uniquement marquer comme envoyer sans rien envoyer" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.account_invoice_transmit_view +msgid "Print" +msgstr "Imprimer" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.account_invoice_transmit_view +msgid "" +"Print invoices having an invoice transmit method 'post'. Also mark as sent" +msgstr "" +"Imprime les factures ayant une méthode d'envoi par 'post' et marque comme " +"envoyé" + +#. module: account_invoice_transmit +#: model:ir.model,name:account_invoice_transmit.model_queue_job +msgid "Queue Job" +msgstr "Queue de jobs" + +#. module: account_invoice_transmit +#. odoo-python +#: code:addons/account_invoice_transmit/models/queue_job.py:0 +#, python-format +msgid "Related Record" +msgstr "" + +#. module: account_invoice_transmit +#. odoo-python +#: code:addons/account_invoice_transmit/models/queue_job.py:0 +#, python-format +msgid "Related Records" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__resend +msgid "Resend" +msgstr "Réenvoyer" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.view_account_invoice_print_view +msgid "Search Account Invoice Print" +msgstr "" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.view_invoice_tree +msgid "Send" +msgstr "Envoyer" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.account_invoice_transmit_view +msgid "Send by email" +msgstr "Envoi par email" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.account_invoice_transmit_view +msgid "" +"Send by email invoices having an invoice transmit method 'mail'. Also mark " +"as sent" +msgstr "" +"Envoie par email les factures ayant une méthode d'envoi par 'mail' et marque" +" comme envoyé" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_print__state +msgid "State" +msgstr "Etat" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__count_transmit_email +msgid "Total by email" +msgstr "Total par email" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__count_transmit_post +msgid "Total by post" +msgstr "Total par poste" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__count_transmit_undefined +msgid "Total undefined" +msgstr "Total non défini" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__transmit_email_invoice_ids +msgid "Transmit Email Invoice" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__transmit_email_valid_invoice_ids +msgid "Transmit Email Valid Invoice" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__transmit_invoice_ids +msgid "Transmit Invoice" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__transmit_post_invoice_ids +msgid "Transmit Post Invoice" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model.fields,field_description:account_invoice_transmit.field_account_invoice_transmit__transmit_undefined_invoice_ids +msgid "Transmit Undefined Invoice" +msgstr "" + +#. module: account_invoice_transmit +#: model:ir.model,name:account_invoice_transmit.model_account_invoice_transmit +msgid "Wizard to send invoices" +msgstr "" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.account_invoice_transmit_view +msgid "view invoices" +msgstr "voir les factures" + +#. module: account_invoice_transmit +#: model_terms:ir.ui.view,arch_db:account_invoice_transmit.account_invoice_transmit_view +msgid "view partners" +msgstr "voir les partenaires" diff --git a/account_invoice_transmit/models/__init__.py b/account_invoice_transmit/models/__init__.py new file mode 100644 index 000000000000..47d76949769f --- /dev/null +++ b/account_invoice_transmit/models/__init__.py @@ -0,0 +1,3 @@ +from . import account_move +from . import account_invoice_print +from . import queue_job diff --git a/account_invoice_transmit/models/account_invoice_print.py b/account_invoice_transmit/models/account_invoice_print.py new file mode 100644 index 000000000000..b1db19ab0937 --- /dev/null +++ b/account_invoice_transmit/models/account_invoice_print.py @@ -0,0 +1,66 @@ +# Copyright 2015 Jacques-Etienne Baudoux (BCIM) +# Copyright 2018 Camptocamp SA +# Copyright 2020 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +import base64 + +from odoo import _, fields, models + + +class AccountInvoicePrint(models.Model): + _name = "account.invoice.print" + _rec_name = "create_date" + _description = "Invoices sending report" + + invoice_ids = fields.Many2many("account.move", readonly=True) + document = fields.Binary( + comodel_name="ir.attachment", attachment=True, readonly=True + ) + fname = fields.Char(compute="_compute_file_name") + state = fields.Selection( + selection=[("progress", "In Progress"), ("done", "Done")], + required=True, + readonly=True, + default="progress", + ) + + def _compute_file_name(self): + for record in self: + record.fname = f"invoice_print_{record.id}.pdf" + + def _notify_report_generated(self): + self.ensure_one() + action_xmlid = "account_invoice_transmit.action_account_invoice_print_form" + action = self.env["ir.actions.act_window"]._for_xml_id(action_xmlid) + action.update({"res_id": self.id, "views": [(False, "form")]}) + self.env.user.notify_info( + _("A report for printing the invoices is available."), + sticky=True, + action=action, + ) + + def generate_report(self): + """Generate a pdf report for all invoices.""" + self.ensure_one() + content, _content_type = self.env["ir.actions.report"]._render_qweb_pdf( + "account.report_invoice", self.invoice_ids.ids, False + ) + self.document = base64.b64encode(content) + self._notify_report_generated() + self.state = "done" + return _("Invoice generation has succeeded") + + def action_view_invoice(self): + invoices = self.mapped("invoice_ids") + action = self.env["ir.actions.act_window"]._for_xml_id( + "account.action_move_out_invoice_type" + ) + if len(invoices) > 1: + action["domain"] = [("id", "in", invoices.ids)] + elif len(invoices) == 1: + action["views"] = [(self.env.ref("account.invoice_form").id, "form")] + action["res_id"] = invoices.ids[0] + else: + action = {"type": "ir.actions.act_window_close"} + return action diff --git a/account_invoice_transmit/models/account_move.py b/account_invoice_transmit/models/account_move.py new file mode 100644 index 000000000000..5f06147f09dc --- /dev/null +++ b/account_invoice_transmit/models/account_move.py @@ -0,0 +1,84 @@ +# Copyright 2015 Jacques-Etienne Baudoux (BCIM) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import _, api, fields, models + + +class AccountMove(models.Model): + _inherit = "account.move" + + is_invoice_to_transmit = fields.Boolean(compute="_compute_is_invoice_to_transmit") + + @api.depends("state", "move_type", "is_move_sent") + def _compute_is_invoice_to_transmit(self): + for rec in self: + if ( + rec.state == "posted" + and rec.move_type in ("out_invoice", "out_refund") + and not rec.is_move_sent + ): + rec.is_invoice_to_transmit = True + else: + rec.is_invoice_to_transmit = False + + def _get_transmit_invoice_by_email_template(self): + """Return email template used in mass sending""" + return self.env.ref("account.email_template_edi_invoice") + + def _transmit_invoice(self, method): + # we need to apply the filter because the state may have + # changed since when we delayed the job + invoices = self.exists().filtered("is_invoice_to_transmit") + if not invoices: + return self.browse() + invoices.write({"is_move_sent": True}) + for invoice in invoices: + invoice.message_post(body=_("Invoice sent by %s") % method) + return invoices + + def _transmit_invoice_by_post(self): + """Mass sending by post""" + invoices = self._transmit_invoice("post") + invoice_print = self.env["account.invoice.print"].create( + {"invoice_ids": [(6, 0, invoices.ids)]} + ) + invoice_print.generate_report() + + def _transmit_invoice_by_email(self): + """Mass sending by email""" + invoices = self._transmit_invoice("email") + for invoice in invoices: + email_template = self._get_transmit_invoice_by_email_template() + email_template.send_mail(invoice.id) + + def action_send_and_print(self): + # Replace standard method by new wizard + view = self.env.ref("account_invoice_transmit.account_invoice_transmit_view") + report_action = { + "name": _("Mass Sending"), + "type": "ir.actions.act_window", + "view_type": "form", + "view_mode": "form", + "res_model": "account.invoice.transmit", + "views": [(view.id, "form")], + "view_id": view.id, + "target": "new", + "context": dict(active_model=self._name, active_ids=self.ids), + } + return report_action + + def action_invoice_sent(self): + # Replace standard method by new wizard + out = self.filtered(lambda r: r.move_type in ("out_invoice", "out_refund")) + if not out: + return super().action_invoice_sent() + wizard = out.action_send_and_print() + if ( + self.env.is_admin() + and not self.env.company.external_report_layout_id + and not self.env.context.get("discard_logo_check") + ): + return self.env[ + "ir.actions.report" + ]._action_configure_external_report_layout(wizard) + return wizard diff --git a/account_invoice_transmit/models/queue_job.py b/account_invoice_transmit/models/queue_job.py new file mode 100644 index 000000000000..d5e3571fa1ac --- /dev/null +++ b/account_invoice_transmit/models/queue_job.py @@ -0,0 +1,52 @@ +# Copyright 2018 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import _ + +from odoo.addons.queue_job.models.queue_job import QueueJob as QueueJobBase + + +class QueueJob(QueueJobBase): + def related_action_open_invoice(self): + """Open a form view with the invoices of the job. + + Use customer/supplier view depending of the type of the invoice. + """ + self.ensure_one() + model_name = self.model_name + records = self.env[model_name].browse(self.record_ids).exists() + if not records: + return None + + action = { + "name": _("Related Record"), + "type": "ir.actions.act_window", + "view_type": "form", + "view_mode": "form", + "res_model": records._name, + } + + if all( + invoice_type in ("out_invoice", "out_refund") + for invoice_type in records.mapped("move_type") + ): + tree_xmlid = "account.view_invoice_tree" + else: + tree_xmlid = "account.view_in_invoice_tree" + form_xmlid = "account.view_move_form" + form_view_id = self.env.ref(form_xmlid).id + tree_view_id = self.env.ref(tree_xmlid).id + + if len(records) == 1: + action.update({"res_id": records.id, "view_id": form_view_id}) + action["res_id"] = records.id + else: + action.update( + { + "name": _("Related Records"), + "view_mode": "tree,form", + "domain": [("id", "in", records.ids)], + "views": [(tree_view_id, "tree"), (form_view_id, "form")], + } + ) + return action diff --git a/account_invoice_transmit/readme/CONTRIBUTORS.rst b/account_invoice_transmit/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000000..f30366003a78 --- /dev/null +++ b/account_invoice_transmit/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Jacques-Etienne Baudoux (BCIM) +* Camptocamp +* Acsone SA diff --git a/account_invoice_transmit/readme/DESCRIPTION.rst b/account_invoice_transmit/readme/DESCRIPTION.rst new file mode 100644 index 000000000000..0e0b9b070e6e --- /dev/null +++ b/account_invoice_transmit/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +Mass sending of invoices according to the transmit method. + +Also have a look at the module account_move_sent_usability diff --git a/account_invoice_transmit/readme/USAGE.rst b/account_invoice_transmit/readme/USAGE.rst new file mode 100644 index 000000000000..5e33901be166 --- /dev/null +++ b/account_invoice_transmit/readme/USAGE.rst @@ -0,0 +1,4 @@ +Select a list of invoices to send. Launch the 'Mass Sending' action. + +Vizualize how much invoices will be sent for each available transmit method. +Choose the transmit method to launch. diff --git a/account_invoice_transmit/security/ir_model_access.xml b/account_invoice_transmit/security/ir_model_access.xml new file mode 100644 index 000000000000..8cd3eae98e51 --- /dev/null +++ b/account_invoice_transmit/security/ir_model_access.xml @@ -0,0 +1,32 @@ + + + + + access_account_invoice_print + + + + + + + + + + access_account_invoice_state + + + + + + + + + diff --git a/account_invoice_transmit/static/description/index.html b/account_invoice_transmit/static/description/index.html new file mode 100644 index 000000000000..3e698e2d4526 --- /dev/null +++ b/account_invoice_transmit/static/description/index.html @@ -0,0 +1,432 @@ + + + + + +Invoice Transmit + + + +
+

Invoice Transmit

+ + +

Beta License: AGPL-3 OCA/account-invoicing Translate me on Weblate Try me on Runboat

+

Mass sending of invoices according to the transmit method.

+

Also have a look at the module account_move_sent_usability

+

Table of contents

+ +
+

Usage

+

Select a list of invoices to send. Launch the ‘Mass Sending’ action.

+

Vizualize how much invoices will be sent for each available transmit method. +Choose the transmit method to launch.

+
+
+

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

+
    +
  • BCIM
  • +
+
+
+

Contributors

+
    +
  • Jacques-Etienne Baudoux (BCIM) <je@bcim.be>
  • +
  • Camptocamp
  • +
  • Acsone SA
  • +
+
+
+

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 maintainer:

+

jbaudoux

+

This module is part of the OCA/account-invoicing project on GitHub.

+

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

+
+
+
+ + diff --git a/account_invoice_transmit/tests/__init__.py b/account_invoice_transmit/tests/__init__.py new file mode 100644 index 000000000000..43f54b2bbfbd --- /dev/null +++ b/account_invoice_transmit/tests/__init__.py @@ -0,0 +1 @@ +from . import test_wizard_invoice_transmit diff --git a/account_invoice_transmit/tests/common.py b/account_invoice_transmit/tests/common.py new file mode 100644 index 000000000000..0ddcf993242f --- /dev/null +++ b/account_invoice_transmit/tests/common.py @@ -0,0 +1,114 @@ +# Copyright 2020 ACSONE SA/NV +# Copyright 2024 Jacques-Etienne Baudoux (BCIM) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo.fields import Command +from odoo.tests import tagged + +from odoo.addons.account.tests.common import AccountTestInvoicingCommon + + +@tagged("post_install", "-at_install") +class AccountInvoicePrintCommon(AccountTestInvoicingCommon): + @classmethod + def setUpClass(cls): + """ + Create 5 partners with 2 invoices by partner. + + Only partner 0 and 2 should received invoice by letter + """ + super().setUpClass() + cls.env = cls.env( + context=dict( + cls.env.context, tracking_disable=True, force_report_rendering=True + ) + ) + + cls.AccountAccount = cls.env["account.account"] + cls.AccountMove = cls.env["account.move"] + cls.AccountMoveLine = cls.env["account.move.line"] + cls.AccountInvoicePrint = cls.env["account.invoice.print"] + cls.AccountJournal = cls.env["account.journal"] + cls.email = cls.env.ref("account_invoice_transmit_method.mail") + cls.post = cls.env.ref("account_invoice_transmit_method.post") + + for i in range(5): + partner = cls.env["res.partner"].create( + { + "name": "TEST {i}", + "ref": "{i}", + } + ) + setattr(cls, f"partner_{i}", partner) + # partner 0 and 2 receive invoice by post + cls.partner_0.customer_invoice_transmit_method_id = cls.post + cls.partner_2.customer_invoice_transmit_method_id = cls.post + # partner 1 and 3 receive invoice by email but only 1 has an email + cls.partner_1.customer_invoice_transmit_method_id = cls.email + cls.partner_1.email = "t@dummy.com" + cls.partner_3.customer_invoice_transmit_method_id = cls.email + # partner 4 has not transmit method defined + + cls.company = cls.env.ref("base.main_company") + cls.account_recv = cls.company_data["default_account_receivable"] + cls.account_payable = cls.company_data["default_account_payable"] + cls.partner = cls.env.ref("base.res_partner_2") + cls.journal = cls.company_data["default_journal_sale"] + cls.product = cls.env.ref("product.product_product_4") + + # create 2 invoices for each partner + cls.invoices = cls.AccountMove.browse() + for i in range(2): + for p in range(5): + partner = getattr(cls, f"partner_{p}") + # Instance: invoice + invoice = cls.AccountMove.create( + { + "partner_id": partner.id, + "move_type": "out_invoice", + "invoice_date": "2019-01-21", + "date": "2019-01-21", + "invoice_line_ids": [ + Command.create( + { + "name": f"test {i} {p}", + "price_unit": 100.00 * p * i, + "quantity": 1, + "product_id": cls.product.id, + } + ) + ], + } + ) + setattr(cls, f"partner_{p}_invoice_{i}", invoice) + cls.invoices |= invoice + cls.invoices.action_post() + + def filter(self, record): + # required to mute logger + return 0 + + def _print_invoices(self, invoices): + invoice_print = self.AccountInvoicePrint.create( + {"invoice_ids": [(6, 0, invoices.ids)]} + ) + return invoice_print.generate_report() + + def _sort_invoices(self, invoices): + return invoices.sorted( + lambda i: (i.partner_id.name and i.partner_id.name.lower(), i.name) + ) + + def _get_invoice_ids_from_invoices_path(self, invoices_path): + return [int(p.split(".")[1]) for p in invoices_path] + + def _generate_invoice_document(self, invoice): + self.env["ir.actions.report"]._render_qweb_pdf( + "account.report_invoice", res_ids=invoice.ids + ) + + def assertAttachmentCount(self, instances, count): + attachment_count = self.env["ir.attachment"].search_count( + [("res_id", "in", instances.ids), ("res_model", "=", instances._name)] + ) + self.assertEqual(count, attachment_count) diff --git a/account_invoice_transmit/tests/test_wizard_invoice_transmit.py b/account_invoice_transmit/tests/test_wizard_invoice_transmit.py new file mode 100644 index 000000000000..06bfae76dc09 --- /dev/null +++ b/account_invoice_transmit/tests/test_wizard_invoice_transmit.py @@ -0,0 +1,142 @@ +# Copyright 2023 ACSONE SA/NV +# Copyright 2024 Jacques-Etienne Baudoux (BCIM) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo.addons.queue_job.tests.common import JobMixin, trap_jobs + +from .common import AccountInvoicePrintCommon + + +class TestAccountInvoicePrintWizard(AccountInvoicePrintCommon, JobMixin): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.Wizard = cls.env["account.invoice.transmit"] + + def test_counters(self): + """Test counters + + Data: + partner_0 with transmit method "post" + partner_1 with transmit method "mail" + partner_2 with transmit method "post" + partner_3 with transmit method "mail" without email + partner_4 with no transmit method + """ + wizard = self.Wizard.with_context( + active_ids=self.invoices.ids, active_model="account.move" + ).create({}) + self.assertEqual(4, wizard.count_transmit_post) + self.assertEqual(4, wizard.count_transmit_email) + self.assertEqual(2, wizard.count_transmit_email_missing) + self.assertEqual(2, wizard.count_transmit_undefined) + + def test_print(self): + """Test print + + Data: + partner_0 with 2 invoices and transmit method "post" + partner_2 with 2 invoices and transmit method "post" + Test case: + Generate the all the invoices before launching the wizard + Print all the invoices with the wizard + Expected result: + * 4 invoices are printed (partner_0 and partner_2) for sending + method "post" + """ + wizard = self.Wizard.with_context( + active_ids=self.invoices.ids, active_model="account.move" + ).create({}) + + with trap_jobs() as trap: + wizard.button_print() + trap.assert_jobs_count(1) + trap.enqueued_jobs[0].perform() + self.assertAttachmentCount(self.invoices, 4) + + def test_email(self): + """Test email + + Data: + partner_1 with 2 invoices and transmit method "mail" + Test case: + Generate the all the invoices before launching the wizard + Generate the mail sending + Expected result: + * 2 invoices are in attachments + * 2 mails are sent + """ + mail_count = self.env["mail.mail"].search_count([]) + wizard = self.Wizard.with_context( + active_ids=self.invoices.ids, active_model="account.move" + ).create({}) + + with trap_jobs() as trap: + wizard.button_email() + trap.assert_jobs_count(1) + trap.enqueued_jobs[0].perform() + # Mail template has attachment field value set + self.assertAttachmentCount(self.invoices, 2) + mail_count_after = self.env["mail.mail"].search_count([]) - mail_count + self.assertEqual(2, mail_count_after) + + def test_mark_as_sent(self): + """Test mark as sent and resend + + Data: + partner_0 with transmit method "post" + partner_1 with transmit method "mail" + partner_2 with transmit method "post" + partner_3 with transmit method "mail" without email + Test case: + Generate the all the invoices before launching the wizard + Mark them as sent + Expected result: + * Invoices should be marked as sent + * No attachment should have been generated + """ + wizard = self.Wizard.with_context( + active_ids=self.invoices.ids, active_model="account.move" + ).create({}) + wizard.button_mark_only() + self.assertTrue(all(invoice.is_move_sent for invoice in self.invoices)) + self.assertAttachmentCount(self.invoices, 0) + + # Check the counters + wizard = self.Wizard.with_context( + active_ids=self.invoices.ids, active_model="account.move" + ).create({}) + self.assertEqual(0, wizard.count_transmit_email) + self.assertEqual(0, wizard.count_transmit_post) + wizard.resend = True + self.assertEqual(4, wizard.count_transmit_email) + self.assertEqual(4, wizard.count_transmit_post) + + def test_related_post(self): + """Test open invoices from job for post""" + wizard = self.Wizard.with_context( + active_ids=self.invoices.ids, active_model="account.move" + ).create({}) + + invoices = wizard.transmit_post_invoice_ids + self.assertEqual(4, len(invoices)) + counter = self.job_counter() + wizard.button_print() + job = counter.search_created() + action = job.related_action_open_invoice() + domain = action.get("domain") + self.assertListEqual(invoices.ids, domain[0][2]) + + def test_related_email(self): + """Test open invoices from job for email""" + wizard = self.Wizard.with_context( + active_ids=self.invoices.ids, active_model="account.move" + ).create({}) + + invoices = wizard.transmit_email_valid_invoice_ids + self.assertEqual(2, len(invoices)) + counter = self.job_counter() + wizard.button_email() + job = counter.search_created() + action = job.related_action_open_invoice() + domain = action.get("domain") + self.assertListEqual(invoices.ids, domain[0][2]) diff --git a/account_invoice_transmit/views/account_invoice_print.xml b/account_invoice_transmit/views/account_invoice_print.xml new file mode 100644 index 000000000000..c0e53ef8e7f2 --- /dev/null +++ b/account_invoice_transmit/views/account_invoice_print.xml @@ -0,0 +1,80 @@ + + + + account.invoice.print.tree + account.invoice.print + 10 + + + + + + + + + + + account.invoice.print.search + account.invoice.print + 1 + + + + + + + + + + + account.invoice.print.form + account.invoice.print + 10 + +
+
+ +
+ +
+ +
+ + + + + + +
+
+
+
+ + Account Invoice Print + account.invoice.print + tree,form + {'default_search_my': 1} + + +
diff --git a/account_invoice_transmit/views/account_move.xml b/account_invoice_transmit/views/account_move.xml new file mode 100644 index 000000000000..10684605fecc --- /dev/null +++ b/account_invoice_transmit/views/account_move.xml @@ -0,0 +1,21 @@ + + + + + account.invoice.transmit + account.move + + + +