diff --git a/sale_order_invoicing_queued/README.rst b/sale_order_invoicing_queued/README.rst new file mode 100644 index 00000000000..304a0504b7b --- /dev/null +++ b/sale_order_invoicing_queued/README.rst @@ -0,0 +1,124 @@ +============================= +Enqueue sales order invoicing +============================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:aba259bf3a3cdba02fda1914c23bfc3f1ae2d803c77ecaa8db3a95ee567ad7f3 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/18.0/sale_order_invoicing_queued + :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-18-0/account-invoicing-18-0-sale_order_invoicing_queued + :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=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows to enqueue in several jobs the sales orders invoicing +process to be executed in paralell on background, which is normally done +serially and on foreground. + +Jobs are split following the same criteria as standard Odoo: grouping by +order invoicing address and order currency. + +**Table of contents** + +.. contents:: + :local: + +Installation +============ + +This module depends on *queue_job* module that is hosted on +https://github.com/OCA/queue. + +It only works in an updated 13.0 version after the 4th of March of 2020, +specifically after the commit +https://github.com/odoo/odoo/commit/6f036e758000. + +Configuration +============= + +Jobs are enqueued in the channel ``root.sale_order_invoicing_queued``, +so you must adjust your Odoo configuration according this. + +If you want to see queued jobs, you need "Job Queue / Job Queue Manager" +permission in your user. + +Usage +===== + +1. Go to *Sales > Invoicing > Orders to Invoice*. +2. Select sales orders whose invoicing you want to enqueue. +3. Click on *Action > Invoice Order*. +4. Click on "Enqueue Invoicing" button. +5. On that moment, jobs will be enqueued on foreground, but the control + will be returned to you after that. +6. Having the "Job Queue Manager" permissions, you can go to the sales + order, and see the tab "Invoicing Jobs". There a list with all the + jobs related to that sales order can be found. + +Changelog +========= + +16.0.1.0.0 (2024-07-22) +----------------------- + +- Migration of the module. Only change was on saleorder_views to add + 'group' tag inside the page and not as a field. + +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 +------- + +* Tecnativa + +Contributors +------------ + +- `Tecnativa `__: + + - Pedro M. Baeza + +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/account-invoicing `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sale_order_invoicing_queued/__init__.py b/sale_order_invoicing_queued/__init__.py new file mode 100644 index 00000000000..7588e52c8cc --- /dev/null +++ b/sale_order_invoicing_queued/__init__.py @@ -0,0 +1,4 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models +from . import wizards diff --git a/sale_order_invoicing_queued/__manifest__.py b/sale_order_invoicing_queued/__manifest__.py new file mode 100644 index 00000000000..3551ca760fb --- /dev/null +++ b/sale_order_invoicing_queued/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2019 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Enqueue sales order invoicing", + "version": "18.0.1.0.0", + "category": "Sales Management", + "license": "AGPL-3", + "author": "Tecnativa, " "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/account-invoicing", + "depends": ["sale", "queue_job"], + "data": [ + "data/job_queue.xml", + "views/queue_job_views.xml", + "views/sale_order_views.xml", + "wizards/sale_advance_payment_inv_views.xml", + ], + "installable": True, +} diff --git a/sale_order_invoicing_queued/data/job_queue.xml b/sale_order_invoicing_queued/data/job_queue.xml new file mode 100644 index 00000000000..ff4ed532358 --- /dev/null +++ b/sale_order_invoicing_queued/data/job_queue.xml @@ -0,0 +1,15 @@ + + + + + invoice_job + + + + + + + create_invoices_job + + + diff --git a/sale_order_invoicing_queued/i18n/ca.po b/sale_order_invoicing_queued/i18n/ca.po new file mode 100644 index 00000000000..085ec887e68 --- /dev/null +++ b/sale_order_invoicing_queued/i18n/ca.po @@ -0,0 +1,55 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_order_invoicing_queued +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: ca\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#. module: sale_order_invoicing_queued +#: model_terms:ir.ui.view,arch_db:sale_order_invoicing_queued.view_queue_job_sale_order_invoicing +msgid "Cancel" +msgstr "" + +#. module: sale_order_invoicing_queued +#: model_terms:ir.ui.view,arch_db:sale_order_invoicing_queued.view_sale_advance_payment_inv +msgid "Enqueue Invoicing" +msgstr "" + +#. module: sale_order_invoicing_queued +#: model:ir.model.fields,field_description:sale_order_invoicing_queued.field_sale_order__invoicing_job_ids +#: model_terms:ir.ui.view,arch_db:sale_order_invoicing_queued.view_order_form_invoicing_queued +msgid "Invoicing Jobs" +msgstr "" + +#. module: sale_order_invoicing_queued +#: model_terms:ir.ui.view,arch_db:sale_order_invoicing_queued.view_queue_job_sale_order_invoicing +msgid "Requeue" +msgstr "" + +#. module: sale_order_invoicing_queued +#: model:ir.model,name:sale_order_invoicing_queued.model_sale_advance_payment_inv +msgid "Sales Advance Payment Invoice" +msgstr "" + +#. module: sale_order_invoicing_queued +#: model:ir.model,name:sale_order_invoicing_queued.model_sale_order +msgid "Sales Order" +msgstr "" + +#. module: sale_order_invoicing_queued +#. odoo-python +#: code:addons/sale_order_invoicing_queued/wizards/sale_advance_payment_inv.py:0 +#, python-format +msgid "" +"There's already an enqueued job for invoicing the sales order %s. Please " +"wait until it's finished or remove it from the selection." +msgstr "" diff --git a/sale_order_invoicing_queued/i18n/es.po b/sale_order_invoicing_queued/i18n/es.po new file mode 100644 index 00000000000..da225a5615e --- /dev/null +++ b/sale_order_invoicing_queued/i18n/es.po @@ -0,0 +1,75 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_order_invoicing_queued +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-08-29 16:09+0000\n" +"PO-Revision-Date: 2023-12-01 14:33+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: sale_order_invoicing_queued +#: model_terms:ir.ui.view,arch_db:sale_order_invoicing_queued.view_queue_job_sale_order_invoicing +msgid "Cancel" +msgstr "Cancelar" + +#. module: sale_order_invoicing_queued +#: model_terms:ir.ui.view,arch_db:sale_order_invoicing_queued.view_sale_advance_payment_inv +msgid "Enqueue Invoicing" +msgstr "Encolar facturación" + +#. module: sale_order_invoicing_queued +#: model:ir.model.fields,field_description:sale_order_invoicing_queued.field_sale_order__invoicing_job_ids +#: model_terms:ir.ui.view,arch_db:sale_order_invoicing_queued.view_order_form_invoicing_queued +msgid "Invoicing Jobs" +msgstr "Trabajos de facturación" + +#. module: sale_order_invoicing_queued +#: model_terms:ir.ui.view,arch_db:sale_order_invoicing_queued.view_queue_job_sale_order_invoicing +msgid "Requeue" +msgstr "Volver a poner en cola" + +#. module: sale_order_invoicing_queued +#: model:ir.model,name:sale_order_invoicing_queued.model_sale_advance_payment_inv +msgid "Sales Advance Payment Invoice" +msgstr "Ventas. Anticipo pago factura" + +#. module: sale_order_invoicing_queued +#: model:ir.model,name:sale_order_invoicing_queued.model_sale_order +msgid "Sales Order" +msgstr "Pedido de venta" + +#. module: sale_order_invoicing_queued +#. odoo-python +#: code:addons/sale_order_invoicing_queued/wizards/sale_advance_payment_inv.py:0 +#, python-format +msgid "" +"There's already an enqueued job for invoicing the sales order %s. Please " +"wait until it's finished or remove it from the selection." +msgstr "" +"Ya existe un trabajo encolado para facturar el pedido de venta %s. Por favor " +"espera hasta que haya terminado o elimine el pedido de la selección." + +#~ msgid "Display Name" +#~ msgstr "Mostrar Nombre" + +#~ msgid "ID" +#~ msgstr "ID" + +#~ msgid "Last Modified on" +#~ msgstr "Última Modificación el" + +#~ msgid "Quotation" +#~ msgstr "Presupuesto" + +#~ msgid "Queue Job" +#~ msgstr "Trabajo en cola" diff --git a/sale_order_invoicing_queued/i18n/it.po b/sale_order_invoicing_queued/i18n/it.po new file mode 100644 index 00000000000..52f09af39e6 --- /dev/null +++ b/sale_order_invoicing_queued/i18n/it.po @@ -0,0 +1,68 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_order_invoicing_queued +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-04-07 13:24+0000\n" +"Last-Translator: Francesco Foresti \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.14.1\n" + +#. module: sale_order_invoicing_queued +#: model_terms:ir.ui.view,arch_db:sale_order_invoicing_queued.view_queue_job_sale_order_invoicing +msgid "Cancel" +msgstr "Annulla" + +#. module: sale_order_invoicing_queued +#: model_terms:ir.ui.view,arch_db:sale_order_invoicing_queued.view_sale_advance_payment_inv +msgid "Enqueue Invoicing" +msgstr "Metti in coda la fatturazione" + +#. module: sale_order_invoicing_queued +#: model:ir.model.fields,field_description:sale_order_invoicing_queued.field_sale_order__invoicing_job_ids +#: model_terms:ir.ui.view,arch_db:sale_order_invoicing_queued.view_order_form_invoicing_queued +msgid "Invoicing Jobs" +msgstr "Jobs Fatturazione" + +#. module: sale_order_invoicing_queued +#: model_terms:ir.ui.view,arch_db:sale_order_invoicing_queued.view_queue_job_sale_order_invoicing +msgid "Requeue" +msgstr "Rimetti in coda" + +#. module: sale_order_invoicing_queued +#: model:ir.model,name:sale_order_invoicing_queued.model_sale_advance_payment_inv +msgid "Sales Advance Payment Invoice" +msgstr "Fattura di vendita con pagamento anticipato" + +#. module: sale_order_invoicing_queued +#: model:ir.model,name:sale_order_invoicing_queued.model_sale_order +msgid "Sales Order" +msgstr "Ordine di vendita" + +#. module: sale_order_invoicing_queued +#. odoo-python +#: code:addons/sale_order_invoicing_queued/wizards/sale_advance_payment_inv.py:0 +#, python-format +msgid "" +"There's already an enqueued job for invoicing the sales order %s. Please " +"wait until it's finished or remove it from the selection." +msgstr "" +"Esiste già un job in coda per fatturare l'ordine di vendita %s. Attendi che " +"sia finito o rimuovilo dalla selezione." + +#~ msgid "Display Name" +#~ msgstr "Nome visualizzato" + +#~ msgid "ID" +#~ msgstr "ID" + +#~ msgid "Last Modified on" +#~ msgstr "Ultima modifica il" diff --git a/sale_order_invoicing_queued/i18n/sale_order_invoicing_queued.pot b/sale_order_invoicing_queued/i18n/sale_order_invoicing_queued.pot new file mode 100644 index 00000000000..fc8b28b147b --- /dev/null +++ b/sale_order_invoicing_queued/i18n/sale_order_invoicing_queued.pot @@ -0,0 +1,54 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_order_invoicing_queued +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: sale_order_invoicing_queued +#: model_terms:ir.ui.view,arch_db:sale_order_invoicing_queued.view_queue_job_sale_order_invoicing +msgid "Cancel" +msgstr "" + +#. module: sale_order_invoicing_queued +#: model_terms:ir.ui.view,arch_db:sale_order_invoicing_queued.view_sale_advance_payment_inv +msgid "Enqueue Invoicing" +msgstr "" + +#. module: sale_order_invoicing_queued +#: model:ir.model.fields,field_description:sale_order_invoicing_queued.field_sale_order__invoicing_job_ids +#: model_terms:ir.ui.view,arch_db:sale_order_invoicing_queued.view_order_form_invoicing_queued +msgid "Invoicing Jobs" +msgstr "" + +#. module: sale_order_invoicing_queued +#: model_terms:ir.ui.view,arch_db:sale_order_invoicing_queued.view_queue_job_sale_order_invoicing +msgid "Requeue" +msgstr "" + +#. module: sale_order_invoicing_queued +#: model:ir.model,name:sale_order_invoicing_queued.model_sale_advance_payment_inv +msgid "Sales Advance Payment Invoice" +msgstr "" + +#. module: sale_order_invoicing_queued +#: model:ir.model,name:sale_order_invoicing_queued.model_sale_order +msgid "Sales Order" +msgstr "" + +#. module: sale_order_invoicing_queued +#. odoo-python +#: code:addons/sale_order_invoicing_queued/wizards/sale_advance_payment_inv.py:0 +#, python-format +msgid "" +"There's already an enqueued job for invoicing the sales order %s. Please " +"wait until it's finished or remove it from the selection." +msgstr "" diff --git a/sale_order_invoicing_queued/i18n/zh_CN.po b/sale_order_invoicing_queued/i18n/zh_CN.po new file mode 100644 index 00000000000..f2a7bb4473f --- /dev/null +++ b/sale_order_invoicing_queued/i18n/zh_CN.po @@ -0,0 +1,59 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_order_invoicing_queued +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2019-12-13 09:05+0000\n" +"Last-Translator: 黎伟杰 <674416404@qq.com>\n" +"Language-Team: none\n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 3.9.1\n" + +#. module: sale_order_invoicing_queued +#: model_terms:ir.ui.view,arch_db:sale_order_invoicing_queued.view_queue_job_sale_order_invoicing +msgid "Cancel" +msgstr "取消" + +#. module: sale_order_invoicing_queued +#: model_terms:ir.ui.view,arch_db:sale_order_invoicing_queued.view_sale_advance_payment_inv +msgid "Enqueue Invoicing" +msgstr "排队开票" + +#. module: sale_order_invoicing_queued +#: model:ir.model.fields,field_description:sale_order_invoicing_queued.field_sale_order__invoicing_job_ids +#: model_terms:ir.ui.view,arch_db:sale_order_invoicing_queued.view_order_form_invoicing_queued +msgid "Invoicing Jobs" +msgstr "开票作业" + +#. module: sale_order_invoicing_queued +#: model_terms:ir.ui.view,arch_db:sale_order_invoicing_queued.view_queue_job_sale_order_invoicing +msgid "Requeue" +msgstr "重新排队" + +#. module: sale_order_invoicing_queued +#: model:ir.model,name:sale_order_invoicing_queued.model_sale_advance_payment_inv +msgid "Sales Advance Payment Invoice" +msgstr "销售预付款发票" + +#. module: sale_order_invoicing_queued +#: model:ir.model,name:sale_order_invoicing_queued.model_sale_order +msgid "Sales Order" +msgstr "销售订单" + +#. module: sale_order_invoicing_queued +#. odoo-python +#: code:addons/sale_order_invoicing_queued/wizards/sale_advance_payment_inv.py:0 +#, python-format +msgid "" +"There's already an enqueued job for invoicing the sales order %s. Please " +"wait until it's finished or remove it from the selection." +msgstr "" +"已经有一个用于为%s销售订单开具发票的排队作业。请等待该作业完成或将其从所选内" +"容中删除。" diff --git a/sale_order_invoicing_queued/models/__init__.py b/sale_order_invoicing_queued/models/__init__.py new file mode 100644 index 00000000000..d1d09e0213d --- /dev/null +++ b/sale_order_invoicing_queued/models/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import sale_order diff --git a/sale_order_invoicing_queued/models/sale_order.py b/sale_order_invoicing_queued/models/sale_order.py new file mode 100644 index 00000000000..2276a5b48d3 --- /dev/null +++ b/sale_order_invoicing_queued/models/sale_order.py @@ -0,0 +1,22 @@ +# Copyright 2019 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class SaleOrder(models.Model): + _inherit = "sale.order" + + invoicing_job_ids = fields.Many2many( + comodel_name="queue.job", + column1="order_id", + column2="job_id", + string="Invoicing Jobs", + copy=False, + ) + + def create_invoices_job(self, final, invoice_date=False): + ctx = self.env.context.copy() + if invoice_date: + ctx.update({"default_invoice_date": invoice_date}) + self.with_context(**ctx)._create_invoices(final=final) diff --git a/sale_order_invoicing_queued/pyproject.toml b/sale_order_invoicing_queued/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/sale_order_invoicing_queued/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/sale_order_invoicing_queued/readme/CONFIGURE.md b/sale_order_invoicing_queued/readme/CONFIGURE.md new file mode 100644 index 00000000000..f9616f222de --- /dev/null +++ b/sale_order_invoicing_queued/readme/CONFIGURE.md @@ -0,0 +1,5 @@ +Jobs are enqueued in the channel `root.sale_order_invoicing_queued`, so +you must adjust your Odoo configuration according this. + +If you want to see queued jobs, you need "Job Queue / Job Queue Manager" +permission in your user. diff --git a/sale_order_invoicing_queued/readme/CONTRIBUTORS.md b/sale_order_invoicing_queued/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..9f68fe41c08 --- /dev/null +++ b/sale_order_invoicing_queued/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- [Tecnativa](https://www.tecnativa.com): + - Pedro M. Baeza diff --git a/sale_order_invoicing_queued/readme/DESCRIPTION.md b/sale_order_invoicing_queued/readme/DESCRIPTION.md new file mode 100644 index 00000000000..eb83e648315 --- /dev/null +++ b/sale_order_invoicing_queued/readme/DESCRIPTION.md @@ -0,0 +1,6 @@ +This module allows to enqueue in several jobs the sales orders invoicing +process to be executed in paralell on background, which is normally done +serially and on foreground. + +Jobs are split following the same criteria as standard Odoo: grouping by +order invoicing address and order currency. diff --git a/sale_order_invoicing_queued/readme/HISTORY.md b/sale_order_invoicing_queued/readme/HISTORY.md new file mode 100644 index 00000000000..20ae0786581 --- /dev/null +++ b/sale_order_invoicing_queued/readme/HISTORY.md @@ -0,0 +1,4 @@ +## 16.0.1.0.0 (2024-07-22) + +- Migration of the module. Only change was on saleorder_views to add + 'group' tag inside the page and not as a field. diff --git a/sale_order_invoicing_queued/readme/INSTALL.md b/sale_order_invoicing_queued/readme/INSTALL.md new file mode 100644 index 00000000000..d2246fc1933 --- /dev/null +++ b/sale_order_invoicing_queued/readme/INSTALL.md @@ -0,0 +1,6 @@ +This module depends on *queue_job* module that is hosted on +. + +It only works in an updated 13.0 version after the 4th of March of 2020, +specifically after the commit +. diff --git a/sale_order_invoicing_queued/readme/USAGE.md b/sale_order_invoicing_queued/readme/USAGE.md new file mode 100644 index 00000000000..24aa23e3b81 --- /dev/null +++ b/sale_order_invoicing_queued/readme/USAGE.md @@ -0,0 +1,9 @@ +1. Go to *Sales \> Invoicing \> Orders to Invoice*. +2. Select sales orders whose invoicing you want to enqueue. +3. Click on *Action \> Invoice Order*. +4. Click on "Enqueue Invoicing" button. +5. On that moment, jobs will be enqueued on foreground, but the control + will be returned to you after that. +6. Having the "Job Queue Manager" permissions, you can go to the sales + order, and see the tab "Invoicing Jobs". There a list with all the + jobs related to that sales order can be found. diff --git a/sale_order_invoicing_queued/static/description/icon.png b/sale_order_invoicing_queued/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/sale_order_invoicing_queued/static/description/icon.png differ diff --git a/sale_order_invoicing_queued/static/description/index.html b/sale_order_invoicing_queued/static/description/index.html new file mode 100644 index 00000000000..fd96cccb9ae --- /dev/null +++ b/sale_order_invoicing_queued/static/description/index.html @@ -0,0 +1,476 @@ + + + + + +Enqueue sales order invoicing + + + +
+

Enqueue sales order invoicing

+ + +

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

+

This module allows to enqueue in several jobs the sales orders invoicing +process to be executed in paralell on background, which is normally done +serially and on foreground.

+

Jobs are split following the same criteria as standard Odoo: grouping by +order invoicing address and order currency.

+

Table of contents

+ +
+

Installation

+

This module depends on queue_job module that is hosted on +https://github.com/OCA/queue.

+

It only works in an updated 13.0 version after the 4th of March of 2020, +specifically after the commit +https://github.com/odoo/odoo/commit/6f036e758000.

+
+
+

Configuration

+

Jobs are enqueued in the channel root.sale_order_invoicing_queued, +so you must adjust your Odoo configuration according this.

+

If you want to see queued jobs, you need “Job Queue / Job Queue Manager” +permission in your user.

+
+
+

Usage

+
    +
  1. Go to Sales > Invoicing > Orders to Invoice.
  2. +
  3. Select sales orders whose invoicing you want to enqueue.
  4. +
  5. Click on Action > Invoice Order.
  6. +
  7. Click on “Enqueue Invoicing” button.
  8. +
  9. On that moment, jobs will be enqueued on foreground, but the control +will be returned to you after that.
  10. +
  11. Having the “Job Queue Manager” permissions, you can go to the sales +order, and see the tab “Invoicing Jobs”. There a list with all the +jobs related to that sales order can be found.
  12. +
