Skip to content

Commit

Permalink
[ADD] stock_quant_history_queued
Browse files Browse the repository at this point in the history
  • Loading branch information
petrus-v committed Jul 25, 2024
1 parent 1876db6 commit 253880b
Show file tree
Hide file tree
Showing 14 changed files with 689 additions and 0 deletions.
6 changes: 6 additions & 0 deletions setup/stock_quant_history_queued/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
83 changes: 83 additions & 0 deletions stock_quant_history_queued/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
==========================
Stock Quant History Queued
==========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:885b8e66a029724a63248ef3cb53e1e5f6906fefd773e4ea69a203f2af5d8e46
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Fstock--logistics--reporting-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-reporting/tree/14.0/stock_quant_history_queued
:alt: OCA/stock-logistics-reporting
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-reporting-14-0/stock-logistics-reporting-14-0-stock_quant_history_queued
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-reporting&target_branch=14.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module use queue job to regenerate stock.quant.history
asynchronously.

This add the *In Progress* state on stock history snapshot and
delegate the generation to a queue job process.

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-reporting/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <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**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Pierre Verkest <pierreverkest84@gmail.com>

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.

.. |maintainer-petrus-v| image:: https://github.com/petrus-v.png?size=40px
:target: https://github.com/petrus-v
:alt: petrus-v

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-petrus-v|

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.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions stock_quant_history_queued/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
16 changes: 16 additions & 0 deletions stock_quant_history_queued/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2024 Foodles (https://www.foodles.co/).
# @author Pierre Verkest <pierreverkest84@gmail.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Stock Quant History Queued",
"summary": "Use Queue jop to generate stock quants snapshots",
"version": "14.0.1.0.0",
"license": "AGPL-3",
"author": "Pierre Verkest <pierreverkest84@gmail.com>, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-reporting",
"depends": ["stock_quant_history", "queue_job"],
"maintainers": [
"petrus-v",
],
"data": [],
}
47 changes: 47 additions & 0 deletions stock_quant_history_queued/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_quant_history_queued
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0+e\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: stock_quant_history_queued
#: model:ir.model.fields,field_description:stock_quant_history_queued.field_stock_quant_history_snapshot__display_name
msgid "Display Name"
msgstr "Libellé"

#. module: stock_quant_history_queued
#: model:ir.model.fields,field_description:stock_quant_history_queued.field_stock_quant_history_snapshot__id
msgid "ID"
msgstr ""

#. module: stock_quant_history_queued
#: model:ir.model.fields.selection,name:stock_quant_history_queued.selection__stock_quant_history_snapshot__state__queued
msgid "In progress"
msgstr "En cours"

#. module: stock_quant_history_queued
#: model:ir.model.fields,field_description:stock_quant_history_queued.field_stock_quant_history_snapshot____last_update
msgid "Last Modified on"
msgstr "Dernière modification le"

#. module: stock_quant_history_queued
#: model:ir.model.fields,field_description:stock_quant_history_queued.field_stock_quant_history_snapshot__state
msgid "Status"
msgstr "État"

#. module: stock_quant_history_queued
#: model:ir.model,name:stock_quant_history_queued.model_stock_quant_history_snapshot
msgid "stock.quant.history generation configuration model"
msgstr ""
"Cliché de stock: Modèle de configuration pour la génération des ligne de "
"stock.quant.history"

44 changes: 44 additions & 0 deletions stock_quant_history_queued/i18n/stock_quant_history_queued.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_quant_history_queued
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0+e\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: stock_quant_history_queued
#: model:ir.model.fields,field_description:stock_quant_history_queued.field_stock_quant_history_snapshot__display_name
msgid "Display Name"
msgstr ""

#. module: stock_quant_history_queued
#: model:ir.model.fields,field_description:stock_quant_history_queued.field_stock_quant_history_snapshot__id
msgid "ID"
msgstr ""

#. module: stock_quant_history_queued
#: model:ir.model.fields.selection,name:stock_quant_history_queued.selection__stock_quant_history_snapshot__state__queued
msgid "In progress"
msgstr ""

#. module: stock_quant_history_queued
#: model:ir.model.fields,field_description:stock_quant_history_queued.field_stock_quant_history_snapshot____last_update
msgid "Last Modified on"
msgstr ""

#. module: stock_quant_history_queued
#: model:ir.model.fields,field_description:stock_quant_history_queued.field_stock_quant_history_snapshot__state
msgid "Status"
msgstr ""

#. module: stock_quant_history_queued
#: model:ir.model,name:stock_quant_history_queued.model_stock_quant_history_snapshot
msgid "stock.quant.history generation configuration model"
msgstr ""
1 change: 1 addition & 0 deletions stock_quant_history_queued/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import stock_quant_history_snapshot
22 changes: 22 additions & 0 deletions stock_quant_history_queued/models/stock_quant_history_snapshot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2024 Foodles (https://www.foodles.co/).
# @author Pierre Verkest <pierreverkest84@gmail.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import fields, models


class StockQuantHistorySnapshot(models.Model):
_inherit = "stock.quant.history.snapshot"
state = fields.Selection(
selection_add=[("queued", "In progress"), ("generated",)],
ondelete={"queued": "set default"},
)

def action_generate_stock_quant_history(self):
self._setup_queue_jobs_generate_stock_quant_history()

def _setup_queue_jobs_generate_stock_quant_history(self):
for snapshot in self:
snapshot.state = "queued"
snapshot.with_delay(
priority=snapshot.inventory_date.timestamp()
)._generate_stock_quant_history()
1 change: 1 addition & 0 deletions stock_quant_history_queued/readme/CONSTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Pierre Verkest <pierreverkest84@gmail.com>
5 changes: 5 additions & 0 deletions stock_quant_history_queued/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This module use queue job to regenerate stock.quant.history
asynchronously.

This add the *In Progress* state on stock history snapshot and
delegate the generation to a queue job process.
Loading

0 comments on commit 253880b

Please sign in to comment.