mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[IMP] stock_move_location tests: _set_product_amount should actually set the amount and not increase/decrease
This commit is contained in:
@@ -120,10 +120,21 @@ class TestsCommon(common.SavepointCase):
|
|||||||
def set_product_amount(
|
def set_product_amount(
|
||||||
self, product, location, amount, lot_id=None, package_id=None, owner_id=None
|
self, product, location, amount, lot_id=None, package_id=None, owner_id=None
|
||||||
):
|
):
|
||||||
|
"""Set available stock Quantity to 'amount'"""
|
||||||
|
current_qty = self.env["stock.quant"]._get_available_quantity(
|
||||||
|
product,
|
||||||
|
location,
|
||||||
|
lot_id=lot_id,
|
||||||
|
package_id=package_id,
|
||||||
|
owner_id=owner_id,
|
||||||
|
)
|
||||||
|
# Since _update_available_quantity decreases or increases,
|
||||||
|
# we need to first get the current amount.
|
||||||
|
change_amount = amount - current_qty
|
||||||
self.env["stock.quant"]._update_available_quantity(
|
self.env["stock.quant"]._update_available_quantity(
|
||||||
product,
|
product,
|
||||||
location,
|
location,
|
||||||
amount,
|
change_amount,
|
||||||
lot_id=lot_id,
|
lot_id=lot_id,
|
||||||
package_id=package_id,
|
package_id=package_id,
|
||||||
owner_id=owner_id,
|
owner_id=owner_id,
|
||||||
|
|||||||
Reference in New Issue
Block a user