-
-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by LoisRForgeFlow
- Loading branch information
Showing
19 changed files
with
808 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,89 @@ | ||
=============================== | ||
DDMRP Buffer Calculation as job | ||
=============================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:9e8a8dbcb18721e0b5be9ff3418bc0ddd61cc848b94134281a95f90cd2d690ad | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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-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%2Fddmrp-lightgray.png?logo=github | ||
:target: https://github.com/OCA/ddmrp/tree/17.0/ddmrp_cron_actions_as_job | ||
:alt: OCA/ddmrp | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/ddmrp-17-0/ddmrp-17-0-ddmrp_cron_actions_as_job | ||
: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/ddmrp&target_branch=17.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
DDMRP Buffer calculations are now run with Queue Jobs. | ||
|
||
When auto-update of NFP is active, each time the state of a stock move | ||
changes, a new computation is triggered, but thanks to identity keys on | ||
jobs, only one job at a time is generated for the same buffer. | ||
|
||
The ``<stock.buffer>.cron_actions`` method is automatically delayed when | ||
the context contains ``auto_delay_ddmrp_cron_actions=True``. | ||
|
||
The scheduled action for buffers ADU computation also generates jobs | ||
instead of recomputing all the buffers at once. | ||
|
||
The ``<stock.buffer>._calc_adu`` method is automatically delayed when | ||
the context contains ``auto_delay_ddmrp_calc_adu=True``. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/ddmrp/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/ddmrp/issues/new?body=module:%20ddmrp_cron_actions_as_job%0Aversion:%2017.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 | ||
------- | ||
|
||
* Camptocamp | ||
|
||
Contributors | ||
------------ | ||
|
||
- Guewen Baconnier <[email protected]> | ||
|
||
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/ddmrp <https://github.com/OCA/ddmrp/tree/17.0/ddmrp_cron_actions_as_job>`_ 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 @@ | ||
from . import models |
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,15 @@ | ||
# Copyright 2020 Camptocamp (https://www.camptocamp.com) | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). | ||
|
||
{ | ||
"name": "DDMRP Buffer Calculation as job", | ||
"version": "17.0.1.0.0", | ||
"summary": "Run DDMRP Buffer Calculation as jobs", | ||
"author": "Camptocamp, Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/ddmrp", | ||
"category": "Warehouse Management", | ||
"depends": ["ddmrp", "queue_job"], | ||
"data": ["data/queue_job_channel_data.xml", "data/queue_job_function_data.xml"], | ||
"license": "LGPL-3", | ||
"installable": True, | ||
} |
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 @@ | ||
<odoo noupdate="1"> | ||
<record model="queue.job.channel" id="channel_ddmrp"> | ||
<field name="name">ddmrp</field> | ||
<field name="parent_id" ref="queue_job.channel_root" /> | ||
</record> | ||
</odoo> |
12 changes: 12 additions & 0 deletions
12
ddmrp_cron_actions_as_job/data/queue_job_function_data.xml
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 @@ | ||
<odoo noupdate="1"> | ||
<record id="job_function_stock_buffer_cron_actions" model="queue.job.function"> | ||
<field name="model_id" ref="ddmrp.model_stock_buffer" /> | ||
<field name="method">cron_actions</field> | ||
<field name="channel_id" ref="channel_ddmrp" /> | ||
</record> | ||
<record id="job_function_stock_buffer_calc_adu" model="queue.job.function"> | ||
<field name="model_id" ref="ddmrp.model_stock_buffer" /> | ||
<field name="method">_calc_adu</field> | ||
<field name="channel_id" ref="channel_ddmrp" /> | ||
</record> | ||
</odoo> |
24 changes: 24 additions & 0 deletions
24
ddmrp_cron_actions_as_job/i18n/ddmrp_cron_actions_as_job.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,24 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * ddmrp_cron_actions_as_job | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.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: ddmrp_cron_actions_as_job | ||
#: model:ir.model,name:ddmrp_cron_actions_as_job.model_stock_buffer | ||
msgid "Stock Buffer" | ||
msgstr "" | ||
|
||
#. module: ddmrp_cron_actions_as_job | ||
#: model:ir.model,name:ddmrp_cron_actions_as_job.model_stock_move | ||
msgid "Stock Move" | ||
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,27 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * ddmrp_cron_actions_as_job | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 15.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2024-02-28 21:33+0000\n" | ||
"Last-Translator: Ivorra78 <[email protected]>\n" | ||
"Language-Team: none\n" | ||
"Language: es\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: nplurals=2; plural=n != 1;\n" | ||
"X-Generator: Weblate 4.17\n" | ||
|
||
#. module: ddmrp_cron_actions_as_job | ||
#: model:ir.model,name:ddmrp_cron_actions_as_job.model_stock_buffer | ||
msgid "Stock Buffer" | ||
msgstr "Amortiguador de Inventario" | ||
|
||
#. module: ddmrp_cron_actions_as_job | ||
#: model:ir.model,name:ddmrp_cron_actions_as_job.model_stock_move | ||
msgid "Stock Move" | ||
msgstr "Movimiento de Existencias" |
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,27 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * ddmrp_cron_actions_as_job | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 15.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2023-10-28 20:10+0000\n" | ||
"Last-Translator: mymage <[email protected]>\n" | ||
"Language-Team: none\n" | ||
"Language: it\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: nplurals=2; plural=n != 1;\n" | ||
"X-Generator: Weblate 4.17\n" | ||
|
||
#. module: ddmrp_cron_actions_as_job | ||
#: model:ir.model,name:ddmrp_cron_actions_as_job.model_stock_buffer | ||
msgid "Stock Buffer" | ||
msgstr "Buffer di materiale" | ||
|
||
#. module: ddmrp_cron_actions_as_job | ||
#: model:ir.model,name:ddmrp_cron_actions_as_job.model_stock_move | ||
msgid "Stock Move" | ||
msgstr "Movimento di magazzino" |
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,28 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * ddmrp_cron_actions_as_job | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 14.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2024-05-21 03:17+0000\n" | ||
"Last-Translator: Rodrigo Macedo <[email protected]." | ||
"translation.odoo-community.org>\n" | ||
"Language-Team: none\n" | ||
"Language: pt_BR\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: nplurals=2; plural=n > 1;\n" | ||
"X-Generator: Weblate 4.17\n" | ||
|
||
#. module: ddmrp_cron_actions_as_job | ||
#: model:ir.model,name:ddmrp_cron_actions_as_job.model_stock_buffer | ||
msgid "Stock Buffer" | ||
msgstr "Buffer de estoque" | ||
|
||
#. module: ddmrp_cron_actions_as_job | ||
#: model:ir.model,name:ddmrp_cron_actions_as_job.model_stock_move | ||
msgid "Stock Move" | ||
msgstr "Movimento de estoque" |
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 @@ | ||
from . import stock_buffer | ||
from . import stock_move |
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,49 @@ | ||
# Copyright 2020 Camptocamp (https://www.camptocamp.com) | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). | ||
|
||
from odoo import models | ||
|
||
from odoo.addons.queue_job.job import identity_exact | ||
|
||
|
||
class Buffer(models.Model): | ||
_inherit = "stock.buffer" | ||
|
||
def cron_actions_job_options(self, only_nfp=False): | ||
return { | ||
"identity_key": identity_exact, | ||
"priority": 15, | ||
"description": f"DDMRP Buffer calculation ({self.display_name})", | ||
} | ||
|
||
def _calc_adu_job_options(self): | ||
return { | ||
"identity_key": identity_exact, | ||
"priority": 15, | ||
"description": f"DDMRP Buffer ADU calculation ({self.display_name})", | ||
} | ||
|
||
def _register_hook(self): | ||
self._patch_method( | ||
"cron_actions", | ||
self._patch_job_auto_delay( | ||
"cron_actions", context_key="auto_delay_ddmrp_cron_actions" | ||
), | ||
) | ||
self._patch_method( | ||
"_calc_adu", | ||
self._patch_job_auto_delay( | ||
"_calc_adu", context_key="auto_delay_ddmrp_calc_adu" | ||
), | ||
) | ||
return super()._register_hook() | ||
|
||
def cron_ddmrp(self, automatic=False): | ||
return super( | ||
Buffer, self.with_context(auto_delay_ddmrp_cron_actions=True) | ||
).cron_ddmrp(automatic=automatic) | ||
|
||
def cron_ddmrp_adu(self, automatic=False): | ||
return super( | ||
Buffer, self.with_context(auto_delay_ddmrp_calc_adu=True) | ||
).cron_ddmrp_adu(automatic=automatic) |
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 @@ | ||
# Copyright 2020 Camptocamp | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). | ||
|
||
from odoo import models | ||
|
||
|
||
class StockMove(models.Model): | ||
_inherit = "stock.move" | ||
|
||
def _update_ddmrp_nfp(self): | ||
return super( | ||
StockMove, self.with_context(auto_delay_ddmrp_cron_actions=True) | ||
)._update_ddmrp_nfp() |
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 @@ | ||
[build-system] | ||
requires = ["whool"] | ||
build-backend = "whool.buildapi" |
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 @@ | ||
- Guewen Baconnier \<<[email protected]>\> |
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,14 @@ | ||
DDMRP Buffer calculations are now run with Queue Jobs. | ||
|
||
When auto-update of NFP is active, each time the state of a stock move | ||
changes, a new computation is triggered, but thanks to identity keys on | ||
jobs, only one job at a time is generated for the same buffer. | ||
|
||
The `<stock.buffer>.cron_actions` method is automatically delayed when | ||
the context contains `auto_delay_ddmrp_cron_actions=True`. | ||
|
||
The scheduled action for buffers ADU computation also generates jobs | ||
instead of recomputing all the buffers at once. | ||
|
||
The `<stock.buffer>._calc_adu` method is automatically delayed when the | ||
context contains `auto_delay_ddmrp_calc_adu=True`. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.