Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
e17f2bd
Add ddmrp_cron_actions_as_job
Oct 29, 2020
290024f
[UPD] Update ddmrp_cron_actions_as_job.pot
oca-travis Feb 3, 2021
7ab04bd
[UPD] README.rst
OCA-git-bot Feb 3, 2021
f606b99
[ADD] icon.png
OCA-git-bot Feb 3, 2021
af5507d
ddmrp_cron_actions_as_job 13.0.1.1.0
OCA-git-bot Feb 3, 2021
ac23aeb
Add queue.job.function for ddmrp_buffer._calc_adu
Feb 10, 2021
39dcbe4
ddmrp_cron_actions_as_job 13.0.1.2.0
OCA-git-bot Feb 17, 2021
b7e4e5c
[MIG] ddmrp_cron_actions_as_job: Migration to 14.0
DavidBForgeFlow May 27, 2021
0f99663
[UPD] Update ddmrp_cron_actions_as_job.pot
oca-travis Jun 17, 2021
77f92f4
[UPD] README.rst
OCA-git-bot Jun 17, 2021
2d3baa2
Added translation using Weblate (Portuguese (Brazil))
marcelsavegnago Dec 26, 2021
d3cbe77
[MIG] ddmrp_cron_actions_as_job: Migrate to 15.0
JordiBForgeFlow Feb 18, 2022
2743a6f
[FIX] tests
ChrisOForgeFlow Feb 18, 2022
4c19c04
[UPD] Update ddmrp_cron_actions_as_job.pot
Feb 28, 2022
5c72fb8
[UPD] README.rst
OCA-git-bot Feb 28, 2022
3d005a2
[UPD] README.rst
OCA-git-bot Sep 3, 2023
f863c41
Update translation files
weblate Oct 9, 2023
e22bbb7
Added translation using Weblate (Italian)
mymage Oct 26, 2023
a04e110
Translated using Weblate (Italian)
mymage Oct 26, 2023
677f945
Added translation using Weblate (Spanish)
Ivorra78 Feb 28, 2024
f00c890
Translated using Weblate (Spanish)
Ivorra78 Feb 28, 2024
02801ef
[MIG] ddmrp_cron_actions_as_job: Migration to 16.0
LoisRForgeFlow Mar 11, 2024
0c4f2de
[UPD] Update ddmrp_cron_actions_as_job.pot
Mar 11, 2024
ada5497
Translated using Weblate (Portuguese (Brazil))
May 21, 2024
d3162c6
[IMP] ddmrp_cron_actions_as_job: pre-commit stuff
ArnauCForgeFlow Jul 18, 2024
c163494
[MIG] ddmrp_cron_actions_as_job: Migration to 17.0
ArnauCForgeFlow Jul 18, 2024
0143dc1
[UPD] Update ddmrp_cron_actions_as_job.pot
Jul 22, 2024
0745bc7
[BOT] post-merge updates
OCA-git-bot Jul 22, 2024
6cf3f7c
[MIG] ddmrp_cron_actions_as_job: Migration to 18.0
ThiagoMForgeFlow Feb 25, 2025
895c124
[UPD] Update ddmrp_cron_actions_as_job.pot
Mar 10, 2025
2517a7a
[BOT] post-merge updates
OCA-git-bot Mar 10, 2025
c298128
[IMP] ddmrp_cron_actions_as_job: update method signature
LoisRForgeFlow Oct 7, 2025
9aa70b7
[BOT] post-merge updates
OCA-git-bot Oct 8, 2025
fd81a58
[MIG] ddmrp_cron_actions_as_job: Migration to 19.0
dnplkndll Jun 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions ddmrp_cron_actions_as_job/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

===============================
DDMRP Buffer Calculation as job
===============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:c1e4d832046009f380a8793d981bf80dc795a68afa2458b3de1981eb027c257b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/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%2Fddmrp-lightgray.png?logo=github
:target: https://github.com/OCA/ddmrp/tree/19.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-19-0/ddmrp-19-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=19.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:%2019.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 <guewen.baconnier@camptocamp.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.

This module is part of the `OCA/ddmrp <https://github.com/OCA/ddmrp/tree/19.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.
1 change: 1 addition & 0 deletions ddmrp_cron_actions_as_job/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
15 changes: 15 additions & 0 deletions ddmrp_cron_actions_as_job/__manifest__.py
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": "19.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,
}
6 changes: 6 additions & 0 deletions ddmrp_cron_actions_as_job/data/queue_job_channel_data.xml
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 ddmrp_cron_actions_as_job/data/queue_job_function_data.xml
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 ddmrp_cron_actions_as_job/i18n/ddmrp_cron_actions_as_job.pot
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 18.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 ""
27 changes: 27 additions & 0 deletions ddmrp_cron_actions_as_job/i18n/es.po
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 <informatica@totmaterial.es>\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"
27 changes: 27 additions & 0 deletions ddmrp_cron_actions_as_job/i18n/it.po
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 <stefano.consolaro@mymage.it>\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"
28 changes: 28 additions & 0 deletions ddmrp_cron_actions_as_job/i18n/pt_BR.po
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 <sottomaiormacedotec@users.noreply."
"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"
2 changes: 2 additions & 0 deletions ddmrp_cron_actions_as_job/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import stock_buffer
from . import stock_move
49 changes: 49 additions & 0 deletions ddmrp_cron_actions_as_job/models/stock_buffer.py
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).

import functools

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):
for method_name, context_key in (
("cron_actions", "auto_delay_ddmrp_cron_actions"),
("_calc_adu", "auto_delay_ddmrp_calc_adu"),
):
patched = self._patch_job_auto_delay(method_name, context_key=context_key)
setattr(
type(self),
method_name,
functools.update_wrapper(patched, getattr(type(self), method_name)),
)
return super()._register_hook()

def cron_ddmrp(self, automatic=False, domain=None):
return super(
Buffer, self.with_context(auto_delay_ddmrp_cron_actions=True)
).cron_ddmrp(automatic=automatic, domain=domain)

def cron_ddmrp_adu(self, automatic=False, domain=None):
return super(
Buffer, self.with_context(auto_delay_ddmrp_calc_adu=True)
).cron_ddmrp_adu(automatic=automatic, domain=domain)
13 changes: 13 additions & 0 deletions ddmrp_cron_actions_as_job/models/stock_move.py
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()
3 changes: 3 additions & 0 deletions ddmrp_cron_actions_as_job/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
1 change: 1 addition & 0 deletions ddmrp_cron_actions_as_job/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Guewen Baconnier \<<guewen.baconnier@camptocamp.com>\>
14 changes: 14 additions & 0 deletions ddmrp_cron_actions_as_job/readme/DESCRIPTION.md
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.
Loading
Loading