Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][ADD] stock_move_planned_consumed_date: base module to avoid mixing #1724

Open
wants to merge 1 commit into
base: 14.0
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions setup/stock_move_planned_consumed_date/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
82 changes: 82 additions & 0 deletions stock_move_planned_consumed_date/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
================================
Stock Move planned consumed date
================================

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

.. |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/14.0/stock_move_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-14-0/stock-logistics-workflow-14-0-stock_move_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=14.0
:alt: Try me on Runboat

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

This module avoid to merge stock.move with different planned consumed date.

This module by itself won't set the value on stock.move, you have to alter the way
procurement are created to inject the expected consumed date base on your requirements.

This is useful when you have big or multiple warehouse and you want to apply business
reservation rule based on this planned consumed date such as short DLC.

**Table of contents**

.. contents::
:local:

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_move_planned_consumed_date%0Aversion:%2014.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/14.0/stock_move_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_move_planned_consumed_date/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
18 changes: 18 additions & 0 deletions stock_move_planned_consumed_date/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2024 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 Move planned consumed date",
"Summary": "Do not merge stock move with different planned consumed date.",
"version": "14.0.0.1.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"],
"installable": True,
"license": "AGPL-3",
"data": [
"views/stock_picking_views.xml",
],
}
54 changes: 54 additions & 0 deletions stock_move_planned_consumed_date/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_move_planned_consumed_date
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0+e\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: stock_move_planned_consumed_date
#: model:ir.model.fields,field_description:stock_move_planned_consumed_date.field_stock_move__display_name
#: model:ir.model.fields,field_description:stock_move_planned_consumed_date.field_stock_rule__display_name
msgid "Display Name"
msgstr "Libellé"

#. module: stock_move_planned_consumed_date
#: model:ir.model.fields,field_description:stock_move_planned_consumed_date.field_stock_move__id
#: model:ir.model.fields,field_description:stock_move_planned_consumed_date.field_stock_rule__id
msgid "ID"
msgstr ""

#. module: stock_move_planned_consumed_date
#: model:ir.model.fields,field_description:stock_move_planned_consumed_date.field_stock_move____last_update
#: model:ir.model.fields,field_description:stock_move_planned_consumed_date.field_stock_rule____last_update
msgid "Last Modified on"
msgstr "Dernière modification le"

#. module: stock_move_planned_consumed_date
#: model:ir.model.fields,field_description:stock_move_planned_consumed_date.field_stock_move__planned_consumed_date
msgid "Planned consumed date"
msgstr "Date de consomation"

#. module: stock_move_planned_consumed_date
#: model:ir.model,name:stock_move_planned_consumed_date.model_stock_move
msgid "Stock Move"
msgstr "Mouvement de stock"

#. module: stock_move_planned_consumed_date
#: model:ir.model,name:stock_move_planned_consumed_date.model_stock_rule
msgid "Stock Rule"
msgstr "Règle d’approvisionnement"

#. module: stock_move_planned_consumed_date
#: model:ir.model.fields,help:stock_move_planned_consumed_date.field_stock_move__planned_consumed_date
msgid ""
"This is the expected consumed/usage date of the product by the customer."
msgstr "Date d'utilisation/consomation prévu par le client."
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_move_planned_consumed_date
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.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_move_planned_consumed_date
#: model:ir.model.fields,field_description:stock_move_planned_consumed_date.field_stock_move__display_name
#: model:ir.model.fields,field_description:stock_move_planned_consumed_date.field_stock_rule__display_name
msgid "Display Name"
msgstr ""

#. module: stock_move_planned_consumed_date
#: model:ir.model.fields,field_description:stock_move_planned_consumed_date.field_stock_move__id
#: model:ir.model.fields,field_description:stock_move_planned_consumed_date.field_stock_rule__id
msgid "ID"
msgstr ""

#. module: stock_move_planned_consumed_date
#: model:ir.model.fields,field_description:stock_move_planned_consumed_date.field_stock_move____last_update
#: model:ir.model.fields,field_description:stock_move_planned_consumed_date.field_stock_rule____last_update
msgid "Last Modified on"
msgstr ""

#. module: stock_move_planned_consumed_date
#: model:ir.model.fields,field_description:stock_move_planned_consumed_date.field_stock_move__planned_consumed_date
msgid "Planned consumed date"
msgstr ""

#. module: stock_move_planned_consumed_date
#: model:ir.model,name:stock_move_planned_consumed_date.model_stock_move
msgid "Stock Move"
msgstr ""

#. module: stock_move_planned_consumed_date
#: model:ir.model,name:stock_move_planned_consumed_date.model_stock_rule
msgid "Stock Rule"
msgstr ""

#. module: stock_move_planned_consumed_date
#: model:ir.model.fields,help:stock_move_planned_consumed_date.field_stock_move__planned_consumed_date
msgid ""
"This is the expected consumed/usage date of the product by the customer."
msgstr ""
2 changes: 2 additions & 0 deletions stock_move_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_rule
28 changes: 28 additions & 0 deletions stock_move_planned_consumed_date/models/stock_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2024 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, fields, models


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

planned_consumed_date = fields.Datetime(
"Planned consumed date",
readonly=True,
states={"draft": [("readonly", False)]},
help="This is the expected consumed/usage date of the product by the customer.",
)

def _prepare_procurement_values(self):
return {
**super()._prepare_procurement_values(),
"planned_consumed_date": self.planned_consumed_date,
}

@api.model
def _prepare_merge_moves_distinct_fields(self):
return [
*super()._prepare_merge_moves_distinct_fields(),
"planned_consumed_date",
]
11 changes: 11 additions & 0 deletions stock_move_planned_consumed_date/models/stock_rule.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright 2024 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 StockRule(models.Model):
_inherit = "stock.rule"

def _get_custom_move_fields(self):
return [*super()._get_custom_move_fields(), "planned_consumed_date"]
1 change: 1 addition & 0 deletions stock_move_planned_consumed_date/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Pierre Verkest <[email protected]>
7 changes: 7 additions & 0 deletions stock_move_planned_consumed_date/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This module avoid to merge stock movements with different planned consumed date.

This module by itself won't set the value on stock movement, you have to alter the way
procurement are created to inject the expected consumed date base on your requirements.

This is useful when you have big or multiple warehouses and you want to apply business
reservation rule based on this planned consumed date such as short expiration date.
Loading
Loading