Skip to content

Commit

Permalink
Merge pull request #1398 from OCA/17.0
Browse files Browse the repository at this point in the history
Syncing from upstream OCA/stock-logistics-workflow (17.0)
  • Loading branch information
bt-admin authored Feb 4, 2025
2 parents dff864b + 09b8d50 commit ff0cdb4
Show file tree
Hide file tree
Showing 19 changed files with 931 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ addon | version | maintainers | summary
[stock_picking_warn_message](stock_picking_warn_message/) | 17.0.1.0.0 | | Add a popup warning on picking to ensure warning is populated
[stock_quant_package_dimension](stock_quant_package_dimension/) | 17.0.1.0.0 | | Use dimensions on packages
[stock_quant_package_product_packaging](stock_quant_package_product_packaging/) | 17.0.1.0.0 | | Use product packagings on packages
[stock_restrict_by_planned_consumed_date](stock_restrict_by_planned_consumed_date/) | 17.0.1.0.0 | | Stock restrict by planned consumed date
[stock_restrict_lot](stock_restrict_lot/) | 17.0.1.2.1 | [![florian-dacosta](https://github.com/florian-dacosta.png?size=30px)](https://github.com/florian-dacosta) | Base module that add back the concept of restrict lot on stock move
[stock_scrap_tier_validation](stock_scrap_tier_validation/) | 17.0.1.0.0 | | Stock Scrap Tier Validation
[stock_scrap_tier_validation_mrp](stock_scrap_tier_validation_mrp/) | 17.0.1.0.0 | | Stock Scrap Tier Validation: MRP compatibility
Expand Down
3 changes: 2 additions & 1 deletion setup/_metapackage/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "odoo-addons-oca-stock-logistics-workflow"
version = "17.0.20250131.0"
version = "17.0.20250203.0"
dependencies = [
"odoo-addon-delivery_procurement_group_carrier>=17.0dev,<17.1dev",
"odoo-addon-purchase_stock_picking_invoice_link>=17.0dev,<17.1dev",
Expand Down Expand Up @@ -34,6 +34,7 @@ dependencies = [
"odoo-addon-stock_picking_warn_message>=17.0dev,<17.1dev",
"odoo-addon-stock_quant_package_dimension>=17.0dev,<17.1dev",
"odoo-addon-stock_quant_package_product_packaging>=17.0dev,<17.1dev",
"odoo-addon-stock_restrict_by_planned_consumed_date>=17.0dev,<17.1dev",
"odoo-addon-stock_restrict_lot>=17.0dev,<17.1dev",
"odoo-addon-stock_scrap_tier_validation>=17.0dev,<17.1dev",
"odoo-addon-stock_scrap_tier_validation_mrp>=17.0dev,<17.1dev",
Expand Down
93 changes: 93 additions & 0 deletions stock_restrict_by_planned_consumed_date/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
=======================================
Stock restrict by planned consumed date
=======================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:ddb2b1b04f0cc16444ea12364eebb897a2da0d529a3b7a555808aac61fbd119c
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-workflow/tree/17.0/stock_restrict_by_planned_consumed_date
:alt: OCA/stock-logistics-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-workflow-17-0/stock-logistics-workflow-17-0-stock_restrict_by_planned_consumed_date
: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-workflow&target_branch=17.0
:alt: Try me on Runboat

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

This module avoids to reserve goods having an expiration time prior to
the customer's planned consumed date.

.. note::

This module du not change the fefo strategy implementation and won't
optimized reservations. First order still reserve the first Expired
goods even the expected consumed date is later.

**Table of contents**

.. contents::
:local:

Known issues / Roadmap
======================

- Today we restrict the reservation based on the lot expiration date,
but in some circumstances we probably want something configurable to
base the restriction on use_date (best before).
- Find a nice way to be compliant with both modules product_expiry and
product_expiry_simple. This would require to launch unittest twice
with both modules.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-workflow/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-workflow/issues/new?body=module:%20stock_restrict_by_planned_consumed_date%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
-------

* Pierre Verkest <[email protected]>

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

- Pierre Verkest <[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/stock-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/17.0/stock_restrict_by_planned_consumed_date>`_ 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_restrict_by_planned_consumed_date/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
21 changes: 21 additions & 0 deletions stock_restrict_by_planned_consumed_date/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2024-2025 Foodles (https://www.foodles.co)
# @author Pierre Verkest <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Stock restrict by planned consumed date",
"Summary": """
Do not reserved stock if expiration time is before planned consumed date.
""",
"version": "17.0.1.0.0",
"development_status": "Beta",
"author": "Pierre Verkest <[email protected]>, "
"Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-workflow",
"category": "Warehouse Management",
"depends": [
"stock_move_planned_consumed_date",
"product_expiry",
],
"installable": True,
"license": "AGPL-3",
}
25 changes: 25 additions & 0 deletions stock_restrict_by_planned_consumed_date/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_restrict_by_planned_consumed_date
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0+e\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: stock_restrict_by_planned_consumed_date
#: model:ir.model,name:stock_restrict_by_planned_consumed_date.model_stock_quant
msgid "Quants"
msgstr "Quants"

#. module: stock_restrict_by_planned_consumed_date
#: model:ir.model,name:stock_restrict_by_planned_consumed_date.model_stock_move
msgid "Stock Move"
msgstr "Mouvement de stock"
27 changes: 27 additions & 0 deletions stock_restrict_by_planned_consumed_date/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:
# * stock_restrict_by_planned_consumed_date
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2025-02-03 22:06+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 5.6.2\n"

#. module: stock_restrict_by_planned_consumed_date
#: model:ir.model,name:stock_restrict_by_planned_consumed_date.model_stock_quant
msgid "Quants"
msgstr "Quanti"

#. module: stock_restrict_by_planned_consumed_date
#: model:ir.model,name:stock_restrict_by_planned_consumed_date.model_stock_move
msgid "Stock Move"
msgstr "Movimento di magazzino"
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:
# * stock_restrict_by_planned_consumed_date
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.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: stock_restrict_by_planned_consumed_date
#: model:ir.model,name:stock_restrict_by_planned_consumed_date.model_stock_quant
msgid "Quants"
msgstr ""

#. module: stock_restrict_by_planned_consumed_date
#: model:ir.model,name:stock_restrict_by_planned_consumed_date.model_stock_move
msgid "Stock Move"
msgstr ""
2 changes: 2 additions & 0 deletions stock_restrict_by_planned_consumed_date/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import stock_move
from . import stock_quant
25 changes: 25 additions & 0 deletions stock_restrict_by_planned_consumed_date/models/stock_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2024-2025 Foodles (https://www.foodles.co)
# @author Pierre Verkest <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models


class StockMove(models.Model):
_inherit = "stock.move"

def _get_available_quantity(self, *args, **kwargs):
self.ensure_one()
return super(
StockMove,
self.with_context(
restrict_planned_consumed_date=self.planned_consumed_date,
),
)._get_available_quantity(*args, **kwargs)

def _update_reserved_quantity(self, *args, **kwargs):
return super(
StockMove,
self.with_context(
restrict_planned_consumed_date=self.planned_consumed_date,
),
)._update_reserved_quantity(*args, **kwargs)
20 changes: 20 additions & 0 deletions stock_restrict_by_planned_consumed_date/models/stock_quant.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2024-2025 Foodles (https://www.foodles.co)
# @author Pierre Verkest <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, models


class StockQuant(models.Model):
_inherit = "stock.quant"

@api.model
def _gather(self, *args, **kwargs):
quants = super()._gather(*args, **kwargs)
planned_consumed_date = self.env.context.get("restrict_planned_consumed_date")
if planned_consumed_date:
quants = quants.filtered(
lambda quant,
planned=planned_consumed_date: not quant.lot_id.expiration_date
or quant.lot_id.expiration_date >= planned
)
return quants
3 changes: 3 additions & 0 deletions stock_restrict_by_planned_consumed_date/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Pierre Verkest \<[email protected]\>
7 changes: 7 additions & 0 deletions stock_restrict_by_planned_consumed_date/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This module avoids to reserve goods having an expiration time prior to
the customer's planned consumed date.

> [!NOTE]
> This module du not change the fefo strategy implementation and won't
> optimized reservations. First order still reserve the first Expired
> goods even the expected consumed date is later.
6 changes: 6 additions & 0 deletions stock_restrict_by_planned_consumed_date/readme/ROADMAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- Today we restrict the reservation based on the lot expiration date,
but in some circumstances we probably want something configurable to
base the restriction on use_date (best before).
- Find a nice way to be compliant with both modules product_expiry and
product_expiry_simple. This would require to launch unittest twice
with both modules.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit ff0cdb4

Please sign in to comment.