From 6afd387ed594285f089cef8b4e04a33676214cf4 Mon Sep 17 00:00:00 2001
From: "Pedro M. Baeza"
Date: Thu, 29 Aug 2019 15:29:16 +0200
Subject: [PATCH 01/35] [ADD] sale_order_invoicing_queued: Enqueue sales order
invoicing
This module allows to enqueue in several jobs the sales orders invoicing
process to be executed in paralell on background, that's it's normally done
serially and on foreground.
Jobs are split following the same criteria as standard Odoo: grouping by
order invoicing address and order currency.
Installation
============
This module depends on *queue_job* module that is hosted on
https://github.com/OCA/queue.
Configuration
=============
If you want to see queued jobs, you need "Job Queue / Job Queue Manager"
permission in your user.
Usage
=====
* Go to *Sales > Invoicing > Orders to Invoice*.
* Select sales orders whose invoicing you want to enqueue.
* Click on *Action > Invoice Order*.
* Click on "Enqueue Invoicing" button.
* On that moment, jobs will be enqueued on foreground, but the control will
be returned to you after that.
* 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.
Known issues / Roadmap
======================
* This module doesn't take into account any possible modification on grouping
criteria, like all the modules that uses
`sale_order_action_invoice_create_hook`.
---
sale_order_invoicing_queued/README.rst | 115 +++++
sale_order_invoicing_queued/__init__.py | 4 +
sale_order_invoicing_queued/__manifest__.py | 22 +
sale_order_invoicing_queued/i18n/es.po | 63 +++
.../i18n/sale_order_invoicing_queued.pot | 57 +++
.../models/__init__.py | 4 +
.../models/queue_job.py | 12 +
.../models/sale_order.py | 31 ++
.../readme/CONFIGURE.rst | 5 +
.../readme/CONTRIBUTORS.rst | 3 +
.../readme/DESCRIPTION.rst | 6 +
.../readme/INSTALL.rst | 2 +
.../readme/ROADMAP.rst | 3 +
sale_order_invoicing_queued/readme/USAGE.rst | 9 +
.../static/description/icon.png | Bin 0 -> 9455 bytes
.../static/description/index.html | 464 ++++++++++++++++++
sale_order_invoicing_queued/tests/__init__.py | 3 +
.../tests/test_sale_order_invoicing_queued.py | 77 +++
.../views/queue_job_views.xml | 29 ++
.../views/sale_order_views.xml | 22 +
.../wizards/__init__.py | 3 +
.../wizards/sale_advance_payment_inv.py | 35 ++
.../sale_advance_payment_inv_views.xml | 14 +
23 files changed, 983 insertions(+)
create mode 100644 sale_order_invoicing_queued/README.rst
create mode 100644 sale_order_invoicing_queued/__init__.py
create mode 100644 sale_order_invoicing_queued/__manifest__.py
create mode 100644 sale_order_invoicing_queued/i18n/es.po
create mode 100644 sale_order_invoicing_queued/i18n/sale_order_invoicing_queued.pot
create mode 100644 sale_order_invoicing_queued/models/__init__.py
create mode 100644 sale_order_invoicing_queued/models/queue_job.py
create mode 100644 sale_order_invoicing_queued/models/sale_order.py
create mode 100644 sale_order_invoicing_queued/readme/CONFIGURE.rst
create mode 100644 sale_order_invoicing_queued/readme/CONTRIBUTORS.rst
create mode 100644 sale_order_invoicing_queued/readme/DESCRIPTION.rst
create mode 100644 sale_order_invoicing_queued/readme/INSTALL.rst
create mode 100644 sale_order_invoicing_queued/readme/ROADMAP.rst
create mode 100644 sale_order_invoicing_queued/readme/USAGE.rst
create mode 100644 sale_order_invoicing_queued/static/description/icon.png
create mode 100644 sale_order_invoicing_queued/static/description/index.html
create mode 100644 sale_order_invoicing_queued/tests/__init__.py
create mode 100644 sale_order_invoicing_queued/tests/test_sale_order_invoicing_queued.py
create mode 100644 sale_order_invoicing_queued/views/queue_job_views.xml
create mode 100644 sale_order_invoicing_queued/views/sale_order_views.xml
create mode 100644 sale_order_invoicing_queued/wizards/__init__.py
create mode 100644 sale_order_invoicing_queued/wizards/sale_advance_payment_inv.py
create mode 100644 sale_order_invoicing_queued/wizards/sale_advance_payment_inv_views.xml
diff --git a/sale_order_invoicing_queued/README.rst b/sale_order_invoicing_queued/README.rst
new file mode 100644
index 00000000000..163ae275f52
--- /dev/null
+++ b/sale_order_invoicing_queued/README.rst
@@ -0,0 +1,115 @@
+=============================
+Enqueue sales order invoicing
+=============================
+
+.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ !! 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%2Faccount--invoicing-lightgray.png?logo=github
+ :target: https://github.com/OCA/account-invoicing/tree/11.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-11-0/account-invoicing-11-0-sale_order_invoicing_queued
+ :alt: Translate me on Weblate
+.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
+ :target: https://runbot.odoo-community.org/runbot/95/11.0
+ :alt: Try me on Runbot
+
+|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.
+
+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
+=====
+
+#. Go to *Sales > Invoicing > Orders to Invoice*.
+#. Select sales orders whose invoicing you want to enqueue.
+#. Click on *Action > Invoice Order*.
+#. Click on "Enqueue Invoicing" button.
+#. On that moment, jobs will be enqueued on foreground, but the control will
+ be returned to you after that.
+#. 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.
+
+Known issues / Roadmap
+======================
+
+* This module doesn't take into account any possible modification on grouping
+ criteria, like all the modules that use
+ ``sale_order_action_invoice_create_hook``.
+
+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
+~~~~~~~
+
+* 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..f7b2c53b8dc
--- /dev/null
+++ b/sale_order_invoicing_queued/__manifest__.py
@@ -0,0 +1,22 @@
+# Copyright 2019 Tecnativa - Pedro M. Baeza
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+{
+ 'name': 'Enqueue sales order invoicing',
+ 'version': '11.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': [
+ '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/i18n/es.po b/sale_order_invoicing_queued/i18n/es.po
new file mode 100644
index 00000000000..d5e8a4d10af
--- /dev/null
+++ b/sale_order_invoicing_queued/i18n/es.po
@@ -0,0 +1,63 @@
+# 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: 2019-08-29 16:09+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"Language: \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: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: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:ir.ui.view,arch_db:sale_order_invoicing_queued.view_order_form
+msgid "Invoicing Jobs"
+msgstr "Trabajos de facturación"
+
+#. module: sale_order_invoicing_queued
+#: model:ir.model,name:sale_order_invoicing_queued.model_queue_job
+msgid "Queue Job"
+msgstr "Trabajo en cola"
+
+#. module: sale_order_invoicing_queued
+#: model:ir.model,name:sale_order_invoicing_queued.model_sale_order
+msgid "Quotation"
+msgstr "Presupuesto"
+
+#. module: sale_order_invoicing_queued
+#: model: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
+#: code:addons/sale_order_invoicing_queued/wizards/sale_advance_payment_inv.py:26
+#, 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."
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..9f4aa3774bc
--- /dev/null
+++ b/sale_order_invoicing_queued/i18n/sale_order_invoicing_queued.pot
@@ -0,0 +1,57 @@
+# 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"
+"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:ir.ui.view,arch_db:sale_order_invoicing_queued.view_queue_job_sale_order_invoicing
+msgid "Cancel"
+msgstr ""
+
+#. module: sale_order_invoicing_queued
+#: model: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:ir.ui.view,arch_db:sale_order_invoicing_queued.view_order_form
+msgid "Invoicing Jobs"
+msgstr ""
+
+#. module: sale_order_invoicing_queued
+#: model:ir.model,name:sale_order_invoicing_queued.model_queue_job
+msgid "Queue Job"
+msgstr ""
+
+#. module: sale_order_invoicing_queued
+#: model:ir.model,name:sale_order_invoicing_queued.model_sale_order
+msgid "Quotation"
+msgstr ""
+
+#. module: sale_order_invoicing_queued
+#: model: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
+#: code:addons/sale_order_invoicing_queued/wizards/sale_advance_payment_inv.py:26
+#, 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/models/__init__.py b/sale_order_invoicing_queued/models/__init__.py
new file mode 100644
index 00000000000..b53566c317c
--- /dev/null
+++ b/sale_order_invoicing_queued/models/__init__.py
@@ -0,0 +1,4 @@
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from . import queue_job
+from . import sale_order
diff --git a/sale_order_invoicing_queued/models/queue_job.py b/sale_order_invoicing_queued/models/queue_job.py
new file mode 100644
index 00000000000..0a4ad521cb8
--- /dev/null
+++ b/sale_order_invoicing_queued/models/queue_job.py
@@ -0,0 +1,12 @@
+# Copyright 2019 Tecnativa - Pedro M. Baeza
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+
+from odoo import models
+
+
+class QueueJob(models.Model):
+ _inherit = 'queue.job'
+
+ def cancel(self):
+ self.filtered(lambda x: x.state in ['pending', 'enqueued']).unlink()
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..ffdbb3952b4
--- /dev/null
+++ b/sale_order_invoicing_queued/models/sale_order.py
@@ -0,0 +1,31 @@
+# Copyright 2019 Tecnativa - Pedro M. Baeza
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from odoo import fields, models
+
+try: # The try can be removed in v12 as not needed
+ from odoo.addons.queue_job.job import job
+except ImportError:
+ import logging
+ import functools
+
+ logging.getLogger(__name__).debug("Can't `import queue_job`.")
+
+ def job(*argv, **kwargs):
+ return functools.partial
+
+
+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,
+ )
+
+ @job(default_channel='root.sale_order_invoicing_queued')
+ def create_invoices_job(self, final):
+ self.action_invoice_create(final=final)
diff --git a/sale_order_invoicing_queued/readme/CONFIGURE.rst b/sale_order_invoicing_queued/readme/CONFIGURE.rst
new file mode 100644
index 00000000000..6ac44572ec4
--- /dev/null
+++ b/sale_order_invoicing_queued/readme/CONFIGURE.rst
@@ -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.rst b/sale_order_invoicing_queued/readme/CONTRIBUTORS.rst
new file mode 100644
index 00000000000..2b13251bef4
--- /dev/null
+++ b/sale_order_invoicing_queued/readme/CONTRIBUTORS.rst
@@ -0,0 +1,3 @@
+* `Tecnativa `__:
+
+ * Pedro M. Baeza
diff --git a/sale_order_invoicing_queued/readme/DESCRIPTION.rst b/sale_order_invoicing_queued/readme/DESCRIPTION.rst
new file mode 100644
index 00000000000..eb83e648315
--- /dev/null
+++ b/sale_order_invoicing_queued/readme/DESCRIPTION.rst
@@ -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/INSTALL.rst b/sale_order_invoicing_queued/readme/INSTALL.rst
new file mode 100644
index 00000000000..c8d5b2fea2b
--- /dev/null
+++ b/sale_order_invoicing_queued/readme/INSTALL.rst
@@ -0,0 +1,2 @@
+This module depends on *queue_job* module that is hosted on
+https://github.com/OCA/queue.
diff --git a/sale_order_invoicing_queued/readme/ROADMAP.rst b/sale_order_invoicing_queued/readme/ROADMAP.rst
new file mode 100644
index 00000000000..4a8a4171b1c
--- /dev/null
+++ b/sale_order_invoicing_queued/readme/ROADMAP.rst
@@ -0,0 +1,3 @@
+* This module doesn't take into account any possible modification on grouping
+ criteria, like all the modules that use
+ ``sale_order_action_invoice_create_hook``.
diff --git a/sale_order_invoicing_queued/readme/USAGE.rst b/sale_order_invoicing_queued/readme/USAGE.rst
new file mode 100644
index 00000000000..a63cf180fab
--- /dev/null
+++ b/sale_order_invoicing_queued/readme/USAGE.rst
@@ -0,0 +1,9 @@
+#. Go to *Sales > Invoicing > Orders to Invoice*.
+#. Select sales orders whose invoicing you want to enqueue.
+#. Click on *Action > Invoice Order*.
+#. Click on "Enqueue Invoicing" button.
+#. On that moment, jobs will be enqueued on foreground, but the control will
+ be returned to you after that.
+#. 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 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d
GIT binary patch
literal 9455
zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~!
zVpnB`o+K7|Al`Q_U;eD$B
zfJ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|NeV(
z@H_=R8V39rt5J5YB2Ky?4eJJ#b`_iBe2ot~6%7mLt5t8Vwi^Jy7|jWXqa3amOIoRb
zOr}WVFP--DsS`1WpN%~)t3R!arKF^Q$e12KEqU36AWwnCBICpH4XCsfnyrHr>$I$4
z!DpKX$OKLWarN7nv@!uIA+~RNO)l$$w}p(;b>mx8pwYvu;dD_unryX_NhT8*Tj>BTrTTL&!?O+%Rv;b?B??gSzdp?6Uug9{
zd@V08Z$BdI?fpoCS$)t4mg4rT8Q_I}h`0d-vYZ^|dOB*Q^S|xqTV*vIg?@fVFSmMpaw0qtTRbx}
z({Pg?#{2`sc9)M5N$*N|4;^t$+QP?#mov
zGVC@I*lBVrOU-%2y!7%)fAKjpEFsgQc4{amtiHb95KQEwvf<(3T<9-Zm$xIew#P22
zc2Ix|App^>v6(3L_MCU0d3W##AB0M~3D00EWoKZqsJYT(#@w$Y_H7G22M~ApVFTRHMI_3be)Lkn#0F*V8Pq
zc}`Cjy$bE;FJ6H7p=0y#R>`}-m4(0F>%@P|?7fx{=R^uFdISRnZ2W_xQhD{YuR3t<
z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k
z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp
z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{}
zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N
Xviia!U7SGha1wx#SCgwmn*{w2TRX*I
literal 0
HcmV?d00001
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..cbd51f76c8c
--- /dev/null
+++ b/sale_order_invoicing_queued/static/description/index.html
@@ -0,0 +1,464 @@
+
+
+
+
+
+
+Enqueue sales order invoicing
+
+
+
+
+
Enqueue sales order invoicing
+
+
+
+
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.
Select sales orders whose invoicing you want to enqueue.
+
Click on Action > Invoice Order.
+
Click on “Enqueue Invoicing” button.
+
On that moment, jobs will be enqueued on foreground, but the control will
+be returned to you after that.
+
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.
This module doesn’t take into account any possible modification on grouping
+criteria, like all the modules that use
+sale_order_action_invoice_create_hook.
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.
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.
+
+
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..061c805222c
--- /dev/null
+++ b/sale_order_invoicing_queued/tests/test_sale_order_invoicing_queued.py
@@ -0,0 +1,77 @@
+# 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 SavepointCase
+
+
+class TestSaleOrderInvoicingQueue(SavepointCase):
+ @classmethod
+ def setUpClass(cls):
+ super().setUpClass()
+ 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()
+
+ 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
+ )
+ # Remove job
+ self.order.invoicing_job_ids.cancel()
+ self.assertFalse(self.order.invoicing_job_ids.exists())
+ # 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)
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..482d875abb3
--- /dev/null
+++ b/sale_order_invoicing_queued/views/queue_job_views.xml
@@ -0,0 +1,29 @@
+
+
+
+
+ queue.job
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sale_order_invoicing_queued/views/sale_order_views.xml b/sale_order_invoicing_queued/views/sale_order_views.xml
new file mode 100644
index 00000000000..bf59094a781
--- /dev/null
+++ b/sale_order_invoicing_queued/views/sale_order_views.xml
@@ -0,0 +1,22 @@
+
+
+
+
+ sale.order
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sale_order_invoicing_queued/wizards/__init__.py b/sale_order_invoicing_queued/wizards/__init__.py
new file mode 100644
index 00000000000..cf530382783
--- /dev/null
+++ b/sale_order_invoicing_queued/wizards/__init__.py
@@ -0,0 +1,3 @@
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from . import sale_advance_payment_inv
diff --git a/sale_order_invoicing_queued/wizards/sale_advance_payment_inv.py b/sale_order_invoicing_queued/wizards/sale_advance_payment_inv.py
new file mode 100644
index 00000000000..fd956ff159e
--- /dev/null
+++ b/sale_order_invoicing_queued/wizards/sale_advance_payment_inv.py
@@ -0,0 +1,35 @@
+# Copyright 2019 Tecnativa - Pedro M. Baeza
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from odoo import _, exceptions, models
+from collections import defaultdict
+
+
+class SaleAdvancePaymentInv(models.TransientModel):
+ _inherit = "sale.advance.payment.inv"
+
+ def enqueue_invoices(self):
+ queue_obj = self.env['queue.job']
+ order_obj = self.env['sale.order']
+ context = self.env.context
+ final = (self.advance_payment_method == 'all')
+ if (self.advance_payment_method not in {'delivered', 'all'}):
+ # Call standard method in these cases
+ return self.create_invoices()
+ sale_orders = order_obj.browse(context.get('active_ids', []))
+ grouped_orders = defaultdict(lambda: order_obj.browse())
+ for order in sale_orders:
+ group_key = (order.partner_invoice_id.id, order.currency_id.id)
+ if order.invoicing_job_ids.filtered(
+ lambda x: x.state in {'pending', 'enqueued', 'started'}
+ ):
+ raise exceptions.UserError(_(
+ "There's already an enqueued job for invoicing the sales "
+ "order %s. Please wait until it's finished or remove it "
+ "from the selection."
+ ) % (order.name, ))
+ grouped_orders[group_key] |= order
+ for orders in grouped_orders.values():
+ new_delay = orders.sudo().with_delay().create_invoices_job(final)
+ job = queue_obj.search([('uuid', '=', new_delay.uuid)])
+ orders.sudo().write({'invoicing_job_ids': [(4, job.id)]})
diff --git a/sale_order_invoicing_queued/wizards/sale_advance_payment_inv_views.xml b/sale_order_invoicing_queued/wizards/sale_advance_payment_inv_views.xml
new file mode 100644
index 00000000000..d112d77a731
--- /dev/null
+++ b/sale_order_invoicing_queued/wizards/sale_advance_payment_inv_views.xml
@@ -0,0 +1,14 @@
+
+
+
+
+ sale.advance.payment.inv
+
+
+
+
+
+
From 6319b723d5aa8f341396adb8169dfd5b9fb13f1d Mon Sep 17 00:00:00 2001
From: "Pedro M. Baeza"
Date: Mon, 9 Sep 2019 16:35:45 +0200
Subject: [PATCH 02/35] [IMP] *_queued: Remove `cancel` method + use same user
---
sale_order_invoicing_queued/__manifest__.py | 2 +-
sale_order_invoicing_queued/i18n/es.po | 8 +++-----
.../i18n/sale_order_invoicing_queued.pot | 5 -----
sale_order_invoicing_queued/models/__init__.py | 1 -
sale_order_invoicing_queued/models/queue_job.py | 12 ------------
.../tests/test_sale_order_invoicing_queued.py | 3 ---
.../views/queue_job_views.xml | 2 +-
.../wizards/sale_advance_payment_inv.py | 2 +-
8 files changed, 6 insertions(+), 29 deletions(-)
delete mode 100644 sale_order_invoicing_queued/models/queue_job.py
diff --git a/sale_order_invoicing_queued/__manifest__.py b/sale_order_invoicing_queued/__manifest__.py
index f7b2c53b8dc..da71bb86ede 100644
--- a/sale_order_invoicing_queued/__manifest__.py
+++ b/sale_order_invoicing_queued/__manifest__.py
@@ -3,7 +3,7 @@
{
'name': 'Enqueue sales order invoicing',
- 'version': '11.0.1.0.0',
+ 'version': '11.0.1.1.0',
'category': 'Sales Management',
'license': 'AGPL-3',
'author': 'Tecnativa, '
diff --git a/sale_order_invoicing_queued/i18n/es.po b/sale_order_invoicing_queued/i18n/es.po
index d5e8a4d10af..beb943cdf44 100644
--- a/sale_order_invoicing_queued/i18n/es.po
+++ b/sale_order_invoicing_queued/i18n/es.po
@@ -32,11 +32,6 @@ msgstr "Encolar facturación"
msgid "Invoicing Jobs"
msgstr "Trabajos de facturación"
-#. module: sale_order_invoicing_queued
-#: model:ir.model,name:sale_order_invoicing_queued.model_queue_job
-msgid "Queue Job"
-msgstr "Trabajo en cola"
-
#. module: sale_order_invoicing_queued
#: model:ir.model,name:sale_order_invoicing_queued.model_sale_order
msgid "Quotation"
@@ -61,3 +56,6 @@ msgid ""
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 "Queue Job"
+#~ msgstr "Trabajo en cola"
diff --git a/sale_order_invoicing_queued/i18n/sale_order_invoicing_queued.pot b/sale_order_invoicing_queued/i18n/sale_order_invoicing_queued.pot
index 9f4aa3774bc..2213f9b3267 100644
--- a/sale_order_invoicing_queued/i18n/sale_order_invoicing_queued.pot
+++ b/sale_order_invoicing_queued/i18n/sale_order_invoicing_queued.pot
@@ -29,11 +29,6 @@ msgstr ""
msgid "Invoicing Jobs"
msgstr ""
-#. module: sale_order_invoicing_queued
-#: model:ir.model,name:sale_order_invoicing_queued.model_queue_job
-msgid "Queue Job"
-msgstr ""
-
#. module: sale_order_invoicing_queued
#: model:ir.model,name:sale_order_invoicing_queued.model_sale_order
msgid "Quotation"
diff --git a/sale_order_invoicing_queued/models/__init__.py b/sale_order_invoicing_queued/models/__init__.py
index b53566c317c..d1d09e0213d 100644
--- a/sale_order_invoicing_queued/models/__init__.py
+++ b/sale_order_invoicing_queued/models/__init__.py
@@ -1,4 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-from . import queue_job
from . import sale_order
diff --git a/sale_order_invoicing_queued/models/queue_job.py b/sale_order_invoicing_queued/models/queue_job.py
deleted file mode 100644
index 0a4ad521cb8..00000000000
--- a/sale_order_invoicing_queued/models/queue_job.py
+++ /dev/null
@@ -1,12 +0,0 @@
-# Copyright 2019 Tecnativa - Pedro M. Baeza
-# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-
-
-from odoo import models
-
-
-class QueueJob(models.Model):
- _inherit = 'queue.job'
-
- def cancel(self):
- self.filtered(lambda x: x.state in ['pending', 'enqueued']).unlink()
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
index 061c805222c..6d18dfd2f06 100644
--- a/sale_order_invoicing_queued/tests/test_sale_order_invoicing_queued.py
+++ b/sale_order_invoicing_queued/tests/test_sale_order_invoicing_queued.py
@@ -52,9 +52,6 @@ def test_queue_invoicing(self):
self.assertNotEqual(
self.order.invoicing_job_ids, self.order2.invoicing_job_ids
)
- # Remove job
- self.order.invoicing_job_ids.cancel()
- self.assertFalse(self.order.invoicing_job_ids.exists())
# Try to enqueue invoicing again
with self.assertRaises(exceptions.UserError):
wizard.enqueue_invoices()
diff --git a/sale_order_invoicing_queued/views/queue_job_views.xml b/sale_order_invoicing_queued/views/queue_job_views.xml
index 482d875abb3..57fa5a6031f 100644
--- a/sale_order_invoicing_queued/views/queue_job_views.xml
+++ b/sale_order_invoicing_queued/views/queue_job_views.xml
@@ -17,7 +17,7 @@
class="oe_highlight"
attrs="{'invisible': [('state', '!=', 'failed')]}"/>
Date: Mon, 4 Nov 2019 22:13:50 +0100
Subject: [PATCH 03/35] [MIG] sale_order_invoicing_queued: Migration to 12.0
* Standard procedure
* README updated
* Manifest version updated
---
sale_order_invoicing_queued/README.rst | 10 +++++-----
sale_order_invoicing_queued/__manifest__.py | 2 +-
.../static/description/index.html | 6 +++---
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/sale_order_invoicing_queued/README.rst b/sale_order_invoicing_queued/README.rst
index 163ae275f52..c79a97f5b28 100644
--- a/sale_order_invoicing_queued/README.rst
+++ b/sale_order_invoicing_queued/README.rst
@@ -14,13 +14,13 @@ Enqueue sales order invoicing
: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/11.0/sale_order_invoicing_queued
+ :target: https://github.com/OCA/account-invoicing/tree/12.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-11-0/account-invoicing-11-0-sale_order_invoicing_queued
+ :target: https://translation.odoo-community.org/projects/account-invoicing-12-0/account-invoicing-12-0-sale_order_invoicing_queued
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/95/11.0
+ :target: https://runbot.odoo-community.org/runbot/95/12.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -78,7 +78,7 @@ 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 `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -110,6 +110,6 @@ 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.
+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/__manifest__.py b/sale_order_invoicing_queued/__manifest__.py
index da71bb86ede..d06b93053db 100644
--- a/sale_order_invoicing_queued/__manifest__.py
+++ b/sale_order_invoicing_queued/__manifest__.py
@@ -3,7 +3,7 @@
{
'name': 'Enqueue sales order invoicing',
- 'version': '11.0.1.1.0',
+ 'version': '12.0.1.0.0',
'category': 'Sales Management',
'license': 'AGPL-3',
'author': 'Tecnativa, '
diff --git a/sale_order_invoicing_queued/static/description/index.html b/sale_order_invoicing_queued/static/description/index.html
index cbd51f76c8c..2a8d4a0d48a 100644
--- a/sale_order_invoicing_queued/static/description/index.html
+++ b/sale_order_invoicing_queued/static/description/index.html
@@ -367,7 +367,7 @@
Enqueue sales order invoicing
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-
+
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.
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.
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.
From d34b299c61b44b54267ce7c37d01285b6c553042 Mon Sep 17 00:00:00 2001
From: "Pedro M. Baeza"
Date: Tue, 5 Nov 2019 01:06:48 +0100
Subject: [PATCH 04/35] [MIG] sale_order_invoicing_queued: Migration to 13.0
* Standard procedure
* README updated
* Manifest version updated
* Adjusted code to v13
---
sale_order_invoicing_queued/README.rst | 10 +--
sale_order_invoicing_queued/__manifest__.py | 28 ++++----
.../models/sale_order.py | 21 ++----
.../static/description/index.html | 6 +-
.../tests/test_sale_order_invoicing_queued.py | 69 +++++++++----------
.../wizards/sale_advance_payment_inv.py | 32 +++++----
6 files changed, 77 insertions(+), 89 deletions(-)
diff --git a/sale_order_invoicing_queued/README.rst b/sale_order_invoicing_queued/README.rst
index c79a97f5b28..38d49e33f8c 100644
--- a/sale_order_invoicing_queued/README.rst
+++ b/sale_order_invoicing_queued/README.rst
@@ -14,13 +14,13 @@ Enqueue sales order invoicing
: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/12.0/sale_order_invoicing_queued
+ :target: https://github.com/OCA/account-invoicing/tree/13.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-12-0/account-invoicing-12-0-sale_order_invoicing_queued
+ :target: https://translation.odoo-community.org/projects/account-invoicing-13-0/account-invoicing-13-0-sale_order_invoicing_queued
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/95/12.0
+ :target: https://runbot.odoo-community.org/runbot/95/13.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -78,7 +78,7 @@ 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 `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -110,6 +110,6 @@ 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.
+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/__manifest__.py b/sale_order_invoicing_queued/__manifest__.py
index d06b93053db..61f6deec357 100644
--- a/sale_order_invoicing_queued/__manifest__.py
+++ b/sale_order_invoicing_queued/__manifest__.py
@@ -2,21 +2,17 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
- 'name': 'Enqueue sales order invoicing',
- 'version': '12.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',
+ "name": "Enqueue sales order invoicing",
+ "version": "13.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": [
+ "views/queue_job_views.xml",
+ "views/sale_order_views.xml",
+ "wizards/sale_advance_payment_inv_views.xml",
],
- 'data': [
- 'views/queue_job_views.xml',
- 'views/sale_order_views.xml',
- 'wizards/sale_advance_payment_inv_views.xml',
- ],
- 'installable': True,
+ "installable": True,
}
diff --git a/sale_order_invoicing_queued/models/sale_order.py b/sale_order_invoicing_queued/models/sale_order.py
index ffdbb3952b4..4d431453d5b 100644
--- a/sale_order_invoicing_queued/models/sale_order.py
+++ b/sale_order_invoicing_queued/models/sale_order.py
@@ -3,29 +3,20 @@
from odoo import fields, models
-try: # The try can be removed in v12 as not needed
- from odoo.addons.queue_job.job import job
-except ImportError:
- import logging
- import functools
-
- logging.getLogger(__name__).debug("Can't `import queue_job`.")
-
- def job(*argv, **kwargs):
- return functools.partial
+from odoo.addons.queue_job.job import job
class SaleOrder(models.Model):
_inherit = "sale.order"
invoicing_job_ids = fields.Many2many(
- comodel_name='queue.job',
- column1='order_id',
- column2='job_id',
+ comodel_name="queue.job",
+ column1="order_id",
+ column2="job_id",
string="Invoicing Jobs",
copy=False,
)
- @job(default_channel='root.sale_order_invoicing_queued')
+ @job(default_channel="root.sale_order_invoicing_queued")
def create_invoices_job(self, final):
- self.action_invoice_create(final=final)
+ self._create_invoices(final=final)
diff --git a/sale_order_invoicing_queued/static/description/index.html b/sale_order_invoicing_queued/static/description/index.html
index 2a8d4a0d48a..c1976769525 100644
--- a/sale_order_invoicing_queued/static/description/index.html
+++ b/sale_order_invoicing_queued/static/description/index.html
@@ -367,7 +367,7 @@
Enqueue sales order invoicing
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-
+
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.
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.
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 doesn’t take into account any possible modification on grouping
-criteria, like all the modules that use
-sale_order_action_invoice_create_hook.
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
@@ -432,15 +425,15 @@
OCA, or the Odoo Community Association, is a nonprofit organization whose
diff --git a/sale_order_invoicing_queued/wizards/sale_advance_payment_inv.py b/sale_order_invoicing_queued/wizards/sale_advance_payment_inv.py
index a14571fd449..bb985f040c1 100644
--- a/sale_order_invoicing_queued/wizards/sale_advance_payment_inv.py
+++ b/sale_order_invoicing_queued/wizards/sale_advance_payment_inv.py
@@ -1,4 +1,4 @@
-# Copyright 2019 Tecnativa - Pedro M. Baeza
+# Copyright 2019-2020 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from collections import defaultdict
@@ -20,7 +20,10 @@ def enqueue_invoices(self):
sale_orders = order_obj.browse(context.get("active_ids", []))
grouped_orders = defaultdict(lambda: order_obj.browse())
for order in sale_orders:
- group_key = (order.partner_invoice_id.id, order.currency_id.id)
+ group_key = (
+ order[grouping_key]
+ for grouping_key in order._get_invoice_grouping_keys()
+ )
if order.invoicing_job_ids.filtered(
lambda x: x.state in {"pending", "enqueued", "started"}
):
From 49f7499c8eba850b8c289738c108856dc6ef6b3c Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Sun, 8 Mar 2020 17:48:57 +0000
Subject: [PATCH 10/35] sale_order_invoicing_queued 13.0.2.0.0
---
sale_order_invoicing_queued/__manifest__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sale_order_invoicing_queued/__manifest__.py b/sale_order_invoicing_queued/__manifest__.py
index 61f6deec357..ea86a36a874 100644
--- a/sale_order_invoicing_queued/__manifest__.py
+++ b/sale_order_invoicing_queued/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "Enqueue sales order invoicing",
- "version": "13.0.1.0.0",
+ "version": "13.0.2.0.0",
"category": "Sales Management",
"license": "AGPL-3",
"author": "Tecnativa, " "Odoo Community Association (OCA)",
From 810ca003ca5db22100fe4fb04d3599bf43e46614 Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Sat, 14 Mar 2020 11:48:06 +0100
Subject: [PATCH 11/35] pre-commit update
---
.../views/queue_job_views.xml | 37 ++++++++++---------
.../views/sale_order_views.xml | 26 ++++++++-----
.../sale_advance_payment_inv_views.xml | 11 ++++--
3 files changed, 45 insertions(+), 29 deletions(-)
diff --git a/sale_order_invoicing_queued/views/queue_job_views.xml b/sale_order_invoicing_queued/views/queue_job_views.xml
index 57fa5a6031f..1f4c21ec1e3 100644
--- a/sale_order_invoicing_queued/views/queue_job_views.xml
+++ b/sale_order_invoicing_queued/views/queue_job_views.xml
@@ -1,27 +1,30 @@
-
+
queue.job
-
+
-
-
-
-
-
-
+
+
+
+
+
diff --git a/sale_order_invoicing_queued/views/sale_order_views.xml b/sale_order_invoicing_queued/views/sale_order_views.xml
index bf59094a781..b5d5c2295a6 100644
--- a/sale_order_invoicing_queued/views/sale_order_views.xml
+++ b/sale_order_invoicing_queued/views/sale_order_views.xml
@@ -1,19 +1,27 @@
-
+
sale.order
-
-
+
+
-
-
+
diff --git a/sale_order_invoicing_queued/wizards/sale_advance_payment_inv_views.xml b/sale_order_invoicing_queued/wizards/sale_advance_payment_inv_views.xml
index d112d77a731..dee7c70441e 100644
--- a/sale_order_invoicing_queued/wizards/sale_advance_payment_inv_views.xml
+++ b/sale_order_invoicing_queued/wizards/sale_advance_payment_inv_views.xml
@@ -1,13 +1,18 @@
-
+
sale.advance.payment.inv
-
+
-
+
From 754cecdf18451646cec46a9ce8b47e5c65e4e8a4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ana=20Su=C3=A1rez?=
Date: Wed, 10 Mar 2021 09:06:55 +0000
Subject: [PATCH 12/35] Translated using Weblate (Spanish)
Currently translated at 100.0% (7 of 7 strings)
Translation: account-invoicing-13.0/account-invoicing-13.0-sale_order_invoicing_queued
Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-13-0/account-invoicing-13-0-sale_order_invoicing_queued/es/
---
sale_order_invoicing_queued/i18n/es.po | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/sale_order_invoicing_queued/i18n/es.po b/sale_order_invoicing_queued/i18n/es.po
index a8703eb78a4..6159e3b0681 100644
--- a/sale_order_invoicing_queued/i18n/es.po
+++ b/sale_order_invoicing_queued/i18n/es.po
@@ -7,14 +7,15 @@ 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: 2019-08-29 16:09+0000\n"
-"Last-Translator: <>\n"
+"PO-Revision-Date: 2021-03-10 10:46+0000\n"
+"Last-Translator: Ana Suárez \n"
"Language-Team: \n"
-"Language: \n"
+"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
-"Plural-Forms: \n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
+"X-Generator: Weblate 4.3.2\n"
#. module: sale_order_invoicing_queued
#: model_terms:ir.ui.view,arch_db:sale_order_invoicing_queued.view_queue_job_sale_order_invoicing
@@ -45,7 +46,7 @@ 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 ""
+msgstr "Pedido de venta"
#. module: sale_order_invoicing_queued
#: code:addons/sale_order_invoicing_queued/wizards/sale_advance_payment_inv.py:0
From f6467b32cb01e3376fc3e4d9bc52bdd79eb0e1fc Mon Sep 17 00:00:00 2001
From: "Pedro M. Baeza"
Date: Fri, 16 Apr 2021 13:31:01 +0200
Subject: [PATCH 13/35] [FIX] sale_order_invoicing_queued: Proper grouping
criteria + compatibility with OCA module
The previous group key generator was not properly populated.
And also provide compatibility with module
sale_order_invoicing_grouping_criteria module.
---
sale_order_invoicing_queued/__manifest__.py | 2 +-
.../wizards/sale_advance_payment_inv.py | 20 ++++++++++++++-----
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/sale_order_invoicing_queued/__manifest__.py b/sale_order_invoicing_queued/__manifest__.py
index ea86a36a874..a9ad1a7518d 100644
--- a/sale_order_invoicing_queued/__manifest__.py
+++ b/sale_order_invoicing_queued/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "Enqueue sales order invoicing",
- "version": "13.0.2.0.0",
+ "version": "13.0.2.0.1",
"category": "Sales Management",
"license": "AGPL-3",
"author": "Tecnativa, " "Odoo Community Association (OCA)",
diff --git a/sale_order_invoicing_queued/wizards/sale_advance_payment_inv.py b/sale_order_invoicing_queued/wizards/sale_advance_payment_inv.py
index bb985f040c1..059621b01f8 100644
--- a/sale_order_invoicing_queued/wizards/sale_advance_payment_inv.py
+++ b/sale_order_invoicing_queued/wizards/sale_advance_payment_inv.py
@@ -1,4 +1,4 @@
-# Copyright 2019-2020 Tecnativa - Pedro M. Baeza
+# Copyright 2019-2021 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from collections import defaultdict
@@ -20,10 +20,20 @@ def enqueue_invoices(self):
sale_orders = order_obj.browse(context.get("active_ids", []))
grouped_orders = defaultdict(lambda: order_obj.browse())
for order in sale_orders:
- group_key = (
- order[grouping_key]
- for grouping_key in order._get_invoice_grouping_keys()
- )
+ # If we have `sale_order_invoicing_grouping_criteria` module
+ # installed, we take that grouping criteria
+ if hasattr(order, "_get_sale_invoicing_group_key"):
+ group_key = order._get_sale_invoicing_group_key()
+ else:
+ # HACK: This is not exactly doing the same as upstream, as we
+ # apply fields over order, not invoice vals, but serves for
+ # standard case and most of the transferred fields
+ group_key = tuple(
+ [
+ order[grouping_key]
+ for grouping_key in order._get_invoice_grouping_keys()
+ ]
+ )
if order.invoicing_job_ids.filtered(
lambda x: x.state in {"pending", "enqueued", "started"}
):
From 99b6a4eda03ca62567452584e93d54cefaa5ba2c Mon Sep 17 00:00:00 2001
From: "Pedro M. Baeza"
Date: Fri, 16 Apr 2021 19:48:05 +0200
Subject: [PATCH 14/35] [FIX] sale_order_invoicing_queued: Fix mapping fields
Order `partner_invoice_id` fields is transferred to `partner_id`, so
when seeing grouping keys at order level, we need to remap the grouping
key.
---
.../wizards/sale_advance_payment_inv.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/sale_order_invoicing_queued/wizards/sale_advance_payment_inv.py b/sale_order_invoicing_queued/wizards/sale_advance_payment_inv.py
index 059621b01f8..b25bef9ed2c 100644
--- a/sale_order_invoicing_queued/wizards/sale_advance_payment_inv.py
+++ b/sale_order_invoicing_queued/wizards/sale_advance_payment_inv.py
@@ -27,10 +27,13 @@ def enqueue_invoices(self):
else:
# HACK: This is not exactly doing the same as upstream, as we
# apply fields over order, not invoice vals, but serves for
- # standard case and most of the transferred fields
+ # standard case and most of the transferred fields mapping them.
+ # This is done this way for not needing to build 2 times the
+ # same vals dictionary.
+ field_mapping = {"partner_id": "partner_invoice_id"}
group_key = tuple(
[
- order[grouping_key]
+ order[field_mapping.get(grouping_key, grouping_key)]
for grouping_key in order._get_invoice_grouping_keys()
]
)
From 67589839a007cdbef3156743b770fbf7241fcf74 Mon Sep 17 00:00:00 2001
From: iwkse
Date: Mon, 13 Dec 2021 19:04:20 +0100
Subject: [PATCH 15/35] [14.0] MIG sale_order_invoicing_queued
---
sale_order_invoicing_queued/__manifest__.py | 3 ++-
sale_order_invoicing_queued/data/job_queue.xml | 17 +++++++++++++++++
.../models/sale_order.py | 3 ---
3 files changed, 19 insertions(+), 4 deletions(-)
create mode 100644 sale_order_invoicing_queued/data/job_queue.xml
diff --git a/sale_order_invoicing_queued/__manifest__.py b/sale_order_invoicing_queued/__manifest__.py
index a9ad1a7518d..f1c688c86ae 100644
--- a/sale_order_invoicing_queued/__manifest__.py
+++ b/sale_order_invoicing_queued/__manifest__.py
@@ -3,13 +3,14 @@
{
"name": "Enqueue sales order invoicing",
- "version": "13.0.2.0.1",
+ "version": "14.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",
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..3b5a94cdac3
--- /dev/null
+++ b/sale_order_invoicing_queued/data/job_queue.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+ Invoice Job
+
+
+
+
+
+
+ create_invoices_job
+
+
+
+
diff --git a/sale_order_invoicing_queued/models/sale_order.py b/sale_order_invoicing_queued/models/sale_order.py
index 4d431453d5b..a0de0a03988 100644
--- a/sale_order_invoicing_queued/models/sale_order.py
+++ b/sale_order_invoicing_queued/models/sale_order.py
@@ -3,8 +3,6 @@
from odoo import fields, models
-from odoo.addons.queue_job.job import job
-
class SaleOrder(models.Model):
_inherit = "sale.order"
@@ -17,6 +15,5 @@ class SaleOrder(models.Model):
copy=False,
)
- @job(default_channel="root.sale_order_invoicing_queued")
def create_invoices_job(self, final):
self._create_invoices(final=final)
From b2a4bdc2d14e0f619ecff7a1779e5591ba594b55 Mon Sep 17 00:00:00 2001
From: oca-travis
Date: Tue, 14 Dec 2021 13:43:30 +0000
Subject: [PATCH 16/35] [UPD] Update sale_order_invoicing_queued.pot
---
.../i18n/sale_order_invoicing_queued.pot | 20 ++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/sale_order_invoicing_queued/i18n/sale_order_invoicing_queued.pot b/sale_order_invoicing_queued/i18n/sale_order_invoicing_queued.pot
index e1aa36d47bd..ba68394a6c8 100644
--- a/sale_order_invoicing_queued/i18n/sale_order_invoicing_queued.pot
+++ b/sale_order_invoicing_queued/i18n/sale_order_invoicing_queued.pot
@@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 13.0\n"
+"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -18,17 +18,35 @@ msgstr ""
msgid "Cancel"
msgstr ""
+#. module: sale_order_invoicing_queued
+#: model:ir.model.fields,field_description:sale_order_invoicing_queued.field_sale_advance_payment_inv__display_name
+#: model:ir.model.fields,field_description:sale_order_invoicing_queued.field_sale_order__display_name
+msgid "Display Name"
+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_advance_payment_inv__id
+#: model:ir.model.fields,field_description:sale_order_invoicing_queued.field_sale_order__id
+msgid "ID"
+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
msgid "Invoicing Jobs"
msgstr ""
+#. module: sale_order_invoicing_queued
+#: model:ir.model.fields,field_description:sale_order_invoicing_queued.field_sale_advance_payment_inv____last_update
+#: model:ir.model.fields,field_description:sale_order_invoicing_queued.field_sale_order____last_update
+msgid "Last Modified on"
+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"
From 5c041bb5458d9803470bbfd38d925bc421217a6d Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Tue, 14 Dec 2021 13:57:37 +0000
Subject: [PATCH 17/35] [UPD] README.rst
---
sale_order_invoicing_queued/README.rst | 10 +++++-----
.../static/description/index.html | 6 +++---
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/sale_order_invoicing_queued/README.rst b/sale_order_invoicing_queued/README.rst
index 4773f235c44..5c12da1c0a3 100644
--- a/sale_order_invoicing_queued/README.rst
+++ b/sale_order_invoicing_queued/README.rst
@@ -14,13 +14,13 @@ Enqueue sales order invoicing
: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/13.0/sale_order_invoicing_queued
+ :target: https://github.com/OCA/account-invoicing/tree/14.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-13-0/account-invoicing-13-0-sale_order_invoicing_queued
+ :target: https://translation.odoo-community.org/projects/account-invoicing-14-0/account-invoicing-14-0-sale_order_invoicing_queued
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/95/13.0
+ :target: https://runbot.odoo-community.org/runbot/95/14.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -74,7 +74,7 @@ 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 `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -106,6 +106,6 @@ 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.
+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/static/description/index.html b/sale_order_invoicing_queued/static/description/index.html
index 20f98d49851..62e13be80ab 100644
--- a/sale_order_invoicing_queued/static/description/index.html
+++ b/sale_order_invoicing_queued/static/description/index.html
@@ -367,7 +367,7 @@
Enqueue sales order invoicing
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-
+
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.
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.
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.