Maintainers
+Maintainers
This module is maintained by the OCA.
@@ -982,5 +987,6 @@ diff --git a/.copier-answers.yml b/.copier-answers.yml
index 9541407637..2efeeb29a8 100644
--- a/.copier-answers.yml
+++ b/.copier-answers.yml
@@ -1,5 +1,5 @@
# Do NOT update manually; changes here will be overwritten by Copier
-_commit: v1.29
+_commit: v1.38
_src_path: gh:oca/oca-addons-repo-template
ci: GitHub
convert_readme_fragments_to_markdown: false
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000000..e0d56685a9
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+test-requirements.txt merge=union
diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml
index ccf084dfeb..5a9ff98562 100644
--- a/.github/workflows/pre-commit.yml
+++ b/.github/workflows/pre-commit.yml
@@ -17,6 +17,7 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.11"
+ cache: 'pip'
- name: Get python version
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v4
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index e691905c08..0d09519116 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -63,6 +63,13 @@ jobs:
run: oca_init_test_database
- name: Run tests
run: oca_run_tests
+ - name: Upload screenshots from JS tests
+ uses: actions/upload-artifact@v4
+ if: ${{ failure() }}
+ with:
+ name: Screenshots of failed JS tests - ${{ matrix.name }}${{ join(matrix.include) }}
+ path: /tmp/odoo_tests/${{ env.PGDATABASE }}
+ if-no-files-found: ignore
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 188aa68080..96819ef20d 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -41,7 +41,7 @@ repos:
language: fail
files: '[a-zA-Z0-9_]*/i18n/en\.po$'
- repo: https://github.com/oca/maintainer-tools
- rev: d5fab7ee87fceee858a3d01048c78a548974d935
+ rev: f9b919b9868143135a9c9cb03021089cabba8223
hooks:
# update the NOT INSTALLABLE ADDONS section above
- id: oca-update-pre-commit-excluded-addons
@@ -106,6 +106,7 @@ repos:
additional_dependencies:
- "eslint@v7.32.0"
- "eslint-plugin-jsdoc@"
+ - "globals@"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
@@ -142,7 +143,7 @@ repos:
- --settings=.
exclude: /__init__\.py$
- repo: https://github.com/acsone/setuptools-odoo
- rev: 3.1.8
+ rev: 3.3.2
hooks:
- id: setuptools-odoo-make-default
- id: setuptools-odoo-get-requirements
diff --git a/.pylintrc b/.pylintrc
index 449108e9b7..672060146d 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -25,19 +25,25 @@ disable=all
enable=anomalous-backslash-in-string,
api-one-deprecated,
api-one-multi-together,
- assignment-from-none,
- attribute-deprecated,
class-camelcase,
- dangerous-default-value,
dangerous-view-replace-wo-priority,
- development-status-allowed,
duplicate-id-csv,
- duplicate-key,
duplicate-xml-fields,
duplicate-xml-record-id,
eval-referenced,
- eval-used,
incoherent-interpreter-exec-perm,
+ openerp-exception-warning,
+ redundant-modulename-xml,
+ relative-import,
+ rst-syntax-error,
+ wrong-tabs-instead-of-spaces,
+ xml-syntax-error,
+ assignment-from-none,
+ attribute-deprecated,
+ dangerous-default-value,
+ development-status-allowed,
+ duplicate-key,
+ eval-used,
license-allowed,
manifest-author-string,
manifest-deprecated-key,
@@ -48,72 +54,67 @@ enable=anomalous-backslash-in-string,
method-inverse,
method-required-super,
method-search,
- openerp-exception-warning,
pointless-statement,
pointless-string-statement,
print-used,
redundant-keyword-arg,
- redundant-modulename-xml,
reimported,
- relative-import,
return-in-init,
- rst-syntax-error,
sql-injection,
too-few-format-args,
translation-field,
translation-required,
unreachable,
use-vim-comment,
- wrong-tabs-instead-of-spaces,
- xml-syntax-error,
- attribute-string-redundant,
character-not-valid-in-resource-link,
- consider-merging-classes-inherited,
- context-overridden,
create-user-wo-reset-password,
dangerous-filter-wo-user,
dangerous-qweb-replace-wo-priority,
deprecated-data-xml-node,
deprecated-openerp-xml-node,
duplicate-po-message-definition,
- except-pass,
file-not-used,
+ missing-newline-extrafiles,
+ old-api7-method-defined,
+ po-msgstr-variables,
+ po-syntax-error,
+ str-format-used,
+ unnecessary-utf8-coding-comment,
+ xml-attribute-translatable,
+ xml-deprecated-qweb-directive,
+ xml-deprecated-tree-attribute,
+ attribute-string-redundant,
+ consider-merging-classes-inherited,
+ context-overridden,
+ except-pass,
invalid-commit,
manifest-maintainers-list,
- missing-newline-extrafiles,
missing-readme,
missing-return,
odoo-addons-relative-import,
- old-api7-method-defined,
- po-msgstr-variables,
- po-syntax-error,
renamed-field-parameter,
resource-not-exist,
- str-format-used,
test-folder-imported,
translation-contains-variable,
translation-positional-used,
- unnecessary-utf8-coding-comment,
website-manifest-key-not-valid-uri,
- xml-attribute-translatable,
- xml-deprecated-qweb-directive,
- xml-deprecated-tree-attribute,
- # messages that do not cause the lint step to fail
- consider-merging-classes-inherited,
+ missing-manifest-dependency,
+ too-complex,,
create-user-wo-reset-password,
dangerous-filter-wo-user,
- deprecated-module,
file-not-used,
- invalid-commit,
- missing-manifest-dependency,
missing-newline-extrafiles,
- missing-readme,
no-utf8-coding-comment,
- odoo-addons-relative-import,
old-api7-method-defined,
+ unnecessary-utf8-coding-comment,
+ # messages that do not cause the lint step to fail
+ consider-merging-classes-inherited,
+ deprecated-module,
+ invalid-commit,
+ missing-readme,
+ odoo-addons-relative-import,
redefined-builtin,
- too-complex,
- unnecessary-utf8-coding-comment
+ manifest-external-assets
[REPORTS]
diff --git a/.pylintrc-mandatory b/.pylintrc-mandatory
index 164c82fd7d..f0c568c64a 100644
--- a/.pylintrc-mandatory
+++ b/.pylintrc-mandatory
@@ -17,19 +17,25 @@ disable=all
enable=anomalous-backslash-in-string,
api-one-deprecated,
api-one-multi-together,
- assignment-from-none,
- attribute-deprecated,
class-camelcase,
- dangerous-default-value,
dangerous-view-replace-wo-priority,
- development-status-allowed,
duplicate-id-csv,
- duplicate-key,
duplicate-xml-fields,
duplicate-xml-record-id,
eval-referenced,
- eval-used,
incoherent-interpreter-exec-perm,
+ openerp-exception-warning,
+ redundant-modulename-xml,
+ relative-import,
+ rst-syntax-error,
+ wrong-tabs-instead-of-spaces,
+ xml-syntax-error,
+ assignment-from-none,
+ attribute-deprecated,
+ dangerous-default-value,
+ development-status-allowed,
+ duplicate-key,
+ eval-used,
license-allowed,
manifest-author-string,
manifest-deprecated-key,
@@ -40,56 +46,50 @@ enable=anomalous-backslash-in-string,
method-inverse,
method-required-super,
method-search,
- openerp-exception-warning,
pointless-statement,
pointless-string-statement,
print-used,
redundant-keyword-arg,
- redundant-modulename-xml,
reimported,
- relative-import,
return-in-init,
- rst-syntax-error,
sql-injection,
too-few-format-args,
translation-field,
translation-required,
unreachable,
use-vim-comment,
- wrong-tabs-instead-of-spaces,
- xml-syntax-error,
- attribute-string-redundant,
character-not-valid-in-resource-link,
- consider-merging-classes-inherited,
- context-overridden,
create-user-wo-reset-password,
dangerous-filter-wo-user,
dangerous-qweb-replace-wo-priority,
deprecated-data-xml-node,
deprecated-openerp-xml-node,
duplicate-po-message-definition,
- except-pass,
file-not-used,
+ missing-newline-extrafiles,
+ old-api7-method-defined,
+ po-msgstr-variables,
+ po-syntax-error,
+ str-format-used,
+ unnecessary-utf8-coding-comment,
+ xml-attribute-translatable,
+ xml-deprecated-qweb-directive,
+ xml-deprecated-tree-attribute,
+ attribute-string-redundant,
+ consider-merging-classes-inherited,
+ context-overridden,
+ except-pass,
invalid-commit,
manifest-maintainers-list,
- missing-newline-extrafiles,
missing-readme,
missing-return,
odoo-addons-relative-import,
- old-api7-method-defined,
- po-msgstr-variables,
- po-syntax-error,
renamed-field-parameter,
resource-not-exist,
- str-format-used,
test-folder-imported,
translation-contains-variable,
translation-positional-used,
- unnecessary-utf8-coding-comment,
- website-manifest-key-not-valid-uri,
- xml-attribute-translatable,
- xml-deprecated-qweb-directive,
- xml-deprecated-tree-attribute
+ website-manifest-key-not-valid-uri
[REPORTS]
msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}
diff --git a/README.md b/README.md
index abad5f79c9..a12fe5a62a 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,7 @@
+[](https://odoo-community.org/get-involved?utm_source=repo-readme)
+
+# Queue Job
[](https://runboat.odoo-community.org/builds?repo=OCA/queue&target_branch=15.0)
[](https://github.com/OCA/queue/actions/workflows/pre-commit.yml?query=branch%3A15.0)
[](https://github.com/OCA/queue/actions/workflows/test.yml?query=branch%3A15.0)
@@ -7,8 +10,6 @@
-# Odoo Queue Job
-
Asynchronous Job Queue. Delay Model methods in asynchronous jobs, executed in the background as soon as possible or on a schedule. Support Channels to segregates jobs in different queues with different capacities. Unlike scheduled tasks, a job captures arguments for later processing.
@@ -22,7 +23,7 @@ Available addons
addon | version | maintainers | summary
--- | --- | --- | ---
[base_export_async](base_export_async/) | 15.0.1.0.1 | | Asynchronous export with job queue
-[queue_job](queue_job/) | 15.0.2.3.12 |
| Job Queue
+[queue_job](queue_job/) | 15.0.2.3.13 |
| Job Queue
[queue_job_cron](queue_job_cron/) | 15.0.1.0.0 | | Scheduled Actions as Queue Jobs
[queue_job_cron_jobrunner](queue_job_cron_jobrunner/) | 15.0.2.0.0 |
| Run jobs without a dedicated JobRunner
[queue_job_subscribe](queue_job_subscribe/) | 15.0.1.0.0 | | Control which users are subscribed to queue job notifications
diff --git a/queue_job/README.rst b/queue_job/README.rst
index a22f8ad8bb..701c555d5f 100644
--- a/queue_job/README.rst
+++ b/queue_job/README.rst
@@ -1,3 +1,7 @@
+.. image:: https://odoo-community.org/readme-banner-image
+ :target: https://odoo-community.org/get-involved?utm_source=readme
+ :alt: Odoo Community Association
+
=========
Job Queue
=========
@@ -7,13 +11,13 @@ Job Queue
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- !! source digest: sha256:273ee23baedfd996e4827a938bd5cd55a7d38f711b36e180dbd35ec55167b94b
+ !! source digest: sha256:ed7fd7063b32513ff7af35e930e1e6d71d5f4c731e62dbdf49f1ba490e22c7d3
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png
:target: https://odoo-community.org/page/development-status
:alt: Mature
-.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
+.. |badge2| image:: https://img.shields.io/badge/license-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fqueue-lightgray.png?logo=github
diff --git a/queue_job/__manifest__.py b/queue_job/__manifest__.py
index 43850ac203..ce9b31bbb7 100644
--- a/queue_job/__manifest__.py
+++ b/queue_job/__manifest__.py
@@ -2,7 +2,7 @@
{
"name": "Job Queue",
- "version": "15.0.2.3.12",
+ "version": "15.0.2.3.13",
"author": "Camptocamp,ACSONE SA/NV,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/queue",
"license": "LGPL-3",
diff --git a/queue_job/static/description/index.html b/queue_job/static/description/index.html
index bcd8f0580b..e8cee824a4 100644
--- a/queue_job/static/description/index.html
+++ b/queue_job/static/description/index.html
@@ -3,7 +3,7 @@
This addon adds an integrated Job Queue to Odoo.
It allows to postpone method calls executed asynchronously.
Jobs are executed in the background by a Jobrunner, in their own transaction.
Example:
-from odoo import models, fields, api +from odoo import models, fields, api -class MyModel(models.Model): +class MyModel(models.Model): _name = 'my.model' - def my_method(self, a, k=None): + def my_method(self, a, k=None): _logger.info('executed with a: %s and k: %s', a, k) -class MyOtherModel(models.Model): +class MyOtherModel(models.Model): _name = 'my.other.model' - def button_do_stuff(self): + def button_do_stuff(self): self.env['my.model'].with_delay().my_method('a', k=2)
In the snippet of code above, when we call button_do_stuff, a job capturing
@@ -441,11 +446,11 @@ Job Queue
To use this module, you need to:
The fast way to enqueue a job for a method is to use with_delay() on a record or model:
-def button_done(self): +def button_done(self): self.with_delay().print_confirmation_document(self.state) self.write({"state": "done"}) return True @@ -537,7 +542,7 @@Delaying jobs
on a record or model. The following is the equivalent of with_delay() but using the long form:-def button_done(self): +def button_done(self): delayable = self.delayable() delayable.print_confirmation_document(self.state) delayable.delay() @@ -547,7 +552,7 @@Delaying jobs
Methods of Delayable objects return itself, so it can be used as a builder pattern, which in some cases allow to build the jobs dynamically:
-def button_generate_simple_with_delayable(self): +def button_generate_simple_with_delayable(self): self.ensure_one() # Introduction of a delayable object, using a builder pattern # allowing to chain jobs or set properties. The delay() method @@ -563,7 +568,7 @@Delaying jobs
The simplest way to define a dependency is to use .on_done(job) on a Delayable:
-def button_chain_done(self): +def button_chain_done(self): self.ensure_one() job1 = self.browse(1).delayable().generate_thumbnail((50, 50)) job2 = self.browse(1).delayable().generate_thumbnail((50, 50)) @@ -580,9 +585,9 @@Delaying jobs
[B] of jobs. When and only when all the jobs of the group [A] are executed, the jobs of the group [B] are executed. The code would look like:-from odoo.addons.queue_job.delay import group, chain +from odoo.addons.queue_job.delay import group, chain -def button_done(self): +def button_done(self): group_a = group(self.delayable().method_foo(), self.delayable().method_bar()) group_b = group(self.delayable().method_baz(1), self.delayable().method_baz(2)) chain(group_a, group_b).delay() @@ -601,7 +606,7 @@Delaying jobs
would never be delayed (but a warning would be shown).
In earlier versions, jobs could be configured using the @job decorator. This is now obsolete, they can be configured using optional queue.job.function and queue.job.channel XML records.
@@ -674,10 +679,10 @@Example of related action code:
-class QueueJob(models.Model): +class QueueJob(models.Model): _inherit = 'queue.job' - def related_action_partner(self, name): + def related_action_partner(self, name): self.ensure_one() model = self.model_name partner = self.records @@ -719,12 +724,12 @@Configure default options for job be customized in Base._job_prepare_context_before_enqueue_keys.
Example:
-class Base(models.AbstractModel): +class Base(models.AbstractModel): _inherit = "base" @api.model - def _job_prepare_context_before_enqueue_keys(self): + def _job_prepare_context_before_enqueue_keys(self): """Keys to keep in context of stored jobs Empty by default for backward compatibility. @@ -742,7 +747,7 @@Configure default options for job
Tip: you can do this at test case level like this
@classmethod -def setUpClass(cls): +def setUpClass(cls): super().setUpClass() cls.env = cls.env(context=dict( cls.env.context, @@ -753,7 +758,7 @@Configure default options for job without delaying any jobs.
Asserting enqueued jobs
The recommended way to test jobs, rather than running them directly and synchronously is to split the tests in two parts:
@@ -782,20 +787,20 @@A very small example (more details in tests/common.py):
# code -def my_job_method(self, name, count): +def my_job_method(self, name, count): self.write({"name": " ".join([name] * count) -def method_to_test(self): +def method_to_test(self): count = self.env["other.model"].search_count([]) self.with_delay(priority=15).my_job_method("Hi!", count=count) return count # tests -from odoo.addons.queue_job.tests.common import trap_jobs +from odoo.addons.queue_job.tests.common import trap_jobs # first test only check the expected behavior of the method and the proper # enqueuing of jobs -def test_method_to_test(self): +def test_method_to_test(self): with trap_jobs() as trap: result = self.env["model"].method_to_test() expected_count = 12 @@ -811,7 +816,7 @@Testing
# second test to validate the behavior of the job unitarily - def test_my_job_method(self): + def test_my_job_method(self): record = self.env["model"].browse(1) record.my_job_method("Hi!", count=12) self.assertEqual(record.name, "Hi! Hi! Hi! Hi! Hi! Hi! Hi! Hi! Hi! Hi! Hi! Hi!") @@ -819,7 +824,7 @@Testing
If you prefer, you can still test the whole thing in a single test, by calling jobs_tester.perform_enqueued_jobs() in your test.
-def test_method_to_test(self): +def test_method_to_test(self): with trap_jobs() as trap: result = self.env["model"].method_to_test() expected_count = 12 @@ -854,7 +859,7 @@Testing
Tip: you can do this at test case level like this
@classmethod -def setUpClass(cls): +def setUpClass(cls): super().setUpClass() cls.env = cls.env(context=dict( cls.env.context, @@ -873,14 +878,14 @@Testing
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 @@ -941,16 +946,16 @@
Do not contact contributors directly about support or help with technical issues.