-
-
Notifications
You must be signed in to change notification settings - Fork 671
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 rousseldenis
- Loading branch information
Showing
15 changed files
with
898 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,93 @@ | ||
======================================= | ||
Stock restrict by planned consumed date | ||
======================================= | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:08e5b2cea02a2335790db10b740185e03d294fcc607346a94048d12ba5472939 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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. |
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,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", | ||
} |
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,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" |
24 changes: 24 additions & 0 deletions
24
stock_restrict_by_planned_consumed_date/i18n/stock_restrict_by_planned_consumed_date.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: | ||
# * 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" | ||
"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 "" |
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_move | ||
from . import stock_quant |
25 changes: 25 additions & 0 deletions
25
stock_restrict_by_planned_consumed_date/models/stock_move.py
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,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
20
stock_restrict_by_planned_consumed_date/models/stock_quant.py
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,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 |
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 @@ | ||
- Pierre Verkest \<[email protected]\> |
7 changes: 7 additions & 0 deletions
7
stock_restrict_by_planned_consumed_date/readme/DESCRIPTION.md
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,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. |
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 @@ | ||
- 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. |
Oops, something went wrong.