mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[MIG] stock_inventory_exclude_sublocation: Migration to 13.0
This commit is contained in:
@@ -14,13 +14,13 @@ Stock Inventory Exclude Sublocation
|
||||
: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/12.0/stock_inventory_exclude_sublocation
|
||||
:target: https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_inventory_exclude_sublocation
|
||||
: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-12-0/stock-logistics-warehouse-12-0-stock_inventory_exclude_sublocation
|
||||
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-13-0/stock-logistics-warehouse-13-0-stock_inventory_exclude_sublocation
|
||||
: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/12.0
|
||||
:target: https://runbot.odoo-community.org/runbot/153/13.0
|
||||
:alt: Try me on Runbot
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
@@ -55,7 +55,7 @@ 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_inventory_exclude_sublocation%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
`feedback <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_inventory_exclude_sublocation%0Aversion:%2013.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.
|
||||
|
||||
@@ -71,8 +71,9 @@ Authors
|
||||
Contributors
|
||||
~~~~~~~~~~~~
|
||||
|
||||
* Lois Rilo Antelo <lois.rilo@eficent.com>
|
||||
* Lois Rilo Antelo <lois.rilo@forgeflow.com>
|
||||
* Bhavesh Odedra <bodedra@opensourceintegrators.com>
|
||||
* Héctor Villarreal <hector.villarreal@forgeflow.com>
|
||||
|
||||
Maintainers
|
||||
~~~~~~~~~~~
|
||||
@@ -87,6 +88,6 @@ 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/12.0/stock_inventory_exclude_sublocation>`_ project on GitHub.
|
||||
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_inventory_exclude_sublocation>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
|
||||
# (http://www.eficent.com)
|
||||
# Copyright 2017-2019 ForgeFlow S.L. (http://www.forgeflow.com)
|
||||
# Copyright 2019 Tecnativa - Pedro M. Baeza
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
{
|
||||
"name": "Stock Inventory Exclude Sublocation",
|
||||
"summary": "Allow to perform inventories of a location without including "
|
||||
"its child locations.",
|
||||
"version": "12.0.1.0.1",
|
||||
"version": "13.0.1.0.1",
|
||||
"development_status": "Mature",
|
||||
"author": "Eficent, " "Tecnativa, " "Odoo Community Association (OCA)",
|
||||
"author": "ForgeFlow, Tecnativa, Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/stock-logistics-warehouse",
|
||||
"category": "Warehouse Management",
|
||||
"category": "Warehouse",
|
||||
"depends": ["stock"],
|
||||
"data": ["views/stock_inventory_view.xml"],
|
||||
"license": "AGPL-3",
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
|
||||
# (http://www.eficent.com)
|
||||
# Copyright 2019 ForgeFlow S.L. (http://www.forgeflow.com)
|
||||
# Copyright 2019 Tecnativa - Pedro M. Baeza
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
@@ -28,6 +27,6 @@ class Inventory(models.Model):
|
||||
return vals
|
||||
new_vals = []
|
||||
for val in vals:
|
||||
if val["location_id"] == self.location_id.id:
|
||||
if val["location_id"] in self.location_ids.ids:
|
||||
new_vals.append(val)
|
||||
return new_vals
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
* Lois Rilo Antelo <lois.rilo@eficent.com>
|
||||
* Lois Rilo Antelo <lois.rilo@forgeflow.com>
|
||||
* Bhavesh Odedra <bodedra@opensourceintegrators.com>
|
||||
* Héctor Villarreal <hector.villarreal@forgeflow.com>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
|
||||
<title>Stock Inventory Exclude Sublocation</title>
|
||||
<style type="text/css">
|
||||
|
||||
@@ -367,7 +367,7 @@ ul.auto-toc {
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_inventory_exclude_sublocation"><img alt="OCA/stock-logistics-warehouse" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_inventory_exclude_sublocation"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/153/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_inventory_exclude_sublocation"><img alt="OCA/stock-logistics-warehouse" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-13-0/stock-logistics-warehouse-13-0-stock_inventory_exclude_sublocation"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/153/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module extends the functionality of Inventory Adjustment to allow you to
|
||||
exclude all the sublocations when doing an inventory adjustment for a
|
||||
given location.</p>
|
||||
@@ -403,7 +403,7 @@ E.g. if we apply a cycle count strategy.</p>
|
||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues">GitHub Issues</a>.
|
||||
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
|
||||
<a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_inventory_exclude_sublocation%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_inventory_exclude_sublocation%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||
</div>
|
||||
<div class="section" id="credits">
|
||||
@@ -418,8 +418,9 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||
<div class="section" id="contributors">
|
||||
<h2><a class="toc-backref" href="#id5">Contributors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>Lois Rilo Antelo <<a class="reference external" href="mailto:lois.rilo@eficent.com">lois.rilo@eficent.com</a>></li>
|
||||
<li>Lois Rilo Antelo <<a class="reference external" href="mailto:lois.rilo@forgeflow.com">lois.rilo@forgeflow.com</a>></li>
|
||||
<li>Bhavesh Odedra <<a class="reference external" href="mailto:bodedra@opensourceintegrators.com">bodedra@opensourceintegrators.com</a>></li>
|
||||
<li>Héctor Villarreal <<a class="reference external" href="mailto:hector.villarreal@forgeflow.com">hector.villarreal@forgeflow.com</a>></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
@@ -429,7 +430,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||
<p>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.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_inventory_exclude_sublocation">OCA/stock-logistics-warehouse</a> project on GitHub.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_inventory_exclude_sublocation">OCA/stock-logistics-warehouse</a> project on GitHub.</p>
|
||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -10,17 +10,11 @@ class TestStockInventoryExcludeSublocation(TransactionCase):
|
||||
super(TestStockInventoryExcludeSublocation, self).setUp()
|
||||
self.inventory_model = self.env["stock.inventory"]
|
||||
self.location_model = self.env["stock.location"]
|
||||
self.lot_model = self.env["stock.production.lot"]
|
||||
self.quant_model = self.env["stock.quant"]
|
||||
self.package_model = self.env["stock.quant.package"]
|
||||
self.res_users_model = self.env["res.users"]
|
||||
|
||||
self.company = self.env.ref("base.main_company")
|
||||
self.partner = self.ref("base.res_partner_4")
|
||||
self.grp_stock_manager = self.env.ref("stock.group_stock_manager")
|
||||
self.grp_tracking_owner = self.env.ref("stock.group_tracking_owner")
|
||||
self.grp_production_lot = self.env.ref("stock.group_production_lot")
|
||||
self.grp_tracking_lot = self.env.ref("stock.group_tracking_lot")
|
||||
|
||||
self.user = self.res_users_model.create(
|
||||
{
|
||||
@@ -29,18 +23,7 @@ class TestStockInventoryExcludeSublocation(TransactionCase):
|
||||
"email": "example@yourcompany.com",
|
||||
"company_id": self.company.id,
|
||||
"company_ids": [(4, self.company.id)],
|
||||
"groups_id": [
|
||||
(
|
||||
6,
|
||||
0,
|
||||
[
|
||||
self.grp_stock_manager.id,
|
||||
self.grp_tracking_owner.id,
|
||||
self.grp_production_lot.id,
|
||||
self.grp_tracking_lot.id,
|
||||
],
|
||||
)
|
||||
],
|
||||
"groups_id": [(6, 0, [self.grp_stock_manager.id])],
|
||||
}
|
||||
)
|
||||
|
||||
@@ -68,19 +51,11 @@ class TestStockInventoryExcludeSublocation(TransactionCase):
|
||||
"location_id": self.location.id,
|
||||
}
|
||||
)
|
||||
self.lot_a = self.lot_model.create(
|
||||
{"name": "Lot for product1", "product_id": self.product1.id}
|
||||
)
|
||||
self.lot_b = self.lot_model.create(
|
||||
{"name": "Lot for product1", "product_id": self.product2.id}
|
||||
)
|
||||
self.package = self.package_model.create({"name": "PACK00TEST1"})
|
||||
|
||||
# Add a product in each location
|
||||
starting_inv = self.inventory_model.create(
|
||||
{
|
||||
"name": "Starting inventory",
|
||||
"filter": "product",
|
||||
"line_ids": [
|
||||
(
|
||||
0,
|
||||
@@ -90,7 +65,6 @@ class TestStockInventoryExcludeSublocation(TransactionCase):
|
||||
"product_uom_id": self.env.ref("uom.product_uom_unit").id,
|
||||
"product_qty": 2.0,
|
||||
"location_id": self.location.id,
|
||||
"prod_lot_id": self.lot_a.id,
|
||||
},
|
||||
),
|
||||
(
|
||||
@@ -101,20 +75,19 @@ class TestStockInventoryExcludeSublocation(TransactionCase):
|
||||
"product_uom_id": self.env.ref("uom.product_uom_unit").id,
|
||||
"product_qty": 4.0,
|
||||
"location_id": self.sublocation.id,
|
||||
"prod_lot_id": self.lot_b.id,
|
||||
},
|
||||
),
|
||||
],
|
||||
}
|
||||
)
|
||||
starting_inv.action_start()
|
||||
starting_inv.action_validate()
|
||||
|
||||
def _create_inventory_all_products(self, name, location, exclude_sublocation):
|
||||
inventory = self.inventory_model.create(
|
||||
{
|
||||
"name": name,
|
||||
"filter": "none",
|
||||
"location_id": location.id,
|
||||
"location_ids": [(4, location.id)],
|
||||
"exclude_sublocation": exclude_sublocation,
|
||||
}
|
||||
)
|
||||
@@ -154,80 +127,3 @@ class TestStockInventoryExcludeSublocation(TransactionCase):
|
||||
1,
|
||||
"The products in the sublocations are not excluded",
|
||||
)
|
||||
|
||||
def test_lot_excluding_sublocation(self):
|
||||
"""Check if the sublocations are excluded when using lots."""
|
||||
inventory = self.inventory_model.sudo(self.user.id).create(
|
||||
{
|
||||
"name": "Inventory lot",
|
||||
"filter": "lot",
|
||||
"location_id": self.location.id,
|
||||
"lot_id": self.lot_a.id,
|
||||
"exclude_sublocation": True,
|
||||
}
|
||||
)
|
||||
inventory.action_start()
|
||||
inventory.action_validate()
|
||||
lines = inventory.line_ids
|
||||
self.assertEqual(
|
||||
len(lines),
|
||||
1,
|
||||
"The products in the sublocations are " "not excluded with lots.",
|
||||
)
|
||||
|
||||
def test_product_and_owner_excluding_sublocation(self):
|
||||
"""Check if sublocations are excluded when filtering by owner and
|
||||
product."""
|
||||
self.quant_model.create(
|
||||
{
|
||||
"product_id": self.product1.id,
|
||||
"location_id": self.location.id,
|
||||
"quantity": 1,
|
||||
"owner_id": self.partner,
|
||||
}
|
||||
)
|
||||
inventory = self.inventory_model.sudo(self.user.id).create(
|
||||
{
|
||||
"name": "Inventory lot",
|
||||
"filter": "product_owner",
|
||||
"location_id": self.location.id,
|
||||
"product_id": self.product1.id,
|
||||
"partner_id": self.partner,
|
||||
"exclude_sublocation": True,
|
||||
}
|
||||
)
|
||||
inventory.action_start()
|
||||
lines = inventory.line_ids
|
||||
self.assertEqual(
|
||||
len(lines),
|
||||
1,
|
||||
"The products in the sublocations are "
|
||||
"not excluded with product and owner filter.",
|
||||
)
|
||||
|
||||
def test_pack_excluding_sublocation(self):
|
||||
"""Check if sublocations are excluded when filtering by package."""
|
||||
self.quant_model.create(
|
||||
{
|
||||
"product_id": self.product1.id,
|
||||
"location_id": self.location.id,
|
||||
"quantity": 1,
|
||||
"package_id": self.package.id,
|
||||
}
|
||||
)
|
||||
inventory = self.inventory_model.sudo(self.user.id).create(
|
||||
{
|
||||
"name": "Inventory lot",
|
||||
"filter": "pack",
|
||||
"location_id": self.location.id,
|
||||
"package_id": self.package.id,
|
||||
"exclude_sublocation": True,
|
||||
}
|
||||
)
|
||||
inventory.action_start()
|
||||
lines = inventory.line_ids
|
||||
self.assertEqual(
|
||||
len(lines),
|
||||
1,
|
||||
"The products in the sublocations are " "not excluded with package filter.",
|
||||
)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright 2017 Eficent Business and IT Consulting Services S.L.
|
||||
<!-- Copyright 2019 ForgeFlow S.L. (http://www.forgeflow.com)
|
||||
Copyright 2019 Tecnativa - Pedro M. Baeza
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<field name="model">stock.inventory</field>
|
||||
<field name="inherit_id" ref="stock.view_inventory_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="location_id" position="after">
|
||||
<field name="location_ids" position="after">
|
||||
<field name="exclude_sublocation"
|
||||
groups="stock.group_stock_multi_locations"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user