+
+
+

Changelog

+
+

16.0.1.0.0 (2024-07-22)

+
    +
  • Migration of the module. Only change was on saleorder_views to add +‘group’ tag inside the page and not as a field.
  • +
+
+
+
+

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

+
    +
  • Tecnativa
  • +
+
+
+

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/account-invoicing project on GitHub.

+

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

+
+
+
+ + diff --git a/sale_order_invoicing_queued/tests/__init__.py b/sale_order_invoicing_queued/tests/__init__.py new file mode 100644 index 00000000000..720608f43b5 --- /dev/null +++ b/sale_order_invoicing_queued/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import test_sale_order_invoicing_queued diff --git a/sale_order_invoicing_queued/tests/test_sale_order_invoicing_queued.py b/sale_order_invoicing_queued/tests/test_sale_order_invoicing_queued.py new file mode 100644 index 00000000000..4cbcac39639 --- /dev/null +++ b/sale_order_invoicing_queued/tests/test_sale_order_invoicing_queued.py @@ -0,0 +1,89 @@ +# Copyright 2019 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import exceptions +from odoo.tests import TransactionCase + + +class TestSaleOrderInvoicingQueue(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) + cls.wizard_obj = cls.env["sale.advance.payment.inv"] + cls.queue_obj = cls.env["queue.job"] + cls.partner = cls.env["res.partner"].create({"name": "Test partner"}) + cls.partner2 = cls.env["res.partner"].create({"name": "Other partner"}) + cls.product = cls.env["product.product"].create( + {"name": "Test product", "type": "service", "invoice_policy": "order"} + ) + cls.order = cls.env["sale.order"].create( + { + "partner_id": cls.partner.id, + "partner_shipping_id": cls.partner.id, + "partner_invoice_id": cls.partner.id, + "pricelist_id": cls.partner.property_product_pricelist.id, + "order_line": [ + ( + 0, + 0, + { + "name": cls.product.name, + "product_id": cls.product.id, + "price_unit": 20, + "product_uom_qty": 1, + "product_uom": cls.product.uom_id.id, + }, + ) + ], + } + ) + cls.order.action_confirm() + cls.order2 = cls.order.copy({"partner_invoice_id": cls.partner2.id}) + cls.order2.action_confirm() + cls.order3 = cls.order.copy() + cls.order3.action_confirm() + + def test_queue_invoicing(self): + wizard = self.wizard_obj.with_context( + active_ids=(self.order + self.order2).ids, active_model=self.order._name + ).create({}) + prev_jobs = self.queue_obj.search([]) + wizard.enqueue_invoices() + current_jobs = self.queue_obj.search([]) + jobs = current_jobs - prev_jobs + self.assertEqual(len(jobs), 2) + self.assertTrue(self.order.invoicing_job_ids) + self.assertTrue(self.order2.invoicing_job_ids) + self.assertNotEqual(self.order.invoicing_job_ids, self.order2.invoicing_job_ids) + # Try to enqueue invoicing again + with self.assertRaises(exceptions.UserError): + wizard.enqueue_invoices() + + def test_direct_invoicing(self): + # Test methods that produces directly invoices + wizard = self.wizard_obj.with_context( + active_ids=self.order.ids, active_model=self.order._name + ).create({"advance_payment_method": "percentage", "amount": 50}) + wizard.enqueue_invoices() + self.assertTrue(self.order.invoice_ids) + + def test_invoicing(self): + # Execute method directly for checking if invoicing is done + self.order.create_invoices_job(True) + self.assertTrue(self.order.invoice_ids) + + def test_direct_invoices_job_date(self): + # Test direct invoicing checking invoice_date declaration + wizard = self.wizard_obj.with_context( + active_ids=self.order3.ids, active_model=self.order3._name + ).create({}) + wizard.enqueue_invoices() + self.order3.create_invoices_job(True, "2024-08-04") + self.assertTrue(self.order3.invoice_ids) + invoice_date = ( + self.order3.invoice_ids[0].invoice_date.strftime("%Y-%m-%d") + if self.order3.invoice_ids[0].invoice_date + else False + ) + self.assertEqual(invoice_date, "2024-08-04") diff --git a/sale_order_invoicing_queued/views/queue_job_views.xml b/sale_order_invoicing_queued/views/queue_job_views.xml new file mode 100644 index 00000000000..8fa7f95d0c6 --- /dev/null +++ b/sale_order_invoicing_queued/views/queue_job_views.xml @@ -0,0 +1,32 @@ + + + + + queue.job + + + + + + + + + + +