[FIX] stock_move_location: Bug on onchange origin location

This commit is contained in:
Alexei Rivera
2022-09-21 08:55:10 -04:00
committed by Alex Cuellar
parent 34285e7711
commit b5085845cd
5 changed files with 30 additions and 3 deletions

View File

@@ -114,6 +114,7 @@ Contributors
* João Marques
* Jacques-Etienne Baudoux <je@bcim.be>
* Iryna Vyshnevska <i.vyshnevska@mobilunity.com>
* Alexei Rivera <arivera@archeti.com>
Maintainers
~~~~~~~~~~~

View File

@@ -10,3 +10,4 @@
* João Marques
* Jacques-Etienne Baudoux <je@bcim.be>
* Iryna Vyshnevska <i.vyshnevska@mobilunity.com>
* Alexei Rivera <arivera@archeti.com>

View File

@@ -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: http://docutils.sourceforge.net/" />
<title>Move Stock Location</title>
<style type="text/css">
@@ -461,6 +461,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
</li>
<li>Jacques-Etienne Baudoux &lt;<a class="reference external" href="mailto:je&#64;bcim.be">je&#64;bcim.be</a>&gt;</li>
<li>Iryna Vyshnevska &lt;<a class="reference external" href="mailto:i.vyshnevska&#64;mobilunity.com">i.vyshnevska&#64;mobilunity.com</a>&gt;</li>
<li>Alexei Rivera &lt;<a class="reference external" href="mailto:arivera&#64;archeti.com">arivera&#64;archeti.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">

View File

@@ -64,6 +64,30 @@ class TestMoveLocation(TestsCommon):
wizard._onchange_origin_location_id()
self.assertEqual(len(wizard.stock_move_location_line_ids), 0)
def test_wizard_onchange_origin_location(self):
"""Test a product that have existing quants with undefined quantity."""
product_not_available = self.env["product.product"].create(
{"name": "Mango", "type": "product", "tracking": "none"}
)
self.quant_obj.create(
{
"product_id": product_not_available.id,
"location_id": self.internal_loc_1.id,
}
)
wizard = self._create_wizard(self.internal_loc_1, self.internal_loc_2)
wizard.onchange_origin_location()
# we check there is no line for product_not_available
self.assertEqual(
len(
wizard.stock_move_location_line_ids.filtered(
lambda x: x.product_id.id == product_not_available.id
)
),
0,
)
def test_planned_transfer(self):
"""Test planned transfer."""
wizard = self._create_wizard(self.internal_loc_1, self.internal_loc_2)

View File

@@ -292,8 +292,8 @@ class StockMoveLocationWizard(models.TransientModel):
product_data.append(
{
"product_id": product.id,
"move_quantity": group.get("quantity"),
"max_quantity": group.get("quantity"),
"move_quantity": group.get("quantity") or 0,
"max_quantity": group.get("quantity") or 0,
"reserved_quantity": group.get("reserved_quantity"),
"origin_location_id": self.origin_location_id.id,
"destination_location_id": location_dest_id,