mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[11.0][MIG] stock_inventory_lockdown
This commit is contained in:
@@ -1,40 +1,65 @@
|
||||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
|
||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||
:alt: License: AGPL-3
|
||||
===================
|
||||
Inventory Lock Down
|
||||
===================
|
||||
|
||||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
.. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png
|
||||
:target: https://odoo-community.org/page/development-status
|
||||
:alt: Mature
|
||||
.. |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/11.0/stock_inventory_lockdown
|
||||
:alt: OCA/stock-logistics-warehouse
|
||||
.. |badge4| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
||||
:target: https://runbot.odoo-community.org/runbot/153/11.0
|
||||
:alt: Try me on Runbot
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4|
|
||||
|
||||
======================================
|
||||
Lock down locations during inventories
|
||||
======================================
|
||||
This module lets you lock down the locations during an inventory.
|
||||
|
||||
**Table of contents**
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
.. image:: stock_inventory_lockdown/static/images/move_error.png
|
||||
:alt: Error message
|
||||
|
||||
While an inventory is in the state "In progress", no stock moves
|
||||
can be recorded in/out of the inventory's location: users will get an error
|
||||
message.
|
||||
Creating or modifying locations is also forbidden.
|
||||
|
||||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
|
||||
:alt: Try me on Runbot
|
||||
:target: https://runbot.odoo-community.org/runbot/153/10.0
|
||||
.. image:: stock_inventory_lockdown/static/images/move_error.png
|
||||
:alt: Error message
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
Do not contact contributors directly about support or help with technical issues.
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Authors
|
||||
~~~~~~~
|
||||
|
||||
* Numérigraphe
|
||||
* Eficent
|
||||
|
||||
Contributors
|
||||
------------
|
||||
~~~~~~~~~~~~
|
||||
|
||||
* Loïc Bellier (Numérigraphe) <lb@numerigraphe.com>
|
||||
* Lionel Sausin (Numérigraphe) <ls@numerigraphe.com>
|
||||
@@ -43,18 +68,19 @@ Contributors
|
||||
* Lois Rilo (Eficent) <lois.rilo@eficent.com>
|
||||
* Jordi Ballester (Eficent) <jordi.ballester@eficent.com>
|
||||
|
||||
Maintainers
|
||||
~~~~~~~~~~~
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
This module is maintained by the OCA.
|
||||
|
||||
.. image:: https://odoo-community.org/logo.png
|
||||
:alt: Odoo Community Association
|
||||
:target: https://odoo-community.org
|
||||
|
||||
This module is maintained by the OCA.
|
||||
|
||||
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.
|
||||
|
||||
To contribute to this module, please visit https://odoo-community.org.
|
||||
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/11.0/stock_inventory_lockdown>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
||||
@@ -1,5 +1 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2013-2016 Numérigraphe SARL
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from . import models
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2013-2016 Numérigraphe SARL
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
{
|
||||
"name": "Inventory Lock Down",
|
||||
"summary": "Lock down stock locations during inventories.",
|
||||
"version": "10.0.1.0.1",
|
||||
"version": "11.0.1.0.0",
|
||||
"development_status": "Mature",
|
||||
"depends": ["stock"],
|
||||
"author": "Numérigraphe, Eficent, Odoo Community Association (OCA)",
|
||||
"category": "Warehouse Management",
|
||||
"images": [
|
||||
"images/move_error.png",
|
||||
"images/location_locked.png"],
|
||||
"images/location_locked.png",
|
||||
],
|
||||
"license": "AGPL-3",
|
||||
"installable": True,
|
||||
}
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2013-2016 Numérigraphe SARL
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from . import stock_move
|
||||
from . import stock_inventory
|
||||
from . import stock_location
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2013-2016 Numérigraphe SARL
|
||||
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
|
||||
# (http://www.eficent.com)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2016 Numérigraphe SARL
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2016 Numérigraphe SARL
|
||||
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
|
||||
# (http://www.eficent.com)
|
||||
@@ -14,14 +13,12 @@ class StockMove(models.Model):
|
||||
@api.multi
|
||||
def _get_reserved_locations(self):
|
||||
self.ensure_one()
|
||||
return self.reserved_quant_ids.mapped('location_id') + \
|
||||
self.split_from.reserved_quant_ids.mapped('location_id')
|
||||
return self.move_line_ids.mapped('location_id')
|
||||
|
||||
@api.multi
|
||||
def _get_dest_locations(self):
|
||||
self.ensure_one()
|
||||
return self.linked_move_operation_ids.mapped(
|
||||
'operation_id.location_dest_id')
|
||||
return self.move_line_ids.mapped('location_dest_id')
|
||||
|
||||
@api.constrains('location_dest_id', 'location_id', 'state')
|
||||
def _check_locked_location(self):
|
||||
|
||||
6
stock_inventory_lockdown/readme/CONTRIBUTORS.rst
Normal file
6
stock_inventory_lockdown/readme/CONTRIBUTORS.rst
Normal file
@@ -0,0 +1,6 @@
|
||||
* Loïc Bellier (Numérigraphe) <lb@numerigraphe.com>
|
||||
* Lionel Sausin (Numérigraphe) <ls@numerigraphe.com>
|
||||
* Laetitia Gangloff (Acsone) <laetitia.gangloff@acsone.eu>
|
||||
* Laurent Mignon (Acsone) <laurent.mignon@acsone.eu>
|
||||
* Lois Rilo (Eficent) <lois.rilo@eficent.com>
|
||||
* Jordi Ballester (Eficent) <jordi.ballester@eficent.com>
|
||||
1
stock_inventory_lockdown/readme/DESCRIPTION.rst
Normal file
1
stock_inventory_lockdown/readme/DESCRIPTION.rst
Normal file
@@ -0,0 +1 @@
|
||||
This module lets you lock down the locations during an inventory.
|
||||
7
stock_inventory_lockdown/readme/USAGE.rst
Normal file
7
stock_inventory_lockdown/readme/USAGE.rst
Normal file
@@ -0,0 +1,7 @@
|
||||
While an inventory is in the state "In progress", no stock moves
|
||||
can be recorded in/out of the inventory's location: users will get an error
|
||||
message.
|
||||
Creating or modifying locations is also forbidden.
|
||||
|
||||
.. image:: stock_inventory_lockdown/static/images/move_error.png
|
||||
:alt: Error message
|
||||
@@ -1,5 +1 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2013-2016 Numérigraphe SARL
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from . import test_stock_inventory_lockdown
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2014 Acsone SA/NV (http://www.acsone.eu)
|
||||
# © 2016 Numérigraphe SARL
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
@@ -26,17 +25,17 @@ class StockInventoryLocationTest(TestStockCommon):
|
||||
self.env['stock.quant'].create(
|
||||
{'location_id': self.new_location.id,
|
||||
'product_id': self.productA.id,
|
||||
'qty': 10.0})
|
||||
'quantity': 10.0})
|
||||
self.env['stock.quant'].create(
|
||||
{'location_id': self.new_parent_location.id,
|
||||
'product_id': self.productB.id,
|
||||
'qty': 5.0})
|
||||
'quantity': 5.0})
|
||||
# Prepare an inventory
|
||||
self.inventory = self.env['stock.inventory'].create(
|
||||
{'name': 'Lock down location',
|
||||
'filter': 'none',
|
||||
'location_id': self.new_location.id})
|
||||
self.inventory.prepare_inventory()
|
||||
self.inventory.action_start()
|
||||
self.assertTrue(self.inventory.line_ids, 'The inventory is empty.')
|
||||
|
||||
def create_stock_move(self, product, origin_id=False, dest_id=False):
|
||||
@@ -79,7 +78,7 @@ class StockInventoryLocationTest(TestStockCommon):
|
||||
{'name': 'Lock down location',
|
||||
'filter': 'partial',
|
||||
'location_id': self.new_sublocation.id})
|
||||
inventory_subloc.prepare_inventory()
|
||||
inventory_subloc.action_start()
|
||||
line = self.env['stock.inventory.line'].create(
|
||||
{'product_id': self.productA.id,
|
||||
'product_qty': 22.0,
|
||||
@@ -95,16 +94,18 @@ class StockInventoryLocationTest(TestStockCommon):
|
||||
location."""
|
||||
move1 = self.create_stock_move(
|
||||
self.productA, origin_id=self.inventory.location_id.id)
|
||||
move1.action_confirm()
|
||||
move1._action_confirm()
|
||||
with self.assertRaises(ValidationError):
|
||||
move1.action_assign()
|
||||
move1.action_done()
|
||||
move1._action_assign()
|
||||
move1.move_line_ids[0].qty_done = 10.0
|
||||
move1._action_done()
|
||||
move2 = self.create_stock_move(
|
||||
self.productA, dest_id=self.inventory.location_id.id)
|
||||
with self.assertRaises(ValidationError):
|
||||
move2.action_confirm()
|
||||
move2.action_assign()
|
||||
move2.action_done()
|
||||
move2._action_confirm()
|
||||
move2._action_assign()
|
||||
move2.move_line_ids[0].qty_done = 10.0
|
||||
move2._action_done()
|
||||
|
||||
def test_move_reserved_quants(self):
|
||||
"""Shipping stock should be allowed or not depending on reserved
|
||||
@@ -114,14 +115,16 @@ class StockInventoryLocationTest(TestStockCommon):
|
||||
inventoried."""
|
||||
move1 = self.create_stock_move(
|
||||
self.productB, self.new_parent_location.id)
|
||||
move1.action_confirm()
|
||||
move1.action_assign()
|
||||
move1.action_done()
|
||||
move1._action_confirm()
|
||||
move1._action_assign()
|
||||
move1.move_line_ids[0].qty_done = 10.0
|
||||
move1._action_done()
|
||||
self.assertEqual(
|
||||
move1.state, 'done', 'Move has not been completed')
|
||||
move2 = self.create_stock_move(
|
||||
self.productA, self.new_parent_location.id)
|
||||
move2.action_confirm()
|
||||
move2._action_confirm()
|
||||
with self.assertRaises(ValidationError):
|
||||
move2.action_assign()
|
||||
move2.action_done()
|
||||
move2._action_assign()
|
||||
move2.move_line_ids[0].qty_done = 10.0
|
||||
move2._action_done()
|
||||
|
||||
Reference in New Issue
Block a user