-
-
Notifications
You must be signed in to change notification settings - Fork 661
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 LoisRForgeFlow
- Loading branch information
Showing
16 changed files
with
838 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,77 @@ | ||
===================== | ||
Stock Move Forced Lot | ||
===================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:f6be023d57c0f8ac5b806c7806fb1e187ef2a91f4c7db43ce8f37e95f72dcc61 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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-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%2Fstock--logistics--workflow-lightgray.png?logo=github | ||
:target: https://github.com/OCA/stock-logistics-workflow/tree/17.0/stock_move_forced_lot | ||
: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_move_forced_lot | ||
: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 allows you to set a lot_id in a procurement to force the | ||
stock move generated to only reserve the selected lot. | ||
|
||
**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_forced_lot%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 | ||
------- | ||
|
||
* 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/stock-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/17.0/stock_move_forced_lot>`_ 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,15 @@ | ||
# Copyright 2022 ForgeFlow S.L. | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Stock Move Forced Lot", | ||
"summary": """ | ||
This module allows you to set a lot_id in a procurement | ||
to force the stock move generated to only reserve the selected lot. | ||
""", | ||
"version": "17.0.1.0.0", | ||
"license": "LGPL-3", | ||
"author": "ForgeFlow, Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/stock-logistics-workflow", | ||
"depends": ["stock"], | ||
} |
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,50 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * stock_move_forced_lot | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 14.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2023-12-28 11:33+0000\n" | ||
"Last-Translator: Anna Martínez <anna080678@gmail.com>\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: stock_move_forced_lot | ||
#: model:ir.model.fields,field_description:stock_move_forced_lot.field_stock_move__display_name | ||
#: model:ir.model.fields,field_description:stock_move_forced_lot.field_stock_rule__display_name | ||
msgid "Display Name" | ||
msgstr "Nombre mostrado" | ||
|
||
#. module: stock_move_forced_lot | ||
#: model:ir.model.fields,field_description:stock_move_forced_lot.field_stock_move__forced_lot_id | ||
msgid "Forced Lot" | ||
msgstr "Lote forzado" | ||
|
||
#. module: stock_move_forced_lot | ||
#: model:ir.model.fields,field_description:stock_move_forced_lot.field_stock_move__id | ||
#: model:ir.model.fields,field_description:stock_move_forced_lot.field_stock_rule__id | ||
msgid "ID" | ||
msgstr "ID" | ||
|
||
#. module: stock_move_forced_lot | ||
#: model:ir.model.fields,field_description:stock_move_forced_lot.field_stock_move____last_update | ||
#: model:ir.model.fields,field_description:stock_move_forced_lot.field_stock_rule____last_update | ||
msgid "Last Modified on" | ||
msgstr "Última modificación en" | ||
|
||
#. module: stock_move_forced_lot | ||
#: model:ir.model,name:stock_move_forced_lot.model_stock_move | ||
msgid "Stock Move" | ||
msgstr "Movimiento de existencias" | ||
|
||
#. module: stock_move_forced_lot | ||
#: model:ir.model,name:stock_move_forced_lot.model_stock_rule | ||
msgid "Stock Rule" | ||
msgstr "Regla de stock" |
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,50 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * stock_move_forced_lot | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 14.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2023-12-04 09:33+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: stock_move_forced_lot | ||
#: model:ir.model.fields,field_description:stock_move_forced_lot.field_stock_move__display_name | ||
#: model:ir.model.fields,field_description:stock_move_forced_lot.field_stock_rule__display_name | ||
msgid "Display Name" | ||
msgstr "Nome visualizzato" | ||
|
||
#. module: stock_move_forced_lot | ||
#: model:ir.model.fields,field_description:stock_move_forced_lot.field_stock_move__forced_lot_id | ||
msgid "Forced Lot" | ||
msgstr "Lotto forzato" | ||
|
||
#. module: stock_move_forced_lot | ||
#: model:ir.model.fields,field_description:stock_move_forced_lot.field_stock_move__id | ||
#: model:ir.model.fields,field_description:stock_move_forced_lot.field_stock_rule__id | ||
msgid "ID" | ||
msgstr "ID" | ||
|
||
#. module: stock_move_forced_lot | ||
#: model:ir.model.fields,field_description:stock_move_forced_lot.field_stock_move____last_update | ||
#: model:ir.model.fields,field_description:stock_move_forced_lot.field_stock_rule____last_update | ||
msgid "Last Modified on" | ||
msgstr "Ultima modifica il" | ||
|
||
#. module: stock_move_forced_lot | ||
#: model:ir.model,name:stock_move_forced_lot.model_stock_move | ||
msgid "Stock Move" | ||
msgstr "Movimento di magazzino" | ||
|
||
#. module: stock_move_forced_lot | ||
#: model:ir.model,name:stock_move_forced_lot.model_stock_rule | ||
msgid "Stock Rule" | ||
msgstr "Regola di giacenza" |
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,47 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * stock_move_forced_lot | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 14.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_move_forced_lot | ||
#: model:ir.model.fields,field_description:stock_move_forced_lot.field_stock_move__display_name | ||
#: model:ir.model.fields,field_description:stock_move_forced_lot.field_stock_rule__display_name | ||
msgid "Display Name" | ||
msgstr "" | ||
|
||
#. module: stock_move_forced_lot | ||
#: model:ir.model.fields,field_description:stock_move_forced_lot.field_stock_move__forced_lot_id | ||
msgid "Forced Lot" | ||
msgstr "" | ||
|
||
#. module: stock_move_forced_lot | ||
#: model:ir.model.fields,field_description:stock_move_forced_lot.field_stock_move__id | ||
#: model:ir.model.fields,field_description:stock_move_forced_lot.field_stock_rule__id | ||
msgid "ID" | ||
msgstr "" | ||
|
||
#. module: stock_move_forced_lot | ||
#: model:ir.model.fields,field_description:stock_move_forced_lot.field_stock_move____last_update | ||
#: model:ir.model.fields,field_description:stock_move_forced_lot.field_stock_rule____last_update | ||
msgid "Last Modified on" | ||
msgstr "" | ||
|
||
#. module: stock_move_forced_lot | ||
#: model:ir.model,name:stock_move_forced_lot.model_stock_move | ||
msgid "Stock Move" | ||
msgstr "" | ||
|
||
#. module: stock_move_forced_lot | ||
#: model:ir.model,name:stock_move_forced_lot.model_stock_rule | ||
msgid "Stock Rule" | ||
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_rule |
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,57 @@ | ||
# Copyright 2022 ForgeFlow S.L. | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class StockMove(models.Model): | ||
_inherit = "stock.move" | ||
|
||
forced_lot_id = fields.Many2one("stock.lot") | ||
|
||
def _get_available_quantity( | ||
self, | ||
location_id, | ||
lot_id=None, | ||
package_id=None, | ||
owner_id=None, | ||
strict=False, | ||
allow_negative=False, | ||
): | ||
if not lot_id and self.forced_lot_id and self.location_id.usage == "internal": | ||
lot_id = self.forced_lot_id | ||
return super()._get_available_quantity( | ||
location_id, | ||
lot_id=lot_id, | ||
package_id=package_id, | ||
owner_id=owner_id, | ||
strict=strict, | ||
allow_negative=allow_negative, | ||
) | ||
|
||
def _update_reserved_quantity( | ||
self, | ||
need, | ||
location_id, | ||
quant_ids=None, | ||
lot_id=None, | ||
package_id=None, | ||
owner_id=None, | ||
strict=True, | ||
): | ||
if not lot_id and self.forced_lot_id and self.location_id.usage == "internal": | ||
lot_id = self.forced_lot_id | ||
return super()._update_reserved_quantity( | ||
need, | ||
location_id, | ||
quant_ids=quant_ids, | ||
lot_id=lot_id, | ||
package_id=package_id, | ||
owner_id=owner_id, | ||
strict=strict, | ||
) | ||
|
||
@api.model | ||
def _prepare_merge_moves_distinct_fields(self): | ||
res = super()._prepare_merge_moves_distinct_fields() | ||
return res + ["forced_lot_id"] |
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,33 @@ | ||
# Copyright 2022 ForgeFlow S.L. | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import models | ||
|
||
|
||
class StockRule(models.Model): | ||
_inherit = "stock.rule" | ||
|
||
def _get_stock_move_values( | ||
self, | ||
product_id, | ||
product_qty, | ||
product_uom, | ||
location_dest_id, | ||
name, | ||
origin, | ||
company_id, | ||
values, | ||
): | ||
res = super()._get_stock_move_values( | ||
product_id, | ||
product_qty, | ||
product_uom, | ||
location_dest_id, | ||
name, | ||
origin, | ||
company_id, | ||
values, | ||
) | ||
if "lot_id" in values: | ||
res["forced_lot_id"] = values["lot_id"] | ||
return res |
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 @@ | ||
- David Jiménez \<<david.jimenez@forgeflow.com>\> |
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 @@ | ||
This module allows you to set a lot_id in a procurement to force the | ||
stock move generated to only reserve the selected lot. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.