mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
@@ -7,7 +7,7 @@ Move Stock Location
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:f94651ddb9871ffc275f587042e4db32c13f087592f5766ea5b466264d47dcd1
|
||||
!! source digest: sha256:87949c0c9182db96bf0d8e687697a678c119a5949d366f137d03a681d2fd44cd
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
||||
@@ -139,6 +139,9 @@ Contributors
|
||||
- Iryna Vyshnevska <i.vyshnevska@mobilunity.com>
|
||||
- Alexei Rivera <arivera@archeti.com>
|
||||
- Abraham Anes <abraham@studio73.es>
|
||||
- Quartile <https://www.quartile.co>
|
||||
|
||||
- Aung Ko Ko Lin
|
||||
|
||||
Maintainers
|
||||
-----------
|
||||
|
||||
@@ -11,3 +11,5 @@
|
||||
- Iryna Vyshnevska \<<i.vyshnevska@mobilunity.com>\>
|
||||
- Alexei Rivera \<<arivera@archeti.com>\>
|
||||
- Abraham Anes \<<abraham@studio73.es>\>
|
||||
- Quartile \<<https://www.quartile.co>\>
|
||||
- Aung Ko Ko Lin
|
||||
|
||||
@@ -367,7 +367,7 @@ ul.auto-toc {
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:f94651ddb9871ffc275f587042e4db32c13f087592f5766ea5b466264d47dcd1
|
||||
!! source digest: sha256:87949c0c9182db96bf0d8e687697a678c119a5949d366f137d03a681d2fd44cd
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" 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 image-reference" href="https://github.com/OCA/stock-logistics-warehouse/tree/16.0/stock_move_location"><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 image-reference" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-16-0/stock-logistics-warehouse-16-0-stock_move_location"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-warehouse&target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module allows to move entire location of products from one place to
|
||||
@@ -479,6 +479,10 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
|
||||
<li>Iryna Vyshnevska <<a class="reference external" href="mailto:i.vyshnevska@mobilunity.com">i.vyshnevska@mobilunity.com</a>></li>
|
||||
<li>Alexei Rivera <<a class="reference external" href="mailto:arivera@archeti.com">arivera@archeti.com</a>></li>
|
||||
<li>Abraham Anes <<a class="reference external" href="mailto:abraham@studio73.es">abraham@studio73.es</a>></li>
|
||||
<li>Quartile <<a class="reference external" href="https://www.quartile.co">https://www.quartile.co</a>><ul>
|
||||
<li>Aung Ko Ko Lin</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
|
||||
@@ -124,7 +124,28 @@ class TestMoveLocation(TestsCommon):
|
||||
wizard.action_move_location()
|
||||
picking = wizard.picking_id
|
||||
self.assertEqual(picking.state, "assigned")
|
||||
self.assertEqual(len(picking.move_line_ids), 7)
|
||||
self.assertEqual(
|
||||
len(wizard.stock_move_location_line_ids), len(picking.move_line_ids)
|
||||
)
|
||||
wizard_lines = sorted(
|
||||
[
|
||||
(line.product_id.id, line.lot_id.id, line.move_quantity)
|
||||
for line in wizard.stock_move_location_line_ids
|
||||
],
|
||||
key=lambda x: (x[0], x[1]),
|
||||
)
|
||||
picking_lines = sorted(
|
||||
[
|
||||
(line.product_id.id, line.lot_id.id, line.reserved_uom_qty)
|
||||
for line in picking.move_line_ids
|
||||
],
|
||||
key=lambda x: (x[0], x[1]),
|
||||
)
|
||||
self.assertEqual(
|
||||
wizard_lines,
|
||||
picking_lines,
|
||||
"Mismatch between move location lines and move lines",
|
||||
)
|
||||
self.assertEqual(
|
||||
sorted(picking.move_line_ids.mapped("reserved_uom_qty")),
|
||||
[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 123.0],
|
||||
|
||||
@@ -100,6 +100,7 @@ class StockMoveLocationWizard(models.TransientModel):
|
||||
"product_id": quant.product_id.id,
|
||||
"move_quantity": quant.quantity,
|
||||
"max_quantity": quant.quantity,
|
||||
"reserved_quantity": quant.reserved_quantity,
|
||||
"origin_location_id": quant.location_id.id,
|
||||
"lot_id": quant.lot_id.id,
|
||||
"package_id": quant.package_id.id,
|
||||
@@ -128,6 +129,7 @@ class StockMoveLocationWizard(models.TransientModel):
|
||||
"product_id": quant.product_id.id,
|
||||
"move_quantity": qty,
|
||||
"max_quantity": qty,
|
||||
"reserved_quantity": quant.reserved_quantity,
|
||||
"origin_location_id": quant.location_id.id,
|
||||
"lot_id": quant.lot_id.id,
|
||||
"package_id": quant.package_id.id,
|
||||
@@ -155,7 +157,7 @@ class StockMoveLocationWizard(models.TransientModel):
|
||||
def _get_locations_domain(self):
|
||||
return [
|
||||
"|",
|
||||
("company_id", "=", self.env.user.company_id.id),
|
||||
("company_id", "=", self.env.company.id),
|
||||
("company_id", "=", False),
|
||||
]
|
||||
|
||||
@@ -207,9 +209,30 @@ class StockMoveLocationWizard(models.TransientModel):
|
||||
def _create_move(self, picking, lines):
|
||||
self.ensure_one()
|
||||
move = self.env["stock.move"].create(self._get_move_values(picking, lines))
|
||||
if not self.env.context.get("planned"):
|
||||
lines.create_move_lines(picking, move)
|
||||
if self.env.context.get("planned"):
|
||||
for line in lines:
|
||||
line.create_move_lines(picking, move)
|
||||
available_quantity = self.env["stock.quant"]._get_available_quantity(
|
||||
line.product_id,
|
||||
line.origin_location_id,
|
||||
lot_id=line.lot_id,
|
||||
package_id=line.package_id,
|
||||
owner_id=line.owner_id,
|
||||
strict=False,
|
||||
)
|
||||
move._update_reserved_quantity(
|
||||
line.move_quantity,
|
||||
available_quantity,
|
||||
line.origin_location_id,
|
||||
lot_id=line.lot_id,
|
||||
package_id=line.package_id,
|
||||
owner_id=line.owner_id,
|
||||
strict=False,
|
||||
)
|
||||
# Force the state to be assigned, instead of _action_assign,
|
||||
# to avoid discarding the selected move_location_line.
|
||||
move.state = "assigned"
|
||||
move.move_line_ids.write({"state": "assigned"})
|
||||
return move
|
||||
|
||||
def _unreserve_moves(self):
|
||||
@@ -255,9 +278,6 @@ class StockMoveLocationWizard(models.TransientModel):
|
||||
moves_to_reassign = self._unreserve_moves()
|
||||
picking.button_validate()
|
||||
moves_to_reassign._action_assign()
|
||||
else:
|
||||
picking.action_confirm()
|
||||
picking.action_assign()
|
||||
self.picking_id = picking
|
||||
return self._get_picking_action(picking.id)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user