Skip to content

Commit ef0af34

Browse files
committed
[ADD] stock_quant_history_queued
1 parent 14bea85 commit ef0af34

15 files changed

+691
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../stock_quant_history_queued
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import setuptools
2+
3+
setuptools.setup(
4+
setup_requires=['setuptools-odoo'],
5+
odoo_addon=True,
6+
)

stock_quant_history_queued/README.rst

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
==========================
2+
Stock Quant History Queued
3+
==========================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:885b8e66a029724a63248ef3cb53e1e5f6906fefd773e4ea69a203f2af5d8e46
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--reporting-lightgray.png?logo=github
20+
:target: https://github.com/OCA/stock-logistics-reporting/tree/14.0/stock_quant_history_queued
21+
:alt: OCA/stock-logistics-reporting
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/stock-logistics-reporting-14-0/stock-logistics-reporting-14-0-stock_quant_history_queued
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-reporting&target_branch=14.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module use queue job to regenerate stock.quant.history
32+
asynchronously.
33+
34+
This add the *In Progress* state on stock history snapshot and
35+
delegate the generation to a queue job process.
36+
37+
**Table of contents**
38+
39+
.. contents::
40+
:local:
41+
42+
Bug Tracker
43+
===========
44+
45+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-reporting/issues>`_.
46+
In case of trouble, please check there if your issue has already been reported.
47+
If you spotted it first, help us to smash it by providing a detailed and welcomed
48+
`feedback <https://github.com/OCA/stock-logistics-reporting/issues/new?body=module:%20stock_quant_history_queued%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
49+
50+
Do not contact contributors directly about support or help with technical issues.
51+
52+
Credits
53+
=======
54+
55+
Authors
56+
~~~~~~~
57+
58+
* Pierre Verkest <pierreverkest84@gmail.com>
59+
60+
Maintainers
61+
~~~~~~~~~~~
62+
63+
This module is maintained by the OCA.
64+
65+
.. image:: https://odoo-community.org/logo.png
66+
:alt: Odoo Community Association
67+
:target: https://odoo-community.org
68+
69+
OCA, or the Odoo Community Association, is a nonprofit organization whose
70+
mission is to support the collaborative development of Odoo features and
71+
promote its widespread use.
72+
73+
.. |maintainer-petrus-v| image:: https://github.com/petrus-v.png?size=40px
74+
:target: https://github.com/petrus-v
75+
:alt: petrus-v
76+
77+
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
78+
79+
|maintainer-petrus-v|
80+
81+
This module is part of the `OCA/stock-logistics-reporting <https://github.com/OCA/stock-logistics-reporting/tree/14.0/stock_quant_history_queued>`_ project on GitHub.
82+
83+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright 2024 Foodles (https://www.foodles.co/).
2+
# @author Pierre Verkest <pierreverkest84@gmail.com>
3+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
4+
{
5+
"name": "Stock Quant History Queued",
6+
"summary": "Use Queue jop to generate stock quants snapshots",
7+
"version": "14.0.1.0.0",
8+
"license": "AGPL-3",
9+
"author": "Pierre Verkest <pierreverkest84@gmail.com>, Odoo Community Association (OCA)",
10+
"website": "https://github.com/OCA/stock-logistics-reporting",
11+
"depends": ["stock_quant_history", "queue_job"],
12+
"maintainers": [
13+
"petrus-v",
14+
],
15+
"data": [],
16+
}

stock_quant_history_queued/i18n/fr.po

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * stock_quant_history_queued
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 14.0+e\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"Last-Translator: \n"
10+
"Language-Team: \n"
11+
"MIME-Version: 1.0\n"
12+
"Content-Type: text/plain; charset=UTF-8\n"
13+
"Content-Transfer-Encoding: \n"
14+
"Plural-Forms: \n"
15+
16+
#. module: stock_quant_history_queued
17+
#: model:ir.model.fields,field_description:stock_quant_history_queued.field_stock_quant_history_snapshot__display_name
18+
msgid "Display Name"
19+
msgstr "Libellé"
20+
21+
#. module: stock_quant_history_queued
22+
#: model:ir.model.fields,field_description:stock_quant_history_queued.field_stock_quant_history_snapshot__id
23+
msgid "ID"
24+
msgstr ""
25+
26+
#. module: stock_quant_history_queued
27+
#: model:ir.model.fields.selection,name:stock_quant_history_queued.selection__stock_quant_history_snapshot__state__queued
28+
msgid "In progress"
29+
msgstr "En cours"
30+
31+
#. module: stock_quant_history_queued
32+
#: model:ir.model.fields,field_description:stock_quant_history_queued.field_stock_quant_history_snapshot____last_update
33+
msgid "Last Modified on"
34+
msgstr "Dernière modification le"
35+
36+
#. module: stock_quant_history_queued
37+
#: model:ir.model.fields,field_description:stock_quant_history_queued.field_stock_quant_history_snapshot__state
38+
msgid "Status"
39+
msgstr "État"
40+
41+
#. module: stock_quant_history_queued
42+
#: model:ir.model,name:stock_quant_history_queued.model_stock_quant_history_snapshot
43+
msgid "stock.quant.history generation configuration model"
44+
msgstr ""
45+
"Cliché de stock: Modèle de configuration pour la génération des ligne de "
46+
"stock.quant.history"
47+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * stock_quant_history_queued
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 14.0+e\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"Last-Translator: \n"
10+
"Language-Team: \n"
11+
"MIME-Version: 1.0\n"
12+
"Content-Type: text/plain; charset=UTF-8\n"
13+
"Content-Transfer-Encoding: \n"
14+
"Plural-Forms: \n"
15+
16+
#. module: stock_quant_history_queued
17+
#: model:ir.model.fields,field_description:stock_quant_history_queued.field_stock_quant_history_snapshot__display_name
18+
msgid "Display Name"
19+
msgstr ""
20+
21+
#. module: stock_quant_history_queued
22+
#: model:ir.model.fields,field_description:stock_quant_history_queued.field_stock_quant_history_snapshot__id
23+
msgid "ID"
24+
msgstr ""
25+
26+
#. module: stock_quant_history_queued
27+
#: model:ir.model.fields.selection,name:stock_quant_history_queued.selection__stock_quant_history_snapshot__state__queued
28+
msgid "In progress"
29+
msgstr ""
30+
31+
#. module: stock_quant_history_queued
32+
#: model:ir.model.fields,field_description:stock_quant_history_queued.field_stock_quant_history_snapshot____last_update
33+
msgid "Last Modified on"
34+
msgstr ""
35+
36+
#. module: stock_quant_history_queued
37+
#: model:ir.model.fields,field_description:stock_quant_history_queued.field_stock_quant_history_snapshot__state
38+
msgid "Status"
39+
msgstr ""
40+
41+
#. module: stock_quant_history_queued
42+
#: model:ir.model,name:stock_quant_history_queued.model_stock_quant_history_snapshot
43+
msgid "stock.quant.history generation configuration model"
44+
msgstr ""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import stock_quant_history_snapshot
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright 2024 Foodles (https://www.foodles.co/).
2+
# @author Pierre Verkest <pierreverkest84@gmail.com>
3+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
4+
from odoo import fields, models
5+
6+
7+
class StockQuantHistorySnapshot(models.Model):
8+
_inherit = "stock.quant.history.snapshot"
9+
state = fields.Selection(
10+
selection_add=[("queued", "In progress"), ("generated",)],
11+
ondelete={"queued": "set default"},
12+
)
13+
14+
def action_generate_stock_quant_history(self):
15+
self._setup_queue_jobs_generate_stock_quant_history()
16+
17+
def _setup_queue_jobs_generate_stock_quant_history(self):
18+
for snapshot in self:
19+
snapshot.state = "queued"
20+
snapshot.with_delay(
21+
priority=snapshot.inventory_date.timestamp()
22+
)._generate_stock_quant_history()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* Pierre Verkest <pierreverkest84@gmail.com>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
This module use queue job to regenerate stock.quant.history
2+
asynchronously.
3+
4+
This add the *In Progress* state on stock history snapshot and
5+
delegate the generation to a queue job process.

0 commit comments

Comments
 (0)