diff --git a/stock_move_location/README.rst b/stock_move_location/README.rst
index 910d68111..29b83ddc2 100644
--- a/stock_move_location/README.rst
+++ b/stock_move_location/README.rst
@@ -14,13 +14,13 @@ Move Stock Location
: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_move_location
+ :target: https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_move_location
: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_move_location
+ :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-13-0/stock-logistics-warehouse-13-0-stock_move_location
: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|
@@ -75,7 +75,7 @@ Bug Tracker
Bugs are tracked on `GitHub 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 `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -93,9 +93,9 @@ Contributors
* Mathieu Vatel
* Mykhailo Panarin
* Sergio Teruel
-* Joan Sisquella
-* Jordi Ballester Alomar
-* Lois Rilo
+* Joan Sisquella
+* Jordi Ballester Alomar
+* Lois Rilo
Maintainers
~~~~~~~~~~~
@@ -110,6 +110,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 `_ project on GitHub.
+This module is part of the `OCA/stock-logistics-warehouse `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/stock_move_location/__init__.py b/stock_move_location/__init__.py
index 91ba63a47..d1dcf0d2a 100644
--- a/stock_move_location/__init__.py
+++ b/stock_move_location/__init__.py
@@ -4,3 +4,4 @@
from . import wizard
from . import models
+from .init_hook import enable_multi_locations
diff --git a/stock_move_location/__manifest__.py b/stock_move_location/__manifest__.py
index a2c60d32d..9feb57a27 100644
--- a/stock_move_location/__manifest__.py
+++ b/stock_move_location/__manifest__.py
@@ -4,8 +4,8 @@
{
"name": "Move Stock Location",
- "version": "12.0.1.2.0",
- "author": "Julius Network Solutions, " "Odoo Community Association (OCA)",
+ "version": "13.0.1.0.0",
+ "author": "Julius Network Solutions, Odoo Community Association (OCA)",
"summary": "This module allows to move all stock "
"in a stock location to an other one.",
"website": "https://github.com/OCA/stock-logistics-warehouse",
@@ -17,4 +17,5 @@
"views/stock_picking_type_views.xml",
"wizard/stock_move_location.xml",
],
+ "post_init_hook": "enable_multi_locations",
}
diff --git a/stock_move_location/data/stock_quant_view.xml b/stock_move_location/data/stock_quant_view.xml
old mode 100755
new mode 100644
index d55d803b1..a8e6f1baf
--- a/stock_move_location/data/stock_quant_view.xml
+++ b/stock_move_location/data/stock_quant_view.xml
@@ -5,11 +5,10 @@
diff --git a/stock_move_location/i18n/de.po b/stock_move_location/i18n/de.po
index ba5df6a29..c03c1bf51 100644
--- a/stock_move_location/i18n/de.po
+++ b/stock_move_location/i18n/de.po
@@ -131,7 +131,7 @@ msgid "Move from location..."
msgstr "Von Lagerort bewegen..."
#. module: stock_move_location
-#: code:addons/stock_move_location/wizard/stock_move_location_line.py:65
+#: code:addons/stock_move_location/wizard/stock_move_location_line.py:0
#, python-format
msgid "Move quantity can not exceed max quantity or be negative"
msgstr "Die Menge darf nicht die Bestandsmenge überschreiten oder negativ sein"
diff --git a/stock_move_location/i18n/es.po b/stock_move_location/i18n/es.po
index b4632de33..7f90f77ef 100644
--- a/stock_move_location/i18n/es.po
+++ b/stock_move_location/i18n/es.po
@@ -131,7 +131,7 @@ msgid "Move from location..."
msgstr "Mover desde ubicación..."
#. module: stock_move_location
-#: code:addons/stock_move_location/wizard/stock_move_location_line.py:65
+#: code:addons/stock_move_location/wizard/stock_move_location_line.py:0
#, python-format
msgid "Move quantity can not exceed max quantity or be negative"
msgstr "La cantidad movida no puede superar la cantidad máxima o ser negativo"
diff --git a/stock_move_location/i18n/stock_move_location.pot b/stock_move_location/i18n/stock_move_location.pot
index 839240c9d..d4ddfe2b7 100644
--- a/stock_move_location/i18n/stock_move_location.pot
+++ b/stock_move_location/i18n/stock_move_location.pot
@@ -1,12 +1,12 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
-# * stock_move_location
+# * stock_move_location
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 12.0\n"
+"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
-"Last-Translator: <>\n"
+"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -124,7 +124,7 @@ msgid "Move from location..."
msgstr ""
#. module: stock_move_location
-#: code:addons/stock_move_location/wizard/stock_move_location_line.py:65
+#: code:addons/stock_move_location/wizard/stock_move_location_line.py:0
#, python-format
msgid "Move quantity can not exceed max quantity or be negative"
msgstr ""
@@ -183,7 +183,9 @@ msgstr ""
#. module: stock_move_location
#: model:ir.model.fields,help:stock_move_location.field_stock_picking_type__show_move_onhand
-msgid "Show a button 'Move On Hand' in the Inventory Dashboard to initiate the process to move the products in stock at the origin location."
+msgid ""
+"Show a button 'Move On Hand' in the Inventory Dashboard to initiate the "
+"process to move the products in stock at the origin location."
msgstr ""
#. module: stock_move_location
@@ -220,4 +222,3 @@ msgstr ""
#: model:ir.model.fields,help:stock_move_location.field_wiz_stock_move_location__origin_location_disable
msgid "technical field to disable the edition of origin location."
msgstr ""
-
diff --git a/stock_move_location/init_hook.py b/stock_move_location/init_hook.py
new file mode 100644
index 000000000..0402025ba
--- /dev/null
+++ b/stock_move_location/init_hook.py
@@ -0,0 +1,10 @@
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+from odoo import SUPERUSER_ID, api
+
+
+def enable_multi_locations(cr, registry):
+ env = api.Environment(cr, SUPERUSER_ID, {})
+ ResConfig = env["res.config.settings"]
+ default_values = ResConfig.default_get(list(ResConfig.fields_get()))
+ default_values.update({"group_stock_multi_locations": True})
+ ResConfig.create(default_values).execute()
diff --git a/stock_move_location/readme/CONTRIBUTORS.rst b/stock_move_location/readme/CONTRIBUTORS.rst
index 0e307c893..bb0536766 100644
--- a/stock_move_location/readme/CONTRIBUTORS.rst
+++ b/stock_move_location/readme/CONTRIBUTORS.rst
@@ -1,6 +1,6 @@
* Mathieu Vatel
* Mykhailo Panarin
* Sergio Teruel
-* Joan Sisquella
-* Jordi Ballester Alomar
-* Lois Rilo
+* Joan Sisquella
+* Jordi Ballester Alomar
+* Lois Rilo
diff --git a/stock_move_location/static/description/index.html b/stock_move_location/static/description/index.html
index 1ffd8d51e..8ef97e6b3 100644
--- a/stock_move_location/static/description/index.html
+++ b/stock_move_location/static/description/index.html
@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-

+

This module allows to move entire location of products from one place to
another and move only selected quants.
Table of contents
@@ -424,7 +424,7 @@ and you will be directed to the wizard.
Bugs are tracked on GitHub 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.
+feedback.
Do not contact contributors directly about support or help with technical issues.
@@ -453,7 +453,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
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 project on GitHub.
+
This module is part of the OCA/stock-logistics-warehouse project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/stock_move_location/tests/test_common.py b/stock_move_location/tests/test_common.py
index bdb67f3d7..21da35c5f 100644
--- a/stock_move_location/tests/test_common.py
+++ b/stock_move_location/tests/test_common.py
@@ -14,56 +14,63 @@ class TestsCommon(common.SavepointCase):
product_obj = cls.env["product.product"]
cls.wizard_obj = cls.env["wiz.stock.move.location"]
cls.quant_obj = cls.env["stock.quant"]
-
- # Enable multi-locations:
- wizard = cls.env["res.config.settings"].create(
- {"group_stock_multi_locations": True}
- )
- wizard.execute()
+ cls.company = cls.env.ref("base.main_company")
cls.internal_loc_1 = cls.location_obj.create(
- {"name": "INT_1", "usage": "internal", "active": True}
+ {
+ "name": "INT_1",
+ "usage": "internal",
+ "active": True,
+ "company_id": cls.company.id,
+ }
)
cls.internal_loc_2 = cls.location_obj.create(
- {"name": "INT_2", "usage": "internal", "active": True}
+ {
+ "name": "INT_2",
+ "usage": "internal",
+ "active": True,
+ "company_id": cls.company.id,
+ }
)
cls.uom_unit = cls.env.ref("uom.product_uom_unit")
cls.product_no_lots = product_obj.create(
- {
- "name": "Pineapple",
- "type": "product",
- "tracking": "none",
- "category_id": cls.env.ref("product.product_category_all").id,
- }
+ {"name": "Pineapple", "type": "product", "tracking": "none"}
)
cls.product_lots = product_obj.create(
- {
- "name": "Pineapple",
- "type": "product",
- "tracking": "lot",
- "category_id": cls.env.ref("product.product_category_all").id,
- }
+ {"name": "Apple", "type": "product", "tracking": "lot"}
)
cls.lot1 = cls.env["stock.production.lot"].create(
- {"product_id": cls.product_lots.id}
+ {
+ "name": "lot1",
+ "product_id": cls.product_lots.id,
+ "company_id": cls.company.id,
+ }
)
cls.lot2 = cls.env["stock.production.lot"].create(
- {"product_id": cls.product_lots.id}
+ {
+ "name": "lot2",
+ "product_id": cls.product_lots.id,
+ "company_id": cls.company.id,
+ }
)
cls.lot3 = cls.env["stock.production.lot"].create(
- {"product_id": cls.product_lots.id}
+ {
+ "name": "lot3",
+ "product_id": cls.product_lots.id,
+ "company_id": cls.company.id,
+ }
)
def setup_product_amounts(self):
self.set_product_amount(self.product_no_lots, self.internal_loc_1, 123)
self.set_product_amount(
- self.product_lots, self.internal_loc_1, 1, lot_id=self.lot1
+ self.product_lots, self.internal_loc_1, 1.0, lot_id=self.lot1
)
self.set_product_amount(
- self.product_lots, self.internal_loc_1, 1, lot_id=self.lot2
+ self.product_lots, self.internal_loc_1, 1.0, lot_id=self.lot2
)
self.set_product_amount(
- self.product_lots, self.internal_loc_1, 1, lot_id=self.lot3
+ self.product_lots, self.internal_loc_1, 1.0, lot_id=self.lot3
)
def set_product_amount(self, product, location, amount, lot_id=None):
@@ -78,3 +85,12 @@ class TestsCommon(common.SavepointCase):
),
amount,
)
+
+ def _create_wizard(self, origin_location, destination_location):
+ move_location_wizard = self.env["wiz.stock.move.location"]
+ return move_location_wizard.create(
+ {
+ "origin_location_id": origin_location.id,
+ "destination_location_id": destination_location.id,
+ }
+ )
diff --git a/stock_move_location/tests/test_move_location.py b/stock_move_location/tests/test_move_location.py
index 120166ad8..2b6250848 100644
--- a/stock_move_location/tests/test_move_location.py
+++ b/stock_move_location/tests/test_move_location.py
@@ -12,14 +12,6 @@ class TestMoveLocation(TestsCommon):
super().setUp()
self.setup_product_amounts()
- def _create_wizard(self, origin_location, destination_location):
- return self.wizard_obj.create(
- {
- "origin_location_id": origin_location.id,
- "destination_location_id": destination_location.id,
- }
- )
-
def test_move_location_wizard(self):
"""Test a simple move."""
wizard = self._create_wizard(self.internal_loc_1, self.internal_loc_2)
diff --git a/stock_move_location/wizard/stock_move_location.py b/stock_move_location/wizard/stock_move_location.py
index 8dac23ce7..a8f691cd8 100644
--- a/stock_move_location/wizard/stock_move_location.py
+++ b/stock_move_location/wizard/stock_move_location.py
@@ -11,7 +11,6 @@ class StockMoveLocationWizard(models.TransientModel):
_name = "wiz.stock.move.location"
_description = "Wizard move location"
- @api.multi
def _get_default_picking_type_id(self):
company_id = self.env.context.get("company_id") or self.env.user.company_id.id
return (
@@ -63,6 +62,9 @@ class StockMoveLocationWizard(models.TransientModel):
rec.origin_location_disable = self.env.context.get(
"origin_location_disable", False
)
+ rec.destination_location_disable = self.env.context.get(
+ "destination_location_disable", False
+ )
if not rec.edit_locations:
rec.origin_location_disable = True
rec.destination_location_disable = True
@@ -120,7 +122,6 @@ class StockMoveLocationWizard(models.TransientModel):
}
)
- @api.multi
def group_lines(self):
lines_grouped = {}
for line in self.stock_move_location_line_ids:
@@ -130,7 +131,6 @@ class StockMoveLocationWizard(models.TransientModel):
lines_grouped[line.product_id.id] |= line
return lines_grouped
- @api.multi
def _create_moves(self, picking):
self.ensure_one()
groups = self.group_lines()
@@ -158,7 +158,6 @@ class StockMoveLocationWizard(models.TransientModel):
"location_move": True,
}
- @api.multi
def _create_move(self, picking, lines):
self.ensure_one()
move = self.env["stock.move"].create(self._get_move_values(picking, lines))
@@ -167,7 +166,6 @@ class StockMoveLocationWizard(models.TransientModel):
line.create_move_lines(picking, move)
return move
- @api.multi
def action_move_location(self):
self.ensure_one()
picking = self._create_picking()
@@ -189,18 +187,16 @@ class StockMoveLocationWizard(models.TransientModel):
return action
def _get_group_quants(self):
- location_id = self.origin_location_id.id
- company = self.env["res.company"]._company_default_get("stock.inventory")
+ location_id = self.origin_location_id
# Using sql as search_group doesn't support aggregation functions
# leading to overhead in queries to DB
query = """
SELECT product_id, lot_id, SUM(quantity)
FROM stock_quant
WHERE location_id = %s
- AND company_id = %s
GROUP BY product_id, lot_id
"""
- self.env.cr.execute(query, (location_id, company.id))
+ self.env.cr.execute(query, (location_id.id,))
return self.env.cr.dictfetchall()
def _get_stock_move_location_lines_values(self):
@@ -210,7 +206,7 @@ class StockMoveLocationWizard(models.TransientModel):
product = product_obj.browse(group.get("product_id")).exists()
# Apply the putaway strategy
location_dest_id = (
- self.destination_location_id.get_putaway_strategy(product).id
+ self.destination_location_id._get_putaway_strategy(product).id
or self.destination_location_id.id
)
product_data.append(
diff --git a/stock_move_location/wizard/stock_move_location.xml b/stock_move_location/wizard/stock_move_location.xml
old mode 100755
new mode 100644
diff --git a/stock_move_location/wizard/stock_move_location_line.py b/stock_move_location/wizard/stock_move_location_line.py
index 643dededf..514b54eb6 100644
--- a/stock_move_location/wizard/stock_move_location_line.py
+++ b/stock_move_location/wizard/stock_move_location_line.py
@@ -6,8 +6,6 @@ from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
from odoo.tools import float_compare
-from odoo.addons import decimal_precision as dp
-
class StockMoveLocationWizardLine(models.TransientModel):
_name = "wiz.stock.move.location.line"
@@ -31,11 +29,10 @@ class StockMoveLocationWizardLine(models.TransientModel):
domain="[('product_id','=',product_id)]",
)
move_quantity = fields.Float(
- string="Quantity to move", digits=dp.get_precision("Product Unit of Measure")
+ string="Quantity to move", digits="Product Unit of Measure"
)
max_quantity = fields.Float(
- string="Maximum available quantity",
- digits=dp.get_precision("Product Unit of Measure"),
+ string="Maximum available quantity", digits="Product Unit of Measure"
)
custom = fields.Boolean(string="Custom line", default=True)
@@ -78,11 +75,10 @@ class StockMoveLocationWizardLine(models.TransientModel):
self.env["stock.move.line"].create(values)
return True
- @api.multi
def _get_move_line_values(self, picking, move):
self.ensure_one()
location_dest_id = (
- self.destination_location_id.get_putaway_strategy(self.product_id).id
+ self.destination_location_id._get_putaway_strategy(self.product_id).id
or self.destination_location_id.id
)
qty_todo, qty_done = self._get_available_quantity()