Skip to content
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
77 changes: 77 additions & 0 deletions stock_move_forced_lot/README.rst
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:e72e7a798d250b22df4c5c4eb4a5ac4d8c756b24d0efeb70d7549a73e1b787d9
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/18.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-18-0/stock-logistics-workflow-18-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=18.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:%2018.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 <[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/18.0/stock_move_forced_lot>`_ 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_forced_lot/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
15 changes: 15 additions & 0 deletions stock_move_forced_lot/__manifest__.py
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": "18.0.1.0.0",
"license": "LGPL-3",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-workflow",
"depends": ["stock"],
}
41 changes: 41 additions & 0 deletions stock_move_forced_lot/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# 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 <[email protected]>\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__forced_lot_id
msgid "Forced Lot"
msgstr "Lote forzado"

#. 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"

#~ msgid "Display Name"
#~ msgstr "Nombre mostrado"

#~ msgid "ID"
#~ msgstr "ID"

#~ msgid "Last Modified on"
#~ msgstr "Última modificación en"
41 changes: 41 additions & 0 deletions stock_move_forced_lot/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# 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 <[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 4.17\n"

#. 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,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"

#~ msgid "Display Name"
#~ msgstr "Nome visualizzato"

#~ msgid "ID"
#~ msgstr "ID"

#~ msgid "Last Modified on"
#~ msgstr "Ultima modifica il"
29 changes: 29 additions & 0 deletions stock_move_forced_lot/i18n/stock_move_forced_lot.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_move_forced_lot
#
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_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,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 ""
2 changes: 2 additions & 0 deletions stock_move_forced_lot/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
55 changes: 55 additions & 0 deletions stock_move_forced_lot/models/stock_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# 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,
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,
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"]
33 changes: 33 additions & 0 deletions stock_move_forced_lot/models/stock_rule.py
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
3 changes: 3 additions & 0 deletions stock_move_forced_lot/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 stock_move_forced_lot/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- David Jiménez \<<[email protected]>\>
2 changes: 2 additions & 0 deletions stock_move_forced_lot/readme/DESCRIPTION.md
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.
Binary file added stock_move_forced_lot/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