-
-
Notifications
You must be signed in to change notification settings - Fork 695
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
17 changed files
with
851 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,81 @@ | ||
======================= | ||
Stock Location Lockdown | ||
======================= | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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--warehouse-lightgray.png?logo=github | ||
:target: https://github.com/OCA/stock-logistics-warehouse/tree/10.0/stock_location_lockdown | ||
:alt: OCA/stock-logistics-warehouse | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-10-0/stock-logistics-warehouse-10-0-stock_location_lockdown | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png | ||
:target: https://runbot.odoo-community.org/runbot/153/10.0 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
The aim of this module is to mark internal locations where no product should transit. | ||
Indeed, in complex warehouse setups, we may have a complicated tree of internal locations with parent locations only used to create the hierarchy of the internal locations. | ||
We may want to avoid to put stock on these parent internal locations since they are not physical locations, they just represent a zone of the warehouse. | ||
Theses locations must have *Location Type* set to *Internal Location* because they belong to a warehouse (they can't be configured with *Location Type* set to *View*, cf `Odoo bug #26679 <https://github.com/odoo/odoo/issues/26679>`_). With this module, you will be able to enable a new option *Block stock entrance* for these locations. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Usage | ||
===== | ||
|
||
* Once the module is installed, select any internal location for which you want to prevent stock entrance and check the box *Block Stock Entrance*. Then, you won't be allow to add stock on these locations. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-warehouse/issues>`_. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us smashing it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_location_lockdown%0Aversion:%2010.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 | ||
~~~~~~~ | ||
|
||
* Akretion | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Florian da Costa <florian.dacosta@akretion.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-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/10.0/stock_location_lockdown>`_ 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,4 @@ | ||
# Copyright 2018 Akretion | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
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,16 @@ | ||
# Copyright 2018 Akretion | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Stock Location Lockdown", | ||
"summary": "Prevent to add stock on locked locations", | ||
"author": "Akretion, Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/stock-logistics-warehouse", | ||
"category": "Warehouse", | ||
"version": "12.0.1.0.0", | ||
"license": "AGPL-3", | ||
"application": False, | ||
"installable": True, | ||
"depends": ["stock"], | ||
"data": ["views/stock_location.xml"], | ||
} |
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 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * stock_location_lockdown | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 9.0c\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2018-09-06 13:10+0000\n" | ||
"PO-Revision-Date: 2018-09-06 13:10+0000\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_location_lockdown | ||
#: model:ir.model.fields,field_description:stock_location_lockdown.field_stock_location_block_stock_entrance | ||
msgid "Block stock entrance" | ||
msgstr "Bloquer les entrées de stock" | ||
|
||
#. module: stock_location_lockdown | ||
#: model:ir.model,name:stock_location_lockdown.model_stock_location | ||
msgid "Inventory Locations" | ||
msgstr "" | ||
|
||
#. module: stock_location_lockdown | ||
#: model:ir.model,name:stock_location_lockdown.model_stock_quant | ||
msgid "Quants" | ||
msgstr "" | ||
|
||
#. module: stock_location_lockdown | ||
#: code:addons/stock_location_lockdown/models/stock_quant.py:17 | ||
#, python-format | ||
msgid "" | ||
"The location %s is blocked and can not be used for moving the product %s" | ||
msgstr "" | ||
|
||
#. module: stock_location_lockdown | ||
#: model:ir.model.fields,help:stock_location_lockdown.field_stock_location_block_stock_entrance | ||
#, fuzzy | ||
msgid "" | ||
"if this box is checked, putting stock on this location won't be allowed. " | ||
"Usually used for a virtual location that has childrens." | ||
msgstr "" | ||
"Si cette case est cochée, il ne sera pas possible d'ajouter du stock dans " | ||
"cette emplacement. Habituellement utilisée pour les emplacements virtuels " | ||
"ayant des enfants." | ||
|
||
#, fuzzy | ||
#~ msgid "The location '%s' is not configured to receive stock." | ||
#~ msgstr "L'emplacement %s n'est pas configuré pour recevoir du stock." | ||
|
||
#~ msgid "Location" | ||
#~ msgstr "Emplacement" |
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,52 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * stock_location_lockdown | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 10.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2018-12-28 01:41+0000\n" | ||
"Last-Translator: Pedro Castro Silva <pedrocs@exo.pt>\n" | ||
"Language-Team: none\n" | ||
"Language: pt\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 3.3\n" | ||
|
||
#. module: stock_location_lockdown | ||
#: model:ir.model.fields,field_description:stock_location_lockdown.field_stock_location_block_stock_entrance | ||
msgid "Block stock entrance" | ||
msgstr "Bloquear entradas de stock" | ||
|
||
#. module: stock_location_lockdown | ||
#: model:ir.model,name:stock_location_lockdown.model_stock_location | ||
msgid "Inventory Locations" | ||
msgstr "Localizações de Inventário" | ||
|
||
#. module: stock_location_lockdown | ||
#: model:ir.model,name:stock_location_lockdown.model_stock_quant | ||
msgid "Quants" | ||
msgstr "" | ||
|
||
#. module: stock_location_lockdown | ||
#: code:addons/stock_location_lockdown/models/stock_quant.py:17 | ||
#, python-format | ||
msgid "" | ||
"The location %s is blocked and can not be used for moving the product %s" | ||
msgstr "" | ||
|
||
#. module: stock_location_lockdown | ||
#: model:ir.model.fields,help:stock_location_lockdown.field_stock_location_block_stock_entrance | ||
msgid "" | ||
"if this box is checked, putting stock on this location won't be allowed. " | ||
"Usually used for a virtual location that has childrens." | ||
msgstr "" | ||
"Se esta caixa estiver selecionada, não será permitido colocar stock nesta " | ||
"localização. É geralmente utilizada em localizações virtuais com " | ||
"descendentes." | ||
|
||
#~ msgid "The location '%s' is not configured to receive stock." | ||
#~ msgstr "A localização '%s' não está configurada para receber 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,41 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * stock_location_lockdown | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 10.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_location_lockdown | ||
#: model:ir.model.fields,field_description:stock_location_lockdown.field_stock_location_block_stock_entrance | ||
msgid "Block stock entrance" | ||
msgstr "" | ||
|
||
#. module: stock_location_lockdown | ||
#: model:ir.model,name:stock_location_lockdown.model_stock_location | ||
msgid "Inventory Locations" | ||
msgstr "" | ||
|
||
#. module: stock_location_lockdown | ||
#: model:ir.model,name:stock_location_lockdown.model_stock_quant | ||
msgid "Quants" | ||
msgstr "" | ||
|
||
#. module: stock_location_lockdown | ||
#: code:addons/stock_location_lockdown/models/stock_quant.py:17 | ||
#, python-format | ||
msgid "The location %s is blocked and can not be used for moving the product %s" | ||
msgstr "" | ||
|
||
#. module: stock_location_lockdown | ||
#: model:ir.model.fields,help:stock_location_lockdown.field_stock_location_block_stock_entrance | ||
msgid "if this box is checked, putting stock on this location won't be allowed. Usually used for a virtual location that has childrens." | ||
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,5 @@ | ||
# Copyright 2019 Akretion | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import stock_location | ||
from . import stock_quant |
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,31 @@ | ||
# Copyright 2019 Akretion | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models, _ | ||
from odoo.exceptions import UserError | ||
|
||
|
||
class StockLocation(models.Model): | ||
_inherit = 'stock.location' | ||
|
||
block_stock_entrance = fields.Boolean( | ||
help="if this box is checked, putting stock on this location won't be " | ||
"allowed. Usually used for a virtual location that has " | ||
"childrens.") | ||
|
||
# Raise error if the location that you're trying to block | ||
# has already got quants | ||
def write(self, values): | ||
res = super().write(values) | ||
|
||
if ('block_stock_entrance' in values | ||
and values['block_stock_entrance']): | ||
# Unlink zero quants before checking | ||
# if there are quants on the location | ||
self.env['stock.quant']._unlink_zero_quants() | ||
if self.mapped('quant_ids'): | ||
raise UserError( | ||
_("It is impossible to prohibit this location from\ | ||
receiving products as it already contains some.") | ||
) | ||
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,22 @@ | ||
# Copyright 2019 Akretion | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import api, models, _ | ||
from odoo.exceptions import ValidationError | ||
|
||
|
||
class StockQuant(models.Model): | ||
_inherit = 'stock.quant' | ||
|
||
# Raise an error when trying to change a quant | ||
# which corresponding stock location is blocked | ||
@api.constrains('location_id') | ||
def check_location_blocked(self): | ||
for record in self: | ||
if record.location_id.block_stock_entrance: | ||
raise ValidationError( | ||
_('The location %s is blocked and can ' | ||
'not be used for moving the product %s') | ||
% (record.location_id.name, record.product_id.name) | ||
) | ||
return True |
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 @@ | ||
* Florian da Costa <florian.dacosta@akretion.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,4 @@ | ||
The aim of this module is to mark internal locations where no product should transit. | ||
Indeed, in complex warehouse setups, we may have a complicated tree of internal locations with parent locations only used to create the hierarchy of the internal locations. | ||
We may want to avoid to put stock on these parent internal locations since they are not physical locations, they just represent a zone of the warehouse. | ||
Theses locations must have *Location Type* set to *Internal Location* because they belong to a warehouse (they can't be configured with *Location Type* set to *View*, cf `Odoo bug #26679 <https://github.com/odoo/odoo/issues/26679>`_). With this module, you will be able to enable a new option *Block stock entrance* for these locations. |
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 @@ | ||
* Once the module is installed, select any internal location for which you want to prevent stock entrance and check the box *Block Stock Entrance*. Then, you won't be allow to add stock on these locations. |
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.