Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] account_invoice_validation_queued: Enqueue account invoice vali…
…dation This module allows to enqueue in several jobs the account validation process to be executed in paralell on background, that's it's normally done serially and on foreground. Each invoice creates a job for performing the validation, but you will only be able to enqueue invoices for the same date. 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 *Invoicing > Sales > Documents > Customer Invoices* or *Invoicing > Purchases > Documents > Vendor Bills*. * Mark at least one check on the left part of one draft invoice line in the list view. * Click on *Action > Confirm Draft Invoice*. * On the dialog popup that appears, click on "Enqueue Validation". * If any of the selected invoices are not in draft state, you will receive an error. * If any of the invoices is already enqueued, there will be a message saying so and avoiding to perform the process. * Once enqueued, and having the "Job Queue Manager" permission, you can go to the invoice, and see the tab "Validation Jobs". A list with all the jobs related to that invoice can be found there. Known issues / Roadmap ====================== * Allow to enqueue for validating invoices of different date. * There's a chance that if you perform several enqueues of invoice validations from different dates, the order of the validated invoices, and thus, the number given for it, will result disordered.
- Loading branch information
1 parent
1734813
commit c68c4ae
Showing
23 changed files
with
1,037 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
================================== | ||
Enqueue account invoice validation | ||
================================== | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! 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/account_invoice_validation_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-account_invoice_validation_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 account validation process | ||
to be executed in paralell on background, that's it's normally done | ||
serially and on foreground. | ||
|
||
Each invoice creates a job for performing the validation, but you will only be | ||
able to enqueue invoices for the same date. | ||
|
||
**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.account_invoice_validation_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 *Invoicing > Sales > Documents > Customer Invoices* or | ||
*Invoicing > Purchases > Documents > Vendor Bills*. | ||
#. Mark at least one check on the left part of one draft invoice line in the | ||
list view. | ||
#. Click on *Action > Confirm Draft Invoice*. | ||
#. On the dialog popup that appears, click on "Enqueue Validation". | ||
#. If any of the selected invoices are not in draft state, you will receive | ||
an error. | ||
#. If any of the invoices is already enqueued, there will be a message saying | ||
so and avoiding to perform the process. | ||
#. Once enqueued, and having the "Job Queue Manager" permission, you can go to | ||
the invoice, and see the tab "Validation Jobs". A list with all the jobs | ||
related to that invoice can be found there. | ||
|
||
Known issues / Roadmap | ||
====================== | ||
|
||
* Allow to enqueue for validating invoices of different date. | ||
* There's a chance that if you perform several enqueues of invoice validations | ||
from different dates, the order of the validated invoices, and thus, the | ||
number given for it, will result disordered. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-invoicing/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 <https://github.com/OCA/account-invoicing/issues/new?body=module:%20account_invoice_validation_queued%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
~~~~~~~ | ||
|
||
* Tecnativa | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* `Tecnativa <https://www.tecnativa.com>`__: | ||
|
||
* 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 <https://github.com/OCA/account-invoicing/tree/11.0/account_invoice_validation_queued>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import models | ||
from . import wizards |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright 2019 Tecnativa - Pedro M. Baeza | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
'name': 'Enqueue account invoice validation', | ||
'version': '11.0.1.0.0', | ||
'category': 'Accounting', | ||
'license': 'AGPL-3', | ||
'author': 'Tecnativa, ' | ||
'Odoo Community Association (OCA)', | ||
'website': 'https://github.com/OCA/account-invoicing', | ||
'depends': [ | ||
'account', | ||
'queue_job', | ||
], | ||
'data': [ | ||
'views/queue_job_views.xml', | ||
'views/account_invoice_views.xml', | ||
'wizards/account_invoice_confirm_views.xml', | ||
], | ||
'installable': True, | ||
} |
71 changes: 71 additions & 0 deletions
71
account_invoice_validation_queued/i18n/account_invoice_validation_queued.pot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * account_invoice_validation_queued | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 11.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2019-08-29 23:11+0000\n" | ||
"PO-Revision-Date: 2019-08-29 23:11+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_validation_queued | ||
#: model:ir.ui.view,arch_db:account_invoice_validation_queued.view_queue_job_account_invoice_validation | ||
msgid "Cancel" | ||
msgstr "" | ||
|
||
#. module: account_invoice_validation_queued | ||
#: model:ir.model,name:account_invoice_validation_queued.model_account_invoice_confirm | ||
msgid "Confirm the selected invoices" | ||
msgstr "" | ||
|
||
#. module: account_invoice_validation_queued | ||
#: model:ir.ui.view,arch_db:account_invoice_validation_queued.account_invoice_confirm_view | ||
msgid "Enqueue Validation" | ||
msgstr "" | ||
|
||
#. module: account_invoice_validation_queued | ||
#: model:ir.model,name:account_invoice_validation_queued.model_account_invoice | ||
msgid "Invoice" | ||
msgstr "" | ||
|
||
#. module: account_invoice_validation_queued | ||
#: model:ir.model,name:account_invoice_validation_queued.model_queue_job | ||
msgid "Queue Job" | ||
msgstr "" | ||
|
||
#. module: account_invoice_validation_queued | ||
#: model:ir.model,name:account_invoice_validation_queued.model_sale_order | ||
msgid "Quotation" | ||
msgstr "" | ||
|
||
#. module: account_invoice_validation_queued | ||
#: model:ir.ui.view,arch_db:account_invoice_validation_queued.view_queue_job_account_invoice_validation | ||
msgid "Requeue" | ||
msgstr "" | ||
|
||
#. module: account_invoice_validation_queued | ||
#: code:addons/account_invoice_validation_queued/wizards/account_invoice_confirm.py:28 | ||
#, python-format | ||
msgid "There's already an enqueued job for validating the invoice #%s. Please wait until it's finished or remove it from the selection." | ||
msgstr "" | ||
|
||
#. module: account_invoice_validation_queued | ||
#: model:ir.model.fields,field_description:account_invoice_validation_queued.field_account_invoice_validation_job_ids | ||
#: model:ir.ui.view,arch_db:account_invoice_validation_queued.invoice_form | ||
#: model:ir.ui.view,arch_db:account_invoice_validation_queued.invoice_supplier_form | ||
msgid "Validation Jobs" | ||
msgstr "" | ||
|
||
#. module: account_invoice_validation_queued | ||
#: code:addons/account_invoice_validation_queued/wizards/account_invoice_confirm.py:21 | ||
#, python-format | ||
msgid "You can't enqueue invoices with different dates." | ||
msgstr "" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * account_invoice_validation_queued | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 11.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2019-08-29 23:11+0000\n" | ||
"PO-Revision-Date: 2019-08-29 23:11+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_validation_queued | ||
#: model:ir.ui.view,arch_db:account_invoice_validation_queued.view_queue_job_account_invoice_validation | ||
msgid "Cancel" | ||
msgstr "Cancelar" | ||
|
||
#. module: account_invoice_validation_queued | ||
#: model:ir.model,name:account_invoice_validation_queued.model_account_invoice_confirm | ||
msgid "Confirm the selected invoices" | ||
msgstr "Confirmar las facturas seleccionadas" | ||
|
||
#. module: account_invoice_validation_queued | ||
#: model:ir.ui.view,arch_db:account_invoice_validation_queued.account_invoice_confirm_view | ||
msgid "Enqueue Validation" | ||
msgstr "Encolar validación" | ||
|
||
#. module: account_invoice_validation_queued | ||
#: model:ir.model,name:account_invoice_validation_queued.model_account_invoice | ||
msgid "Invoice" | ||
msgstr "Factura" | ||
|
||
#. module: account_invoice_validation_queued | ||
#: model:ir.model,name:account_invoice_validation_queued.model_queue_job | ||
msgid "Queue Job" | ||
msgstr "Trabajo en cola" | ||
|
||
#. module: account_invoice_validation_queued | ||
#: model:ir.model,name:account_invoice_validation_queued.model_sale_order | ||
msgid "Quotation" | ||
msgstr "Presupuesto" | ||
|
||
#. module: account_invoice_validation_queued | ||
#: model:ir.ui.view,arch_db:account_invoice_validation_queued.view_queue_job_account_invoice_validation | ||
msgid "Requeue" | ||
msgstr "Volver a poner en cola" | ||
|
||
#. module: account_invoice_validation_queued | ||
#: code:addons/account_invoice_validation_queued/wizards/account_invoice_confirm.py:28 | ||
#, python-format | ||
msgid "There's already an enqueued job for validating the invoice #%s. Please wait until it's finished or remove it from the selection." | ||
msgstr "Ya hay un trabajo encolado para validar la factura #%s. Por favor espere hasta que haya finalizado o elimine la factura de la selección." | ||
|
||
#. module: account_invoice_validation_queued | ||
#: model:ir.model.fields,field_description:account_invoice_validation_queued.field_account_invoice_validation_job_ids | ||
#: model:ir.ui.view,arch_db:account_invoice_validation_queued.invoice_form | ||
#: model:ir.ui.view,arch_db:account_invoice_validation_queued.invoice_supplier_form | ||
msgid "Validation Jobs" | ||
msgstr "Trabajos de validación" | ||
|
||
#. module: account_invoice_validation_queued | ||
#: code:addons/account_invoice_validation_queued/wizards/account_invoice_confirm.py:21 | ||
#, python-format | ||
msgid "You can't enqueue invoices with different dates." | ||
msgstr "No puede encolar facturas de diferentes fechas." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import account_invoice | ||
from . import queue_job |
31 changes: 31 additions & 0 deletions
31
account_invoice_validation_queued/models/account_invoice.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/except statements can be removed on v12 | ||
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 AccountInvoice(models.Model): | ||
_inherit = "account.invoice" | ||
|
||
validation_job_ids = fields.Many2many( | ||
comodel_name='queue.job', | ||
column1='invoice_id', | ||
column2='job_id', | ||
string="Validation Jobs", | ||
copy=False, | ||
) | ||
|
||
@job(default_channel='root.account_invoice_validation_queued') | ||
def action_invoice_open_job(self): | ||
self.action_invoice_open() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Jobs are enqueued in the channel ``root.account_invoice_validation_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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* `Tecnativa <https://www.tecnativa.com>`__: | ||
|
||
* Pedro M. Baeza |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
This module allows to enqueue in several jobs the account validation process | ||
to be executed in paralell on background, that's it's normally done | ||
serially and on foreground. | ||
|
||
Each invoice creates a job for performing the validation, but you will only be | ||
able to enqueue invoices for the same date. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
This module depends on *queue_job* module that is hosted on | ||
https://github.com/OCA/queue. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
* Allow to enqueue for validating invoices of different date. | ||
* There's a chance that if you perform several enqueues of invoice validations | ||
from different dates, the order of the validated invoices, and thus, the | ||
number given for it, will result disordered. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#. Go to *Invoicing > Sales > Documents > Customer Invoices* or | ||
*Invoicing > Purchases > Documents > Vendor Bills*. | ||
#. Mark at least one check on the left part of one draft invoice line in the | ||
list view. | ||
#. Click on *Action > Confirm Draft Invoice*. | ||
#. On the dialog popup that appears, click on "Enqueue Validation". | ||
#. If any of the selected invoices are not in draft state, you will receive | ||
an error. | ||
#. If any of the invoices is already enqueued, there will be a message saying | ||
so and avoiding to perform the process. | ||
#. Once enqueued, and having the "Job Queue Manager" permission, you can go to | ||
the invoice, and see the tab "Validation Jobs". A list with all the jobs | ||
related to that invoice can be found there. |
Oops, something went wrong.