Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
84 changes: 84 additions & 0 deletions ddmrp_warning_as_job/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

====================
DDMRP Warning as job
====================

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

.. |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_warning_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_warning_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 Warning calculations are now run with Queue Jobs.

The ``<stock.buffer>._generate_ddmrp_warnings`` method is automatically
delayed when the context contains
``auto_delay_ddmrp_generate_ddmrp_warnings=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_warning_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
-------

* ForgeFlow

Contributors
------------

David Jiménez david.jimenez@forgeflow.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_warning_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_warning_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_warning_as_job/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2024 ForgeFlow (https://www.camptocamp.com)
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

{
"name": "DDMRP Warning as job",
"version": "19.0.1.0.0",
"summary": "Run DDMRP Warning as jobs",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/ddmrp",
"category": "Warehouse Management",
"depends": ["ddmrp_warning", "ddmrp_cron_actions_as_job"],
"data": ["data/queue_job_function_data.xml"],
"license": "LGPL-3",
"installable": True,
}
10 changes: 10 additions & 0 deletions ddmrp_warning_as_job/data/queue_job_function_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2024 ForgeFlow S.L. (http://www.forgeflow.com)
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0) -->
<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">_generate_ddmrp_warnings</field>
<field name="channel_id" ref="ddmrp_cron_actions_as_job.channel_ddmrp" />
</record>
</odoo>
22 changes: 22 additions & 0 deletions ddmrp_warning_as_job/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * ddmrp_warning_as_job
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-11-11 14:06+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 5.6.2\n"

#. module: ddmrp_warning_as_job
#: model:ir.model,name:ddmrp_warning_as_job.model_stock_buffer
msgid "Stock Buffer"
msgstr "Buffer di materiale"
1 change: 1 addition & 0 deletions ddmrp_warning_as_job/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import stock_buffer
35 changes: 35 additions & 0 deletions ddmrp_warning_as_job/models/stock_buffer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright 2024 ForgeFlow (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 _generate_ddmrp_warnings_job_options(self):
return {
"identity_key": identity_exact,
"priority": 15,
"description": f"DDMRP Warning calculation ({self.display_name})",
}

def _register_hook(self):
patched = self._patch_job_auto_delay(
"_generate_ddmrp_warnings",
context_key="auto_delay_ddmrp_generate_ddmrp_warnings",
)
cls = type(self)
cls._generate_ddmrp_warnings = functools.update_wrapper(
patched, cls._generate_ddmrp_warnings
)
return super()._register_hook()

def cron_generate_ddmrp_warnings(self, automatic=False):
return super(
Buffer, self.with_context(auto_delay_ddmrp_generate_ddmrp_warnings=True)
).cron_generate_ddmrp_warnings(automatic=automatic)
3 changes: 3 additions & 0 deletions ddmrp_warning_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_warning_as_job/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
David Jiménez <david.jimenez@forgeflow.com>
5 changes: 5 additions & 0 deletions ddmrp_warning_as_job/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DDMRP Warning calculations are now run with Queue Jobs.

The `<stock.buffer>._generate_ddmrp_warnings` method is automatically delayed when
the context contains `auto_delay_ddmrp_generate_ddmrp_warnings=True`.

Binary file added ddmrp_warning_as_job/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading